Chromium Code Reviews| Index: cc/layers/texture_layer.h |
| diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h |
| index 6de1ea49efeee466ad273c2de98b89c817f01f99..5193fae45087b4174b35efdeca097acdefe1a296 100644 |
| --- a/cc/layers/texture_layer.h |
| +++ b/cc/layers/texture_layer.h |
| @@ -14,6 +14,10 @@ |
| namespace WebKit { class WebGraphicsContext3D; } |
| +namespace base { |
| +class MessageLoopProxy; |
| +} |
| + |
| namespace cc { |
| class TextureLayerClient; |
| @@ -84,6 +88,35 @@ class CC_EXPORT TextureLayer : public Layer { |
| virtual ~TextureLayer(); |
| private: |
| + class MailboxHolder : public base::RefCounted<MailboxHolder> { |
| + public: |
| + explicit MailboxHolder(const TextureMailbox& mailbox); |
| + |
| + const TextureMailbox& mailbox() const { return mailbox_; } |
| + void Return(unsigned sync_point, bool is_lost); |
| + |
| + // Gets a ReleaseCallback that can be called from another thread. Note: this |
| + // adds a reference that is only released when the callback is called (as |
| + // opposed to a traditional callback which releases the reference on |
| + // destruction), so the caller must ensure the callback is called. |
| + TextureMailbox::ReleaseCallback GetCallbackForImplThread(); |
| + |
| + private: |
| + friend class base::RefCounted<MailboxHolder>; |
| + ~MailboxHolder(); |
| + void ReturnAndReleaseOnMainThread(unsigned sync_point, bool is_lost); |
| + void ReturnAndReleaseOnImplThread(unsigned sync_point, bool is_lost); |
| + |
| + // Thread safety notes: except for the thread-safe message_loop_, all fields |
| + // (including refcount) are only used on the main thread, or on the impl |
| + // thread during commit where the main thread is blocked. |
| + scoped_refptr<base::MessageLoopProxy> const message_loop_; |
|
danakj
2013/06/18 00:53:24
nit: const first (why const?)
piman
2013/06/18 02:10:58
Done.
|
| + TextureMailbox mailbox_; |
| + unsigned sync_point_; |
| + bool is_lost_; |
| + DISALLOW_COPY_AND_ASSIGN(MailboxHolder); |
| + }; |
| + |
| TextureLayerClient* client_; |
| bool uses_mailbox_; |
| @@ -98,8 +131,8 @@ class CC_EXPORT TextureLayer : public Layer { |
| bool content_committed_; |
| unsigned texture_id_; |
| - TextureMailbox texture_mailbox_; |
| - bool own_mailbox_; |
| + scoped_refptr<MailboxHolder> holder_; |
| + bool needs_set_mailbox_; |
| DISALLOW_COPY_AND_ASSIGN(TextureLayer); |
| }; |