diff options
author | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-17 01:24:16 +0000 |
---|---|---|
committer | danakj@chromium.org <danakj@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-17 01:24:16 +0000 |
commit | 9260757f9dd8de119450e6cc351dda15df17cf8d (patch) | |
tree | 1aa791088cd401d42e714c1b102635e7e4caf480 /cc/layers/texture_layer.h | |
parent | 0ceda8a5374cf90e636134835d41c3194c52b0bc (diff) | |
download | chromium_src-9260757f9dd8de119450e6cc351dda15df17cf8d.zip chromium_src-9260757f9dd8de119450e6cc351dda15df17cf8d.tar.gz chromium_src-9260757f9dd8de119450e6cc351dda15df17cf8d.tar.bz2 |
cc: Move TextureMailbox::ReleaseCallback to SingleReleaseCallback.
This moves the release callback out of the TextureMailbox so that we
can use it for other resource types than just texture mailboxes.
While doing this, we make a SingleReleaseCallback class that is
held in a scoped_ptr. This class DCHECKs that the callback is run
before it is destroyed, and ensures clear ownership semantics as
you must Pass() the callback around.
No change in behaviour, covered by existing tests.
R=piman
BUG=263069
Review URL: https://chromiumcodereview.appspot.com/23648014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@223500 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'cc/layers/texture_layer.h')
-rw-r--r-- | cc/layers/texture_layer.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index cb34cf5..5fb214c 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h @@ -17,6 +17,7 @@ namespace WebKit { class WebGraphicsContext3D; } namespace cc { class BlockingTaskRunner; +class SingleReleaseCallback; class TextureLayerClient; // A Layer containing a the rendered output of a plugin instance. @@ -41,20 +42,22 @@ class CC_EXPORT TextureLayer : public Layer { // Gets a ReleaseCallback that can be called from another thread. Note: the // caller must ensure the callback is called. - TextureMailbox::ReleaseCallback GetCallbackForImplThread(); + scoped_ptr<SingleReleaseCallback> GetCallbackForImplThread(); protected: friend class TextureLayer; // Protected visiblity so only TextureLayer and unit tests can create these. static scoped_ptr<MainThreadReference> Create( - const TextureMailbox& mailbox); + const TextureMailbox& mailbox, + scoped_ptr<SingleReleaseCallback> release_callback); virtual ~MailboxHolder(); private: friend class base::RefCountedThreadSafe<MailboxHolder>; friend class MainThreadReference; - explicit MailboxHolder(const TextureMailbox& mailbox); + explicit MailboxHolder(const TextureMailbox& mailbox, + scoped_ptr<SingleReleaseCallback> release_callback); void InternalAddRef(); void InternalRelease(); @@ -67,6 +70,7 @@ class CC_EXPORT TextureLayer : public Layer { // during commit where the main thread is blocked. unsigned internal_references_; TextureMailbox mailbox_; + scoped_ptr<SingleReleaseCallback> release_callback_; // This lock guards the sync_point_ and is_lost_ fields because they can be // accessed on both the impl and main thread. We do this to ensure that the @@ -125,7 +129,8 @@ class CC_EXPORT TextureLayer : public Layer { // Code path for plugins which supply their own mailbox. bool uses_mailbox() const { return uses_mailbox_; } - void SetTextureMailbox(const TextureMailbox& mailbox); + void SetTextureMailbox(const TextureMailbox& mailbox, + scoped_ptr<SingleReleaseCallback> release_callback); void WillModifyTexture(); |