diff options
Diffstat (limited to 'cc')
25 files changed, 331 insertions, 313 deletions
@@ -7,7 +7,6 @@ include_rules = [ "+gpu/command_buffer/common/gpu_memory_allocation.h", "+gpu/command_buffer/common/capabilities.h", "+gpu/command_buffer/common/mailbox.h", - "+gpu/command_buffer/common/mailbox_holder.h", "+media", "+skia/ext", "+third_party/skia/include", diff --git a/cc/layers/delegated_frame_provider_unittest.cc b/cc/layers/delegated_frame_provider_unittest.cc index f29488d..2a4f564 100644 --- a/cc/layers/delegated_frame_provider_unittest.cc +++ b/cc/layers/delegated_frame_provider_unittest.cc @@ -38,7 +38,7 @@ class DelegatedFrameProviderTest ResourceProvider::ResourceId resource_id) { TransferableResource resource; resource.id = resource_id; - resource.mailbox_holder.texture_target = GL_TEXTURE_2D; + resource.target = GL_TEXTURE_2D; frame->resource_list.push_back(resource); } diff --git a/cc/layers/texture_layer.cc b/cc/layers/texture_layer.cc index bc6b58a..b37b3e3 100644 --- a/cc/layers/texture_layer.cc +++ b/cc/layers/texture_layer.cc @@ -142,12 +142,10 @@ void TextureLayer::SetTextureMailboxInternal( DCHECK_EQ(mailbox.IsValid(), !!release_callback); // If we never commited the mailbox, we need to release it here. - if (mailbox.IsValid()) { - holder_ref_ = - TextureMailboxHolder::Create(mailbox, release_callback.Pass()); - } else { + if (mailbox.IsValid()) + holder_ref_ = MailboxHolder::Create(mailbox, release_callback.Pass()); + else holder_ref_.reset(); - } needs_set_mailbox_ = true; // If we are within a commit, no need to do it again immediately after. if (requires_commit) @@ -264,7 +262,7 @@ void TextureLayer::PushPropertiesTo(LayerImpl* layer) { TextureMailbox texture_mailbox; scoped_ptr<SingleReleaseCallback> release_callback; if (holder_ref_) { - TextureMailboxHolder* holder = holder_ref_->holder(); + MailboxHolder* holder = holder_ref_->holder(); texture_mailbox = holder->mailbox(); release_callback = holder->GetCallbackForImplThread(); } @@ -286,18 +284,17 @@ Region TextureLayer::VisibleContentOpaqueRegion() const { return Region(); } -TextureLayer::TextureMailboxHolder::MainThreadReference::MainThreadReference( - TextureMailboxHolder* holder) +TextureLayer::MailboxHolder::MainThreadReference::MainThreadReference( + MailboxHolder* holder) : holder_(holder) { holder_->InternalAddRef(); } -TextureLayer::TextureMailboxHolder::MainThreadReference:: - ~MainThreadReference() { +TextureLayer::MailboxHolder::MainThreadReference::~MainThreadReference() { holder_->InternalRelease(); } -TextureLayer::TextureMailboxHolder::TextureMailboxHolder( +TextureLayer::MailboxHolder::MailboxHolder( const TextureMailbox& mailbox, scoped_ptr<SingleReleaseCallback> release_callback) : message_loop_(BlockingTaskRunner::current()), @@ -305,42 +302,42 @@ TextureLayer::TextureMailboxHolder::TextureMailboxHolder( mailbox_(mailbox), release_callback_(release_callback.Pass()), sync_point_(mailbox.sync_point()), - is_lost_(false) {} + is_lost_(false) { +} -TextureLayer::TextureMailboxHolder::~TextureMailboxHolder() { +TextureLayer::MailboxHolder::~MailboxHolder() { DCHECK_EQ(0u, internal_references_); } -scoped_ptr<TextureLayer::TextureMailboxHolder::MainThreadReference> -TextureLayer::TextureMailboxHolder::Create( +scoped_ptr<TextureLayer::MailboxHolder::MainThreadReference> +TextureLayer::MailboxHolder::Create( const TextureMailbox& mailbox, scoped_ptr<SingleReleaseCallback> release_callback) { return scoped_ptr<MainThreadReference>(new MainThreadReference( - new TextureMailboxHolder(mailbox, release_callback.Pass()))); + new MailboxHolder(mailbox, release_callback.Pass()))); } -void TextureLayer::TextureMailboxHolder::Return(uint32 sync_point, - bool is_lost) { +void TextureLayer::MailboxHolder::Return(unsigned sync_point, bool is_lost) { base::AutoLock lock(arguments_lock_); sync_point_ = sync_point; is_lost_ = is_lost; } scoped_ptr<SingleReleaseCallback> -TextureLayer::TextureMailboxHolder::GetCallbackForImplThread() { +TextureLayer::MailboxHolder::GetCallbackForImplThread() { // We can't call GetCallbackForImplThread if we released the main thread // reference. DCHECK_GT(internal_references_, 0u); InternalAddRef(); return SingleReleaseCallback::Create( - base::Bind(&TextureMailboxHolder::ReturnAndReleaseOnImplThread, this)); + base::Bind(&MailboxHolder::ReturnAndReleaseOnImplThread, this)); } -void TextureLayer::TextureMailboxHolder::InternalAddRef() { +void TextureLayer::MailboxHolder::InternalAddRef() { ++internal_references_; } -void TextureLayer::TextureMailboxHolder::InternalRelease() { +void TextureLayer::MailboxHolder::InternalRelease() { DCHECK(message_loop_->BelongsToCurrentThread()); if (!--internal_references_) { release_callback_->Run(sync_point_, is_lost_); @@ -349,12 +346,11 @@ void TextureLayer::TextureMailboxHolder::InternalRelease() { } } -void TextureLayer::TextureMailboxHolder::ReturnAndReleaseOnImplThread( - uint32 sync_point, - bool is_lost) { +void TextureLayer::MailboxHolder::ReturnAndReleaseOnImplThread( + unsigned sync_point, bool is_lost) { Return(sync_point, is_lost); - message_loop_->PostTask( - FROM_HERE, base::Bind(&TextureMailboxHolder::InternalRelease, this)); + message_loop_->PostTask(FROM_HERE, + base::Bind(&MailboxHolder::InternalRelease, this)); } } // namespace cc diff --git a/cc/layers/texture_layer.h b/cc/layers/texture_layer.h index bb179a6..8565247 100644 --- a/cc/layers/texture_layer.h +++ b/cc/layers/texture_layer.h @@ -21,22 +21,22 @@ class TextureLayerClient; // A Layer containing a the rendered output of a plugin instance. class CC_EXPORT TextureLayer : public Layer { public: - class CC_EXPORT TextureMailboxHolder - : public base::RefCountedThreadSafe<TextureMailboxHolder> { + class CC_EXPORT MailboxHolder + : public base::RefCountedThreadSafe<MailboxHolder> { public: class CC_EXPORT MainThreadReference { public: - explicit MainThreadReference(TextureMailboxHolder* holder); + explicit MainThreadReference(MailboxHolder* holder); ~MainThreadReference(); - TextureMailboxHolder* holder() { return holder_.get(); } + MailboxHolder* holder() { return holder_.get(); } private: - scoped_refptr<TextureMailboxHolder> holder_; + scoped_refptr<MailboxHolder> holder_; DISALLOW_COPY_AND_ASSIGN(MainThreadReference); }; const TextureMailbox& mailbox() const { return mailbox_; } - void Return(uint32 sync_point, bool is_lost); + void Return(unsigned sync_point, bool is_lost); // Gets a ReleaseCallback that can be called from another thread. Note: the // caller must ensure the callback is called. @@ -49,18 +49,17 @@ class CC_EXPORT TextureLayer : public Layer { static scoped_ptr<MainThreadReference> Create( const TextureMailbox& mailbox, scoped_ptr<SingleReleaseCallback> release_callback); - virtual ~TextureMailboxHolder(); + virtual ~MailboxHolder(); private: - friend class base::RefCountedThreadSafe<TextureMailboxHolder>; + friend class base::RefCountedThreadSafe<MailboxHolder>; friend class MainThreadReference; - explicit TextureMailboxHolder( - const TextureMailbox& mailbox, - scoped_ptr<SingleReleaseCallback> release_callback); + explicit MailboxHolder(const TextureMailbox& mailbox, + scoped_ptr<SingleReleaseCallback> release_callback); void InternalAddRef(); void InternalRelease(); - void ReturnAndReleaseOnImplThread(uint32 sync_point, bool is_lost); + void ReturnAndReleaseOnImplThread(unsigned sync_point, bool is_lost); // This member is thread safe, and is accessed on main and impl threads. const scoped_refptr<BlockingTaskRunner> message_loop_; @@ -76,9 +75,9 @@ class CC_EXPORT TextureLayer : public Layer { // values of these fields are well-ordered such that the last call to // ReturnAndReleaseOnImplThread() defines their values. base::Lock arguments_lock_; - uint32 sync_point_; + unsigned sync_point_; bool is_lost_; - DISALLOW_COPY_AND_ASSIGN(TextureMailboxHolder); + DISALLOW_COPY_AND_ASSIGN(MailboxHolder); }; // If this texture layer requires special preparation logic for each frame @@ -166,7 +165,7 @@ class CC_EXPORT TextureLayer : public Layer { bool content_committed_; unsigned texture_id_; - scoped_ptr<TextureMailboxHolder::MainThreadReference> holder_ref_; + scoped_ptr<MailboxHolder::MainThreadReference> holder_ref_; bool needs_set_mailbox_; DISALLOW_COPY_AND_ASSIGN(TextureLayer); diff --git a/cc/layers/texture_layer_unittest.cc b/cc/layers/texture_layer_unittest.cc index 6b78a71..dc44a77 100644 --- a/cc/layers/texture_layer_unittest.cc +++ b/cc/layers/texture_layer_unittest.cc @@ -41,12 +41,6 @@ using ::testing::AnyNumber; namespace cc { namespace { -gpu::Mailbox MailboxFromString(const std::string& string) { - gpu::Mailbox mailbox; - mailbox.SetName(reinterpret_cast<const int8*>(string.data())); - return mailbox; -} - class MockLayerTreeHost : public LayerTreeHost { public: explicit MockLayerTreeHost(FakeLayerTreeHostClient* client) @@ -321,14 +315,12 @@ TEST_F(TextureLayerTest, RateLimiter) { class MockMailboxCallback { public: - MOCK_METHOD3(Release, - void(const std::string& mailbox, - uint32 sync_point, - bool lost_resource)); - MOCK_METHOD3(Release2, - void(base::SharedMemory* shared_memory, - uint32 sync_point, - bool lost_resource)); + MOCK_METHOD3(Release, void(const std::string& mailbox, + unsigned sync_point, + bool lost_resource)); + MOCK_METHOD3(Release2, void(base::SharedMemory* shared_memory, + unsigned sync_point, + bool lost_resource)); }; struct CommonMailboxObjects { @@ -344,12 +336,13 @@ struct CommonMailboxObjects { release_mailbox2_ = base::Bind(&MockMailboxCallback::Release, base::Unretained(&mock_callback_), mailbox_name2_); - const uint32 arbitrary_target1 = 1; - const uint32 arbitrary_target2 = 2; - mailbox1_ = TextureMailbox( - MailboxFromString(mailbox_name1_), arbitrary_target1, sync_point1_); - mailbox2_ = TextureMailbox( - MailboxFromString(mailbox_name2_), arbitrary_target2, sync_point2_); + gpu::Mailbox m1; + m1.SetName(reinterpret_cast<const int8*>(mailbox_name1_.data())); + mailbox1_ = TextureMailbox(m1, sync_point1_); + gpu::Mailbox m2; + m2.SetName(reinterpret_cast<const int8*>(mailbox_name2_.data())); + mailbox2_ = TextureMailbox(m2, sync_point2_); + gfx::Size size(128, 128); EXPECT_TRUE(shared_memory_->CreateAndMapAnonymous(4 * size.GetArea())); release_mailbox3_ = base::Bind(&MockMailboxCallback::Release2, @@ -367,14 +360,14 @@ struct CommonMailboxObjects { TextureMailbox mailbox1_; TextureMailbox mailbox2_; TextureMailbox mailbox3_; - uint32 sync_point1_; - uint32 sync_point2_; + unsigned sync_point1_; + unsigned sync_point2_; scoped_ptr<base::SharedMemory> shared_memory_; }; -class TestMailboxHolder : public TextureLayer::TextureMailboxHolder { +class TestMailboxHolder : public TextureLayer::MailboxHolder { public: - using TextureLayer::TextureMailboxHolder::Create; + using TextureLayer::MailboxHolder::Create; protected: virtual ~TestMailboxHolder() {} @@ -761,7 +754,7 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { commit_count_(0) {} // Make sure callback is received on main and doesn't block the impl thread. - void ReleaseCallback(uint32 sync_point, bool lost_resource) { + void ReleaseCallback(unsigned sync_point, bool lost_resource) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); EXPECT_FALSE(lost_resource); ++callback_count_; @@ -769,14 +762,12 @@ class TextureLayerImplWithMailboxThreadedCallback : public LayerTreeTest { void SetMailbox(char mailbox_char) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerImplWithMailboxThreadedCallback::ReleaseCallback, base::Unretained(this))); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void BeginTest() OVERRIDE { @@ -1026,16 +1017,14 @@ class TextureLayerMailboxIsActivatedDuringCommit : public LayerTreeTest { wait_thread_.Start(); } - static void ReleaseCallback(uint32 sync_point, bool lost_resource) {} + static void ReleaseCallback(unsigned sync_point, bool lost_resource) {} void SetMailbox(char mailbox_char) { + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerMailboxIsActivatedDuringCommit::ReleaseCallback)); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void BeginTest() OVERRIDE { @@ -1700,23 +1689,22 @@ class TextureLayerNoExtraCommitForMailboxTest return 0; } virtual bool PrepareTextureMailbox( - TextureMailbox* texture_mailbox, + TextureMailbox* mailbox, scoped_ptr<SingleReleaseCallback>* release_callback, bool use_shared_memory) OVERRIDE { if (layer_tree_host()->source_frame_number() == 1) { - *texture_mailbox = TextureMailbox(); + *mailbox = TextureMailbox(); return true; } - *texture_mailbox = TextureMailbox( - MailboxFromString(std::string(64, '1')), GL_TEXTURE_2D, 0); + *mailbox = TextureMailbox(std::string(64, '1')); *release_callback = SingleReleaseCallback::Create( base::Bind(&TextureLayerNoExtraCommitForMailboxTest::MailboxReleased, base::Unretained(this))); return true; } - void MailboxReleased(uint32 sync_point, bool lost_resource) { + void MailboxReleased(unsigned sync_point, bool lost_resource) { EXPECT_EQ(2, layer_tree_host()->source_frame_number()); EndTest(); } @@ -1833,11 +1821,10 @@ class TextureLayerChangeInvisibleMailboxTest } TextureMailbox MakeMailbox(char name) { - return TextureMailbox( - MailboxFromString(std::string(64, name)), GL_TEXTURE_2D, 0); + return TextureMailbox(std::string(64, name)); } - void MailboxReleased(uint32 sync_point, bool lost_resource) { + void MailboxReleased(unsigned sync_point, bool lost_resource) { ++mailbox_returned_; } @@ -2028,7 +2015,7 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F(TextureLayerLostContextTest); class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { public: - void ReleaseCallback(uint32 sync_point, bool lost_resource) { + void ReleaseCallback(unsigned sync_point, bool lost_resource) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); EXPECT_FALSE(lost_resource); ++callback_count_; @@ -2037,14 +2024,12 @@ class TextureLayerWithMailboxMainThreadDeleted : public LayerTreeTest { void SetMailbox(char mailbox_char) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerWithMailboxMainThreadDeleted::ReleaseCallback, base::Unretained(this))); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void SetupTree() OVERRIDE { @@ -2102,7 +2087,7 @@ SINGLE_AND_MULTI_THREAD_DIRECT_RENDERER_TEST_F( class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { public: - void ReleaseCallback(uint32 sync_point, bool lost_resource) { + void ReleaseCallback(unsigned sync_point, bool lost_resource) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); EXPECT_FALSE(lost_resource); ++callback_count_; @@ -2111,14 +2096,12 @@ class TextureLayerWithMailboxImplThreadDeleted : public LayerTreeTest { void SetMailbox(char mailbox_char) { EXPECT_EQ(true, main_thread_.CalledOnValidThread()); + TextureMailbox mailbox(std::string(64, mailbox_char)); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind( &TextureLayerWithMailboxImplThreadDeleted::ReleaseCallback, base::Unretained(this))); - layer_->SetTextureMailbox( - TextureMailbox( - MailboxFromString(std::string(64, mailbox_char)), GL_TEXTURE_2D, 0), - callback.Pass()); + layer_->SetTextureMailbox(mailbox, callback.Pass()); } virtual void SetupTree() OVERRIDE { diff --git a/cc/output/gl_renderer.cc b/cc/output/gl_renderer.cc index cef3bdb..028c409 100644 --- a/cc/output/gl_renderer.cc +++ b/cc/output/gl_renderer.cc @@ -2213,7 +2213,7 @@ void GLRenderer::GetFramebufferPixelsAsync( return; } } else { - mailbox = request->texture_mailbox().mailbox(); + mailbox = request->texture_mailbox().name(); DCHECK_EQ(static_cast<unsigned>(GL_TEXTURE_2D), request->texture_mailbox().target()); DCHECK(!mailbox.IsZero()); diff --git a/cc/resources/release_callback.h b/cc/resources/release_callback.h index b471381..9433f7f 100644 --- a/cc/resources/release_callback.h +++ b/cc/resources/release_callback.h @@ -9,7 +9,8 @@ namespace cc { -typedef base::Callback<void(uint32 sync_point, bool is_lost)> ReleaseCallback; +typedef base::Callback<void(unsigned sync_point, bool is_lost)> + ReleaseCallback; } // namespace cc diff --git a/cc/resources/resource_provider.cc b/cc/resources/resource_provider.cc index a86a1d7..4579126 100644 --- a/cc/resources/resource_provider.cc +++ b/cc/resources/resource_provider.cc @@ -544,7 +544,7 @@ void ResourceProvider::DeleteResourceInternal(ResourceMap::iterator it, GLC(gl, gl->DeleteBuffers(1, &resource->gl_pixel_buffer_id)); } if (resource->mailbox.IsValid() && resource->external) { - uint32 sync_point = resource->mailbox.sync_point(); + GLuint sync_point = resource->mailbox.sync_point(); if (resource->mailbox.IsTexture()) { lost_resource |= lost_output_surface_; GLES2Interface* gl = ContextGL(); @@ -739,13 +739,13 @@ const ResourceProvider::Resource* ResourceProvider::LockForRead(ResourceId id) { DCHECK(gl); if (resource->mailbox.sync_point()) { GLC(gl, gl->WaitSyncPointCHROMIUM(resource->mailbox.sync_point())); - resource->mailbox.set_sync_point(0); + resource->mailbox.ResetSyncPoint(); } resource->gl_id = texture_id_allocator_->NextId(); GLC(gl, gl->BindTexture(resource->target, resource->gl_id)); GLC(gl, gl->ConsumeTextureCHROMIUM(resource->target, - resource->mailbox.name())); + resource->mailbox.data())); } } @@ -1021,7 +1021,7 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources, ++it) { TransferableResource resource; TransferResource(gl, *it, &resource); - if (!resource.mailbox_holder.sync_point && !resource.is_software) + if (!resource.sync_point && !resource.is_software) need_sync_point = true; ++resources_.find(*it)->second.exported_count; list->push_back(resource); @@ -1031,8 +1031,8 @@ void ResourceProvider::PrepareSendToParent(const ResourceIdArray& resources, for (TransferableResourceArray::iterator it = list->begin(); it != list->end(); ++it) { - if (!it->mailbox_holder.sync_point) - it->mailbox_holder.sync_point = sync_point; + if (!it->sync_point) + it->sync_point = sync_point; } } } @@ -1056,10 +1056,9 @@ void ResourceProvider::ReceiveFromChild( scoped_ptr<SharedBitmap> bitmap; uint8_t* pixels = NULL; if (it->is_software) { - if (shared_bitmap_manager_) { - bitmap = shared_bitmap_manager_->GetSharedBitmapFromId( - it->size, it->mailbox_holder.mailbox); - } + if (shared_bitmap_manager_) + bitmap = shared_bitmap_manager_->GetSharedBitmapFromId(it->size, + it->mailbox); if (bitmap) pixels = bitmap->pixels(); } @@ -1085,23 +1084,20 @@ void ResourceProvider::ReceiveFromChild( // waiting asynchronously, and resetting sync_point before calling this. // However if the parent is a renderer (e.g. browser tag), it may be ok // (and is simpler) to wait. - if (it->mailbox_holder.sync_point) - GLC(gl, gl->WaitSyncPointCHROMIUM(it->mailbox_holder.sync_point)); + if (it->sync_point) + GLC(gl, gl->WaitSyncPointCHROMIUM(it->sync_point)); texture_id = texture_id_allocator_->NextId(); - GLC(gl, gl->BindTexture(it->mailbox_holder.texture_target, texture_id)); - GLC(gl, - gl->ConsumeTextureCHROMIUM(it->mailbox_holder.texture_target, - it->mailbox_holder.mailbox.name)); + GLC(gl, gl->BindTexture(it->target, texture_id)); + GLC(gl, gl->ConsumeTextureCHROMIUM(it->target, it->mailbox.name)); resource = Resource(texture_id, it->size, - it->mailbox_holder.texture_target, + it->target, it->filter, 0, GL_CLAMP_TO_EDGE, TextureUsageAny, it->format); - resource.mailbox = TextureMailbox( - it->mailbox_holder.mailbox, it->mailbox_holder.texture_target, 0); + resource.mailbox.SetName(it->mailbox); } resource.child_id = child; // Don't allocate a texture for a child. @@ -1207,7 +1203,8 @@ void ResourceProvider::ReceiveReturnsFromParent( if (returned.sync_point) GLC(gl, gl->WaitSyncPointCHROMIUM(returned.sync_point)); } else if (!resource->shared_bitmap) { - resource->mailbox.set_sync_point(returned.sync_point); + resource->mailbox = + TextureMailbox(resource->mailbox.name(), returned.sync_point); } if (!resource->marked_for_deletion) @@ -1255,45 +1252,39 @@ void ResourceProvider::TransferResource(GLES2Interface* gl, DCHECK_EQ(source->wrap_mode, GL_CLAMP_TO_EDGE); resource->id = id; resource->format = source->format; - resource->mailbox_holder.texture_target = source->target; + resource->target = source->target; resource->filter = source->filter; resource->size = source->size; if (source->shared_bitmap) { - resource->mailbox_holder.mailbox = source->shared_bitmap->id(); + resource->mailbox = source->shared_bitmap->id(); resource->is_software = true; } else if (!source->mailbox.IsValid()) { LazyCreate(source); DCHECK(source->gl_id); - GLC(gl, - gl->BindTexture(resource->mailbox_holder.texture_target, - source->gl_id)); + GLC(gl, gl->BindTexture(resource->target, source->gl_id)); if (source->image_id) { DCHECK(source->dirty_image); BindImageForSampling(source); } // This is a resource allocated by the compositor, we need to produce it. // Don't set a sync point, the caller will do it. - GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox_holder.mailbox.name)); + GLC(gl, gl->GenMailboxCHROMIUM(resource->mailbox.name)); GLC(gl, - gl->ProduceTextureCHROMIUM(resource->mailbox_holder.texture_target, - resource->mailbox_holder.mailbox.name)); - source->mailbox = TextureMailbox(resource->mailbox_holder); + gl->ProduceTextureCHROMIUM(resource->target, resource->mailbox.name)); + source->mailbox.SetName(resource->mailbox); } else { DCHECK(source->mailbox.IsTexture()); if (source->image_id && source->dirty_image) { DCHECK(source->gl_id); - GLC(gl, - gl->BindTexture(resource->mailbox_holder.texture_target, - source->gl_id)); + GLC(gl, gl->BindTexture(resource->target, source->gl_id)); BindImageForSampling(source); } // This is either an external resource, or a compositor resource that we // already exported. Make sure to forward the sync point that we were given. - resource->mailbox_holder.mailbox = source->mailbox.mailbox(); - resource->mailbox_holder.texture_target = source->mailbox.target(); - resource->mailbox_holder.sync_point = source->mailbox.sync_point(); - source->mailbox.set_sync_point(0); + resource->mailbox = source->mailbox.name(); + resource->sync_point = source->mailbox.sync_point(); + source->mailbox.ResetSyncPoint(); } } diff --git a/cc/resources/resource_provider_unittest.cc b/cc/resources/resource_provider_unittest.cc index c97ee4e..52de843 100644 --- a/cc/resources/resource_provider_unittest.cc +++ b/cc/resources/resource_provider_unittest.cc @@ -37,15 +37,15 @@ using testing::_; namespace cc { namespace { -static void EmptyReleaseCallback(uint32 sync_point, bool lost_resource) {} +static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {} static void SharedMemoryReleaseCallback(scoped_ptr<base::SharedMemory> memory, - uint32 sync_point, + unsigned sync_point, bool lost_resource) {} -static void ReleaseTextureMailbox(uint32* release_sync_point, +static void ReleaseTextureMailbox(unsigned* release_sync_point, bool* release_lost_resource, - uint32 sync_point, + unsigned sync_point, bool lost_resource) { *release_sync_point = sync_point; *release_lost_resource = lost_resource; @@ -54,9 +54,9 @@ static void ReleaseTextureMailbox(uint32* release_sync_point, static void ReleaseSharedMemoryCallback( scoped_ptr<base::SharedMemory> shared_memory, bool* release_called, - uint32* release_sync_point, + unsigned* release_sync_point, bool* lost_resource_result, - uint32 sync_point, + unsigned sync_point, bool lost_resource) { *release_called = true; *release_sync_point = sync_point; @@ -78,8 +78,8 @@ class TextureStateTrackingContext : public TestWebGraphicsContext3D { public: MOCK_METHOD2(bindTexture, void(GLenum target, GLuint texture)); MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); - MOCK_METHOD1(waitSyncPoint, void(GLuint sync_point)); - MOCK_METHOD0(insertSyncPoint, GLuint(void)); + MOCK_METHOD1(waitSyncPoint, void(unsigned sync_point)); + MOCK_METHOD0(insertSyncPoint, unsigned(void)); MOCK_METHOD2(produceTextureCHROMIUM, void(GLenum target, const GLbyte* mailbox)); MOCK_METHOD2(consumeTextureCHROMIUM, @@ -102,7 +102,7 @@ class ContextSharedData { return make_scoped_ptr(new ContextSharedData()); } - uint32 InsertSyncPoint() { return next_sync_point_++; } + unsigned InsertSyncPoint() { return next_sync_point_++; } void GenMailbox(GLbyte* mailbox) { memset(mailbox, 0, sizeof(GLbyte[64])); @@ -111,7 +111,7 @@ class ContextSharedData { } void ProduceTexture(const GLbyte* mailbox_name, - uint32 sync_point, + unsigned sync_point, scoped_refptr<TestTexture> texture) { unsigned mailbox = 0; memcpy(&mailbox, mailbox_name, sizeof(mailbox)); @@ -122,7 +122,7 @@ class ContextSharedData { } scoped_refptr<TestTexture> ConsumeTexture(const GLbyte* mailbox_name, - uint32 sync_point) { + unsigned sync_point) { unsigned mailbox = 0; memcpy(&mailbox, mailbox_name, sizeof(mailbox)); DCHECK(mailbox && mailbox < next_mailbox_); @@ -140,11 +140,11 @@ class ContextSharedData { private: ContextSharedData() : next_sync_point_(1), next_mailbox_(1) {} - uint32 next_sync_point_; + unsigned next_sync_point_; unsigned next_mailbox_; typedef base::hash_map<unsigned, scoped_refptr<TestTexture> > TextureMap; TextureMap textures_; - base::hash_map<unsigned, uint32> sync_point_for_mailbox_; + base::hash_map<unsigned, unsigned> sync_point_for_mailbox_; }; class ResourceProviderContext : public TestWebGraphicsContext3D { @@ -154,8 +154,8 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { return make_scoped_ptr(new ResourceProviderContext(shared_data)); } - virtual GLuint insertSyncPoint() OVERRIDE { - uint32 sync_point = shared_data_->InsertSyncPoint(); + virtual unsigned insertSyncPoint() OVERRIDE { + unsigned sync_point = shared_data_->InsertSyncPoint(); // Commit the produceTextureCHROMIUM calls at this point, so that // they're associated with the sync point. for (PendingProduceTextureList::iterator it = @@ -169,7 +169,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { return sync_point; } - virtual void waitSyncPoint(GLuint sync_point) OVERRIDE { + virtual void waitSyncPoint(unsigned sync_point) OVERRIDE { last_waited_sync_point_ = std::max(sync_point, last_waited_sync_point_); } @@ -323,7 +323,7 @@ class ResourceProviderContext : public TestWebGraphicsContext3D { }; typedef ScopedPtrDeque<PendingProduceTexture> PendingProduceTextureList; ContextSharedData* shared_data_; - GLuint last_waited_sync_point_; + unsigned last_waited_sync_point_; PendingProduceTextureList pending_produce_textures_; }; @@ -473,10 +473,10 @@ class ResourceProviderTest ResourceProviderContext* context() { return context3d_; } - ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point, + ResourceProvider::ResourceId CreateChildMailbox(unsigned* release_sync_point, bool* lost_resource, bool* release_called, - uint32* sync_point) { + unsigned* sync_point) { if (GetParam() == ResourceProvider::GLTexture) { unsigned texture = child_context_->createTexture(); gpu::Mailbox gpu_mailbox; @@ -494,8 +494,7 @@ class ResourceProviderTest release_sync_point, lost_resource)); return child_resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), - callback.Pass()); + TextureMailbox(gpu_mailbox, *sync_point), callback.Pass()); } else { gfx::Size size(64, 64); scoped_ptr<base::SharedMemory> shared_memory( @@ -661,7 +660,7 @@ TEST_P(ResourceProviderTest, TransferGLResources) { child_context_->genMailboxCHROMIUM(external_mailbox.name); child_context_->produceTextureCHROMIUM(GL_TEXTURE_EXTERNAL_OES, external_mailbox.name); - const GLuint external_sync_point = child_context_->insertSyncPoint(); + const unsigned external_sync_point = child_context_->insertSyncPoint(); ResourceProvider::ResourceId id4 = child_resource_provider_->CreateResourceFromTextureMailbox( TextureMailbox( @@ -682,18 +681,14 @@ TEST_P(ResourceProviderTest, TransferGLResources) { child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); ASSERT_EQ(4u, list.size()); - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_NE(0u, list[1].mailbox_holder.sync_point); - EXPECT_NE(0u, list[2].mailbox_holder.sync_point); - EXPECT_EQ(external_sync_point, list[3].mailbox_holder.sync_point); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[0].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[1].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[2].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), - list[3].mailbox_holder.texture_target); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_NE(0u, list[1].sync_point); + EXPECT_NE(0u, list[2].sync_point); + EXPECT_EQ(external_sync_point, list[3].sync_point); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[0].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[1].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[2].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), list[3].target); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id2)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id3)); @@ -742,12 +737,9 @@ TEST_P(ResourceProviderTest, TransferGLResources) { EXPECT_EQ(id1, list[0].id); EXPECT_EQ(id2, list[1].id); EXPECT_EQ(id3, list[2].id); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[0].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[1].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[2].mailbox_holder.texture_target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[0].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[1].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[2].target); ReturnedResourceArray returned; TransferableResource::ReturnResources(list, &returned); child_resource_provider_->ReceiveReturnsFromParent(returned); @@ -819,18 +811,14 @@ TEST_P(ResourceProviderTest, TransferGLResources) { EXPECT_EQ(id2, list[1].id); EXPECT_EQ(id3, list[2].id); EXPECT_EQ(id4, list[3].id); - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_NE(0u, list[1].mailbox_holder.sync_point); - EXPECT_NE(0u, list[2].mailbox_holder.sync_point); - EXPECT_NE(0u, list[3].mailbox_holder.sync_point); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[0].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[1].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[2].mailbox_holder.texture_target); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), - list[3].mailbox_holder.texture_target); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_NE(0u, list[1].sync_point); + EXPECT_NE(0u, list[2].sync_point); + EXPECT_NE(0u, list[3].sync_point); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[0].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[1].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[2].target); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), list[3].target); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id2)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id3)); @@ -908,10 +896,10 @@ TEST_P(ResourceProviderTest, TransferSoftwareResources) { child_resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); ASSERT_EQ(4u, list.size()); - EXPECT_EQ(0u, list[0].mailbox_holder.sync_point); - EXPECT_EQ(0u, list[1].mailbox_holder.sync_point); - EXPECT_EQ(0u, list[2].mailbox_holder.sync_point); - EXPECT_EQ(0u, list[3].mailbox_holder.sync_point); + EXPECT_EQ(0u, list[0].sync_point); + EXPECT_EQ(0u, list[1].sync_point); + EXPECT_EQ(0u, list[2].sync_point); + EXPECT_EQ(0u, list[3].sync_point); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id2)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id3)); @@ -1169,9 +1157,8 @@ TEST_P(ResourceProviderTest, TransferGLToSoftware) { child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, &list); ASSERT_EQ(1u, list.size()); - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), - list[0].mailbox_holder.texture_target); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_2D), list[0].target); EXPECT_TRUE(child_resource_provider->InUseByConsumer(id1)); resource_provider_->ReceiveFromChild(child_id, list); } @@ -1217,7 +1204,7 @@ TEST_P(ResourceProviderTest, TransferInvalidSoftware) { &list); ASSERT_EQ(1u, list.size()); // Make invalid. - list[0].mailbox_holder.mailbox.name[1] = 5; + list[0].mailbox.name[1] = 5; EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id1)); resource_provider_->ReceiveFromChild(child_id, list); } @@ -1267,8 +1254,8 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) { &list); ASSERT_EQ(2u, list.size()); if (GetParam() == ResourceProvider::GLTexture) { - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_NE(0u, list[1].mailbox_holder.sync_point); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_NE(0u, list[1].sync_point); } EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id2)); @@ -1297,8 +1284,8 @@ TEST_P(ResourceProviderTest, DeleteExportedResources) { ASSERT_EQ(2u, list.size()); if (GetParam() == ResourceProvider::GLTexture) { - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_NE(0u, list[1].mailbox_holder.sync_point); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_NE(0u, list[1].sync_point); } EXPECT_TRUE(resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(resource_provider_->InUseByConsumer(id2)); @@ -1361,8 +1348,8 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) { &list); ASSERT_EQ(2u, list.size()); if (GetParam() == ResourceProvider::GLTexture) { - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_NE(0u, list[1].mailbox_holder.sync_point); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_NE(0u, list[1].sync_point); } EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id2)); @@ -1391,8 +1378,8 @@ TEST_P(ResourceProviderTest, DestroyChildWithExportedResources) { ASSERT_EQ(2u, list.size()); if (GetParam() == ResourceProvider::GLTexture) { - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); - EXPECT_NE(0u, list[1].mailbox_holder.sync_point); + EXPECT_NE(0u, list[0].sync_point); + EXPECT_NE(0u, list[1].sync_point); } EXPECT_TRUE(resource_provider_->InUseByConsumer(id1)); EXPECT_TRUE(resource_provider_->InUseByConsumer(id2)); @@ -1466,7 +1453,7 @@ TEST_P(ResourceProviderTest, DeleteTransferredResources) { &list); ASSERT_EQ(1u, list.size()); if (GetParam() == ResourceProvider::GLTexture) - EXPECT_NE(0u, list[0].mailbox_holder.sync_point); + EXPECT_NE(0u, list[0].sync_point); EXPECT_TRUE(child_resource_provider_->InUseByConsumer(id)); resource_provider_->ReceiveFromChild(child_id, list); resource_provider_->DeclareUsedResourcesFromChild(child_id, @@ -1680,18 +1667,18 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { gpu::Mailbox mailbox; context()->genMailboxCHROMIUM(mailbox.name); context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); - uint32 sync_point = context()->insertSyncPoint(); + unsigned sync_point = context()->insertSyncPoint(); // All the logic below assumes that the sync points are all positive. EXPECT_LT(0u, sync_point); - uint32 release_sync_point = 0; + unsigned release_sync_point = 0; bool lost_resource = false; ReleaseCallback callback = base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); ResourceProvider::ResourceId resource = resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), + TextureMailbox(mailbox, sync_point), SingleReleaseCallback::Create(callback)); EXPECT_EQ(1u, context()->NumTextures()); EXPECT_EQ(0u, release_sync_point); @@ -1702,14 +1689,12 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { TransferableResourceArray list; resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); ASSERT_EQ(1u, list.size()); - EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); + EXPECT_LE(sync_point, list[0].sync_point); EXPECT_EQ(0, - memcmp(mailbox.name, - list[0].mailbox_holder.mailbox.name, - sizeof(mailbox.name))); + memcmp(mailbox.name, list[0].mailbox.name, sizeof(mailbox.name))); EXPECT_EQ(0u, release_sync_point); - context()->waitSyncPoint(list[0].mailbox_holder.sync_point); + context()->waitSyncPoint(list[0].sync_point); unsigned other_texture = context()->createTexture(); context()->bindTexture(GL_TEXTURE_2D, other_texture); context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); @@ -1719,8 +1704,8 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); context()->deleteTexture(other_texture); - list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); - EXPECT_LT(0u, list[0].mailbox_holder.sync_point); + list[0].sync_point = context()->insertSyncPoint(); + EXPECT_LT(0u, list[0].sync_point); // Receive the resource, then delete it, expect the sync points to be // consistent. @@ -1731,7 +1716,7 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { EXPECT_EQ(0u, release_sync_point); resource_provider_->DeleteResource(resource); - EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); + EXPECT_LE(list[0].sync_point, release_sync_point); EXPECT_FALSE(lost_resource); } @@ -1741,7 +1726,7 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { EXPECT_LT(0u, sync_point); release_sync_point = 0; resource = resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), + TextureMailbox(mailbox, sync_point), SingleReleaseCallback::Create(callback)); EXPECT_EQ(1u, context()->NumTextures()); EXPECT_EQ(0u, release_sync_point); @@ -1752,14 +1737,12 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { TransferableResourceArray list; resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); ASSERT_EQ(1u, list.size()); - EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); + EXPECT_LE(sync_point, list[0].sync_point); EXPECT_EQ(0, - memcmp(mailbox.name, - list[0].mailbox_holder.mailbox.name, - sizeof(mailbox.name))); + memcmp(mailbox.name, list[0].mailbox.name, sizeof(mailbox.name))); EXPECT_EQ(0u, release_sync_point); - context()->waitSyncPoint(list[0].mailbox_holder.sync_point); + context()->waitSyncPoint(list[0].sync_point); unsigned other_texture = context()->createTexture(); context()->bindTexture(GL_TEXTURE_2D, other_texture); context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); @@ -1769,8 +1752,8 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); context()->deleteTexture(other_texture); - list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); - EXPECT_LT(0u, list[0].mailbox_holder.sync_point); + list[0].sync_point = context()->insertSyncPoint(); + EXPECT_LT(0u, list[0].sync_point); // Delete the resource, which shouldn't do anything. resource_provider_->DeleteResource(resource); @@ -1782,7 +1765,7 @@ TEST_P(ResourceProviderTest, TransferMailboxResources) { ReturnedResourceArray returned; TransferableResource::ReturnResources(list, &returned); resource_provider_->ReceiveReturnsFromParent(returned); - EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); + EXPECT_LE(list[0].sync_point, release_sync_point); EXPECT_FALSE(lost_resource); } @@ -1922,10 +1905,10 @@ TEST_P(ResourceProviderTest, LostResourceInGrandParent) { } TEST_P(ResourceProviderTest, LostMailboxInParent) { - uint32 release_sync_point = 0; + unsigned release_sync_point = 0; bool lost_resource = false; bool release_called = false; - uint32 sync_point = 0; + unsigned sync_point = 0; ResourceProvider::ResourceId resource = CreateChildMailbox( &release_sync_point, &lost_resource, &release_called, &sync_point); @@ -1972,10 +1955,10 @@ TEST_P(ResourceProviderTest, LostMailboxInParent) { } TEST_P(ResourceProviderTest, LostMailboxInGrandParent) { - uint32 release_sync_point = 0; + unsigned release_sync_point = 0; bool lost_resource = false; bool release_called = false; - uint32 sync_point = 0; + unsigned sync_point = 0; ResourceProvider::ResourceId resource = CreateChildMailbox( &release_sync_point, &lost_resource, &release_called, &sync_point); @@ -2040,10 +2023,10 @@ TEST_P(ResourceProviderTest, LostMailboxInGrandParent) { } TEST_P(ResourceProviderTest, Shutdown) { - uint32 release_sync_point = 0; + unsigned release_sync_point = 0; bool lost_resource = false; bool release_called = false; - uint32 sync_point = 0; + unsigned sync_point = 0; CreateChildMailbox( &release_sync_point, &lost_resource, &release_called, &sync_point); @@ -2060,10 +2043,10 @@ TEST_P(ResourceProviderTest, Shutdown) { } TEST_P(ResourceProviderTest, ShutdownWithExportedResource) { - uint32 release_sync_point = 0; + unsigned release_sync_point = 0; bool lost_resource = false; bool release_called = false; - uint32 sync_point = 0; + unsigned sync_point = 0; ResourceProvider::ResourceId resource = CreateChildMailbox( &release_sync_point, &lost_resource, &release_called, &sync_point); @@ -2093,16 +2076,17 @@ TEST_P(ResourceProviderTest, LostContext) { gpu::Mailbox mailbox; context()->genMailboxCHROMIUM(mailbox.name); context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); - uint32 sync_point = context()->insertSyncPoint(); + unsigned sync_point = context()->insertSyncPoint(); EXPECT_LT(0u, sync_point); - uint32 release_sync_point = 0; + unsigned release_sync_point = 0; bool lost_resource = false; scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource)); resource_provider_->CreateResourceFromTextureMailbox( - TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass()); + TextureMailbox(mailbox, sync_point), + callback.Pass()); EXPECT_EQ(0u, release_sync_point); EXPECT_FALSE(lost_resource); @@ -2351,7 +2335,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) { ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1)); unsigned texture_id = 1; - uint32 sync_point = 30; + unsigned sync_point = 30; unsigned target = GL_TEXTURE_2D; EXPECT_CALL(*context, bindTexture(_, _)).Times(0); @@ -2365,7 +2349,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D) { scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind(&EmptyReleaseCallback)); - TextureMailbox mailbox(gpu_mailbox, target, sync_point); + TextureMailbox mailbox(gpu_mailbox, sync_point); ResourceProvider::ResourceId id = resource_provider->CreateResourceFromTextureMailbox( @@ -2415,7 +2399,7 @@ TEST_P(ResourceProviderTest, TextureMailbox_GLTextureExternalOES) { ResourceProvider::Create(output_surface.get(), NULL, 0, false, 1)); unsigned texture_id = 1; - uint32 sync_point = 30; + unsigned sync_point = 30; unsigned target = GL_TEXTURE_EXTERNAL_OES; EXPECT_CALL(*context, bindTexture(_, _)).Times(0); diff --git a/cc/resources/single_release_callback.cc b/cc/resources/single_release_callback.cc index 4565963..9c6b9de 100644 --- a/cc/resources/single_release_callback.cc +++ b/cc/resources/single_release_callback.cc @@ -20,7 +20,7 @@ SingleReleaseCallback::~SingleReleaseCallback() { << "SingleReleaseCallback was never run."; } -void SingleReleaseCallback::Run(uint32 sync_point, bool is_lost) { +void SingleReleaseCallback::Run(unsigned sync_point, bool is_lost) { DCHECK(!has_been_run_) << "SingleReleaseCallback was run more than once."; has_been_run_ = true; callback_.Run(sync_point, is_lost); diff --git a/cc/resources/single_release_callback.h b/cc/resources/single_release_callback.h index 6f64df6..fe1a3ba 100644 --- a/cc/resources/single_release_callback.h +++ b/cc/resources/single_release_callback.h @@ -19,7 +19,7 @@ class CC_EXPORT SingleReleaseCallback { ~SingleReleaseCallback(); - void Run(uint32 sync_point, bool is_lost); + void Run(unsigned sync_point, bool is_lost); private: explicit SingleReleaseCallback(const ReleaseCallback& callback); diff --git a/cc/resources/texture_mailbox.cc b/cc/resources/texture_mailbox.cc index 198d473..149d56c 100644 --- a/cc/resources/texture_mailbox.cc +++ b/cc/resources/texture_mailbox.cc @@ -9,36 +9,78 @@ namespace cc { -TextureMailbox::TextureMailbox() : shared_memory_(NULL) {} +TextureMailbox::TextureMailbox() + : target_(GL_TEXTURE_2D), + sync_point_(0), + shared_memory_(NULL) { +} + +TextureMailbox::TextureMailbox(const std::string& mailbox_name) + : target_(GL_TEXTURE_2D), + sync_point_(0), + shared_memory_(NULL) { + if (!mailbox_name.empty()) { + CHECK(mailbox_name.size() == sizeof(name_.name)); + name_.SetName(reinterpret_cast<const int8*>(mailbox_name.data())); + } +} -TextureMailbox::TextureMailbox(const gpu::MailboxHolder& mailbox_holder) - : mailbox_holder_(mailbox_holder), shared_memory_(NULL) {} +TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox_name) + : target_(GL_TEXTURE_2D), + sync_point_(0), + shared_memory_(NULL) { + name_.SetName(mailbox_name.name); +} + +TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox_name, + unsigned sync_point) + : target_(GL_TEXTURE_2D), + sync_point_(sync_point), + shared_memory_(NULL) { + name_.SetName(mailbox_name.name); +} -TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox, - uint32 target, - uint32 sync_point) - : mailbox_holder_(mailbox, target, sync_point), shared_memory_(NULL) {} +TextureMailbox::TextureMailbox(const gpu::Mailbox& mailbox_name, + unsigned texture_target, + unsigned sync_point) + : target_(texture_target), + sync_point_(sync_point), + shared_memory_(NULL) { + name_.SetName(mailbox_name.name); +} TextureMailbox::TextureMailbox(base::SharedMemory* shared_memory, gfx::Size size) - : shared_memory_(shared_memory), shared_memory_size_(size) {} + : target_(GL_TEXTURE_2D), + sync_point_(0), + shared_memory_(shared_memory), + shared_memory_size_(size) {} TextureMailbox::~TextureMailbox() {} bool TextureMailbox::Equals(const TextureMailbox& other) const { - if (other.IsTexture()) { - return IsTexture() && !memcmp(mailbox_holder_.mailbox.name, - other.mailbox_holder_.mailbox.name, - sizeof(mailbox_holder_.mailbox.name)); - } else if (other.IsSharedMemory()) { - return IsSharedMemory() && - shared_memory_->handle() == other.shared_memory_->handle(); - } + if (other.IsTexture()) + return ContainsMailbox(other.name()); + else if (other.IsSharedMemory()) + return ContainsHandle(other.shared_memory_->handle()); DCHECK(!other.IsValid()); return !IsValid(); } +bool TextureMailbox::ContainsMailbox(const gpu::Mailbox& other) const { + return IsTexture() && !memcmp(data(), other.name, sizeof(name_.name)); +} + +bool TextureMailbox::ContainsHandle(base::SharedMemoryHandle handle) const { + return shared_memory_ && shared_memory_->handle() == handle; +} + +void TextureMailbox::SetName(const gpu::Mailbox& name) { + DCHECK(shared_memory_ == NULL); + name_ = name; +} + size_t TextureMailbox::shared_memory_size_in_bytes() const { return 4 * shared_memory_size_.GetArea(); } diff --git a/cc/resources/texture_mailbox.h b/cc/resources/texture_mailbox.h index 1a81a75..a9b021b 100644 --- a/cc/resources/texture_mailbox.h +++ b/cc/resources/texture_mailbox.h @@ -10,7 +10,7 @@ #include "base/callback.h" #include "base/memory/shared_memory.h" #include "cc/base/cc_export.h" -#include "gpu/command_buffer/common/mailbox_holder.h" +#include "gpu/command_buffer/common/mailbox.h" #include "ui/gfx/size.h" namespace cc { @@ -20,32 +20,44 @@ namespace cc { class CC_EXPORT TextureMailbox { public: TextureMailbox(); - explicit TextureMailbox(const gpu::MailboxHolder& mailbox_holder); - TextureMailbox(const gpu::Mailbox& mailbox, uint32 target, uint32 sync_point); - TextureMailbox(base::SharedMemory* shared_memory, gfx::Size size); + explicit TextureMailbox(const std::string& mailbox_name); + explicit TextureMailbox(const gpu::Mailbox& mailbox_name); + TextureMailbox(const gpu::Mailbox& mailbox_name, + unsigned sync_point); + TextureMailbox(const gpu::Mailbox& mailbox_name, + unsigned texture_target, + unsigned sync_point); + TextureMailbox(base::SharedMemory* shared_memory, + gfx::Size size); ~TextureMailbox(); bool IsValid() const { return IsTexture() || IsSharedMemory(); } - bool IsTexture() const { return !mailbox_holder_.mailbox.IsZero(); } + bool IsTexture() const { return !name_.IsZero(); } bool IsSharedMemory() const { return shared_memory_ != NULL; } bool Equals(const TextureMailbox&) const; + bool ContainsMailbox(const gpu::Mailbox&) const; + bool ContainsHandle(base::SharedMemoryHandle handle) const; - const gpu::Mailbox& mailbox() const { return mailbox_holder_.mailbox; } - const int8* name() const { return mailbox().name; } - uint32 target() const { return mailbox_holder_.texture_target; } - uint32 sync_point() const { return mailbox_holder_.sync_point; } - void set_sync_point(int32 sync_point) { - mailbox_holder_.sync_point = sync_point; - } + const int8* data() const { return name_.name; } + const gpu::Mailbox& name() const { return name_; } + void ResetSyncPoint() { sync_point_ = 0; } + unsigned target() const { return target_; } + unsigned sync_point() const { return sync_point_; } base::SharedMemory* shared_memory() const { return shared_memory_; } gfx::Size shared_memory_size() const { return shared_memory_size_; } size_t shared_memory_size_in_bytes() const; + // TODO(danakj): ReleaseCallback should be separate from this class, and stop + // storing a TextureMailbox in ResourceProvider. Then we can remove this. + void SetName(const gpu::Mailbox& name); + private: - gpu::MailboxHolder mailbox_holder_; + gpu::Mailbox name_; + unsigned target_; + unsigned sync_point_; base::SharedMemory* shared_memory_; gfx::Size shared_memory_size_; }; diff --git a/cc/resources/texture_mailbox_deleter.cc b/cc/resources/texture_mailbox_deleter.cc index 542b95e..cf7b3b61 100644 --- a/cc/resources/texture_mailbox_deleter.cc +++ b/cc/resources/texture_mailbox_deleter.cc @@ -17,7 +17,7 @@ namespace cc { static void DeleteTextureOnImplThread( const scoped_refptr<ContextProvider>& context_provider, unsigned texture_id, - uint32 sync_point, + unsigned sync_point, bool is_lost) { if (sync_point) context_provider->ContextGL()->WaitSyncPointCHROMIUM(sync_point); diff --git a/cc/resources/texture_mailbox_deleter.h b/cc/resources/texture_mailbox_deleter.h index add1549..9b6d771 100644 --- a/cc/resources/texture_mailbox_deleter.h +++ b/cc/resources/texture_mailbox_deleter.h @@ -32,9 +32,10 @@ class CC_EXPORT TextureMailboxDeleter { private: // Runs the |impl_callback| to delete the texture and removes the callback // from the |impl_callbacks_| list. - void RunDeleteTextureOnImplThread(SingleReleaseCallback* impl_callback, - uint32 sync_point, - bool is_lost); + void RunDeleteTextureOnImplThread( + SingleReleaseCallback* impl_callback, + unsigned sync_point, + bool is_lost); ScopedPtrVector<SingleReleaseCallback> impl_callbacks_; base::WeakPtrFactory<TextureMailboxDeleter> weak_ptr_factory_; diff --git a/cc/resources/transferable_resource.cc b/cc/resources/transferable_resource.cc index e7e9e24..62f1bdb 100644 --- a/cc/resources/transferable_resource.cc +++ b/cc/resources/transferable_resource.cc @@ -10,7 +10,9 @@ namespace cc { TransferableResource::TransferableResource() : id(0), + sync_point(0), format(RGBA_8888), + target(0), filter(0), is_software(false) {} @@ -20,7 +22,7 @@ TransferableResource::~TransferableResource() { ReturnedResource TransferableResource::ToReturnedResource() const { ReturnedResource returned; returned.id = id; - returned.sync_point = mailbox_holder.sync_point; + returned.sync_point = sync_point; returned.count = 1; return returned; } diff --git a/cc/resources/transferable_resource.h b/cc/resources/transferable_resource.h index 8ca9ffa..5c93d1c 100644 --- a/cc/resources/transferable_resource.h +++ b/cc/resources/transferable_resource.h @@ -10,7 +10,7 @@ #include "base/basictypes.h" #include "cc/base/cc_export.h" #include "cc/resources/resource_format.h" -#include "gpu/command_buffer/common/mailbox_holder.h" +#include "gpu/command_buffer/common/mailbox.h" #include "ui/gfx/size.h" namespace cc { @@ -29,10 +29,12 @@ struct CC_EXPORT TransferableResource { ReturnedResourceArray* output); unsigned id; + unsigned sync_point; ResourceFormat format; + uint32 target; uint32 filter; gfx::Size size; - gpu::MailboxHolder mailbox_holder; + gpu::Mailbox mailbox; bool is_software; }; diff --git a/cc/resources/video_resource_updater.cc b/cc/resources/video_resource_updater.cc index 0c2892d..4abeab1 100644 --- a/cc/resources/video_resource_updater.cc +++ b/cc/resources/video_resource_updater.cc @@ -313,7 +313,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( }; external_resources.mailboxes.push_back( - TextureMailbox(plane_resources[i].mailbox, GL_TEXTURE_2D, 0)); + TextureMailbox(plane_resources[i].mailbox)); external_resources.release_callbacks.push_back( base::Bind(&RecycleResource, AsWeakPtr(), recycle_data)); } @@ -323,9 +323,9 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForSoftwarePlanes( } static void ReturnTexture(const scoped_refptr<media::VideoFrame>& frame, - uint32 sync_point, + unsigned sync_point, bool lost_resource) { - frame->mailbox_holder()->sync_point = sync_point; + frame->texture_mailbox()->Resync(sync_point); } VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( @@ -339,9 +339,8 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( if (!context_provider_) return VideoFrameExternalResources(); - gpu::MailboxHolder* mailbox_holder = video_frame->mailbox_holder(); VideoFrameExternalResources external_resources; - switch (mailbox_holder->texture_target) { + switch (video_frame->texture_target()) { case GL_TEXTURE_2D: external_resources.type = VideoFrameExternalResources::RGB_RESOURCE; break; @@ -357,10 +356,13 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( return VideoFrameExternalResources(); } + media::VideoFrame::MailboxHolder* mailbox_holder = + video_frame->texture_mailbox(); + external_resources.mailboxes.push_back( - TextureMailbox(mailbox_holder->mailbox, - mailbox_holder->texture_target, - mailbox_holder->sync_point)); + TextureMailbox(mailbox_holder->mailbox(), + video_frame->texture_target(), + mailbox_holder->sync_point())); external_resources.release_callbacks.push_back( base::Bind(&ReturnTexture, video_frame)); return external_resources; @@ -370,7 +372,7 @@ VideoFrameExternalResources VideoResourceUpdater::CreateForHardwarePlanes( void VideoResourceUpdater::RecycleResource( base::WeakPtr<VideoResourceUpdater> updater, RecycleResourceData data, - uint32 sync_point, + unsigned sync_point, bool lost_resource) { if (!updater.get()) { // Resource was already deleted. diff --git a/cc/resources/video_resource_updater.h b/cc/resources/video_resource_updater.h index 27a108b..2a27739 100644 --- a/cc/resources/video_resource_updater.h +++ b/cc/resources/video_resource_updater.h @@ -104,7 +104,7 @@ class CC_EXPORT VideoResourceUpdater }; static void RecycleResource(base::WeakPtr<VideoResourceUpdater> updater, RecycleResourceData data, - uint32 sync_point, + unsigned sync_point, bool lost_resource); ContextProvider* context_provider_; diff --git a/cc/test/fake_delegated_renderer_layer_impl.cc b/cc/test/fake_delegated_renderer_layer_impl.cc index 8f4c104..4057736 100644 --- a/cc/test/fake_delegated_renderer_layer_impl.cc +++ b/cc/test/fake_delegated_renderer_layer_impl.cc @@ -30,8 +30,7 @@ static ResourceProvider::ResourceId AddResourceToFrame( ResourceProvider::ResourceId resource_id) { TransferableResource resource; resource.id = resource_id; - resource.mailbox_holder.texture_target = - resource_provider->TargetForTesting(resource_id); + resource.target = resource_provider->TargetForTesting(resource_id); frame->resource_list.push_back(resource); return resource_id; } diff --git a/cc/test/layer_tree_pixel_test.cc b/cc/test/layer_tree_pixel_test.cc index 379808e..806b877 100644 --- a/cc/test/layer_tree_pixel_test.cc +++ b/cc/test/layer_tree_pixel_test.cc @@ -247,7 +247,7 @@ scoped_ptr<SkBitmap> LayerTreePixelTest::CopyTextureMailboxToBitmap( gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); gl->TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - gl->ConsumeTextureCHROMIUM(texture_mailbox.target(), texture_mailbox.name()); + gl->ConsumeTextureCHROMIUM(texture_mailbox.target(), texture_mailbox.data()); gl->BindTexture(GL_TEXTURE_2D, 0); GLuint fbo = 0; @@ -369,7 +369,7 @@ void LayerTreePixelTest::CopyBitmapToTextureMailboxAsTexture( gl->BindTexture(GL_TEXTURE_2D, 0); uint32 sync_point = gl->InsertSyncPointCHROMIUM(); - *texture_mailbox = TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point); + *texture_mailbox = TextureMailbox(mailbox, sync_point); *release_callback = SingleReleaseCallback::Create( base::Bind(&LayerTreePixelTest::ReleaseTextureMailbox, base::Unretained(this), diff --git a/cc/trees/layer_tree_host_perftest.cc b/cc/trees/layer_tree_host_perftest.cc index a02c8f2..1bfe1c4 100644 --- a/cc/trees/layer_tree_host_perftest.cc +++ b/cc/trees/layer_tree_host_perftest.cc @@ -246,7 +246,7 @@ TEST_F(ScrollingLayerTreePerfTest, LongScrollablePageThreadedImplSide) { RunTestWithImplSidePainting(); } -static void EmptyReleaseCallback(uint32 sync_point, bool lost_resource) {} +static void EmptyReleaseCallback(unsigned sync_point, bool lost_resource) {} // Simulates main-thread scrolling on each frame. class BrowserCompositorInvalidateLayerTreePerfTest @@ -274,7 +274,7 @@ class BrowserCompositorInvalidateLayerTreePerfTest reinterpret_cast<const int8*>(name_stream.str().c_str())); scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( base::Bind(&EmptyReleaseCallback)); - TextureMailbox mailbox(gpu_mailbox, GL_TEXTURE_2D, next_sync_point_); + TextureMailbox mailbox(gpu_mailbox, next_sync_point_); next_sync_point_++; tab_contents_->SetTextureMailbox(mailbox, callback.Pass()); diff --git a/cc/trees/layer_tree_host_unittest_context.cc b/cc/trees/layer_tree_host_unittest_context.cc index 2d203c2..5aa37fe 100644 --- a/cc/trees/layer_tree_host_unittest_context.cc +++ b/cc/trees/layer_tree_host_unittest_context.cc @@ -1003,7 +1003,7 @@ class LayerTreeHostContextTestDontUseLostResources texture->SetAnchorPoint(gfx::PointF()); texture->SetIsDrawable(true); texture->SetTextureMailbox( - TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), + TextureMailbox(mailbox, sync_point), SingleReleaseCallback::Create( base::Bind(&LayerTreeHostContextTestDontUseLostResources:: EmptyReleaseCallback))); @@ -1044,24 +1044,30 @@ class LayerTreeHostContextTestDontUseLostResources color_video_frame_ = VideoFrame::CreateColorFrame( gfx::Size(4, 4), 0x80, 0x80, 0x80, base::TimeDelta()); - hw_video_frame_ = - VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( - mailbox, GL_TEXTURE_2D, sync_point)), - media::VideoFrame::ReleaseMailboxCB(), - gfx::Size(4, 4), - gfx::Rect(0, 0, 4, 4), - gfx::Size(4, 4), - base::TimeDelta(), - VideoFrame::ReadPixelsCB()); - scaled_hw_video_frame_ = - VideoFrame::WrapNativeTexture(make_scoped_ptr(new gpu::MailboxHolder( - mailbox, GL_TEXTURE_2D, sync_point)), - media::VideoFrame::ReleaseMailboxCB(), - gfx::Size(4, 4), - gfx::Rect(0, 0, 3, 2), - gfx::Size(4, 4), - base::TimeDelta(), - VideoFrame::ReadPixelsCB()); + hw_video_frame_ = VideoFrame::WrapNativeTexture( + make_scoped_ptr(new VideoFrame::MailboxHolder( + mailbox, + sync_point, + VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), + GL_TEXTURE_2D, + gfx::Size(4, 4), + gfx::Rect(0, 0, 4, 4), + gfx::Size(4, 4), + base::TimeDelta(), + VideoFrame::ReadPixelsCB(), + base::Closure()); + scaled_hw_video_frame_ = VideoFrame::WrapNativeTexture( + make_scoped_ptr(new VideoFrame::MailboxHolder( + mailbox, + sync_point, + VideoFrame::MailboxHolder::TextureNoLongerNeededCallback())), + GL_TEXTURE_2D, + gfx::Size(4, 4), + gfx::Rect(0, 0, 3, 2), + gfx::Size(4, 4), + base::TimeDelta(), + VideoFrame::ReadPixelsCB(), + base::Closure()); color_frame_provider_.set_frame(color_video_frame_); hw_frame_provider_.set_frame(hw_video_frame_); diff --git a/cc/trees/layer_tree_host_unittest_copyrequest.cc b/cc/trees/layer_tree_host_unittest_copyrequest.cc index 23d3347..2156c64 100644 --- a/cc/trees/layer_tree_host_unittest_copyrequest.cc +++ b/cc/trees/layer_tree_host_unittest_copyrequest.cc @@ -807,8 +807,7 @@ class LayerTreeHostCopyRequestTestProvideTexture gpu::Mailbox mailbox; gl->GenMailboxCHROMIUM(mailbox.name); sync_point_ = gl->InsertSyncPointCHROMIUM(); - request->SetTextureMailbox( - TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point_)); + request->SetTextureMailbox(TextureMailbox(mailbox, sync_point_)); EXPECT_TRUE(request->has_texture_mailbox()); copy_layer_->RequestCopyOfOutput(request.Pass()); diff --git a/cc/trees/layer_tree_host_unittest_delegated.cc b/cc/trees/layer_tree_host_unittest_delegated.cc index ee506c6..b5c400c 100644 --- a/cc/trees/layer_tree_host_unittest_delegated.cc +++ b/cc/trees/layer_tree_host_unittest_delegated.cc @@ -135,7 +135,7 @@ class LayerTreeHostDelegatedTest : public LayerTreeTest { ResourceProvider::ResourceId resource_id) { TransferableResource resource; resource.id = resource_id; - resource.mailbox_holder.texture_target = GL_TEXTURE_2D; + resource.target = GL_TEXTURE_2D; frame->resource_list.push_back(resource); } |