diff options
author | Lajos Molnar <lajos@google.com> | 2015-03-05 14:35:41 -0800 |
---|---|---|
committer | Lajos Molnar <lajos@google.com> | 2015-03-10 10:36:09 -0700 |
commit | 3f27436a9346f043f52265da1e6a74cde2bffd4d (patch) | |
tree | a7404d2ba96071bea1f02f93f6782214fc1e4cc1 /include/media/stagefright/foundation/ALooper.h | |
parent | 0655386a0dc15fc31883d2e38917ff0e9db89ae7 (diff) | |
download | frameworks_av-3f27436a9346f043f52265da1e6a74cde2bffd4d.zip frameworks_av-3f27436a9346f043f52265da1e6a74cde2bffd4d.tar.gz frameworks_av-3f27436a9346f043f52265da1e6a74cde2bffd4d.tar.bz2 |
stagefright: don't use ALooperRoster mutex for reply handling
Change replyID-s from uint32_t to an object
Move reply handling into the loopers (to reuse a common mutex)
Bug: 19607784
Change-Id: Iaa035b846c424c5687ed17ce1079b325e86c54be
Diffstat (limited to 'include/media/stagefright/foundation/ALooper.h')
-rw-r--r-- | include/media/stagefright/foundation/ALooper.h | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/include/media/stagefright/foundation/ALooper.h b/include/media/stagefright/foundation/ALooper.h index 150cdba..09c469b 100644 --- a/include/media/stagefright/foundation/ALooper.h +++ b/include/media/stagefright/foundation/ALooper.h @@ -30,6 +30,7 @@ namespace android { struct AHandler; struct AMessage; +struct AReplyToken; struct ALooper : public RefBase { typedef int32_t event_id; @@ -79,7 +80,27 @@ private: sp<LooperThread> mThread; bool mRunningLocally; + // use a separate lock for reply handling, as it is always on another thread + // use a central lock, however, to avoid creating a mutex for each reply + Mutex mRepliesLock; + Condition mRepliesCondition; + + // START --- methods used only by AMessage + + // posts a message on this looper with the given timeout void post(const sp<AMessage> &msg, int64_t delayUs); + + // creates a reply token to be used with this looper + sp<AReplyToken> createReplyToken(); + // waits for a response for the reply token. If status is OK, the response + // is stored into the supplied variable. Otherwise, it is unchanged. + status_t awaitResponse(const sp<AReplyToken> &replyToken, sp<AMessage> *response); + // posts a reply for a reply token. If the reply could be successfully posted, + // it returns OK. Otherwise, it returns an error value. + status_t postReply(const sp<AReplyToken> &replyToken, const sp<AMessage> &msg); + + // END --- methods used only by AMessage + bool loop(); DISALLOW_EVIL_CONSTRUCTORS(ALooper); |