OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/resources/resource_provider.h" | 5 #include "cc/resources/resource_provider.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 | 10 |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 std::fill_n(pixels, size.GetArea(), value); | 90 std::fill_n(pixels, size.GetArea(), value); |
91 return shared_bitmap.Pass(); | 91 return shared_bitmap.Pass(); |
92 } | 92 } |
93 | 93 |
94 class TextureStateTrackingContext : public TestWebGraphicsContext3D { | 94 class TextureStateTrackingContext : public TestWebGraphicsContext3D { |
95 public: | 95 public: |
96 MOCK_METHOD2(bindTexture, void(GLenum target, GLuint texture)); | 96 MOCK_METHOD2(bindTexture, void(GLenum target, GLuint texture)); |
97 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); | 97 MOCK_METHOD3(texParameteri, void(GLenum target, GLenum pname, GLint param)); |
98 MOCK_METHOD1(waitSyncPoint, void(GLuint sync_point)); | 98 MOCK_METHOD1(waitSyncPoint, void(GLuint sync_point)); |
99 MOCK_METHOD0(insertSyncPoint, GLuint(void)); | 99 MOCK_METHOD0(insertSyncPoint, GLuint(void)); |
100 MOCK_METHOD2(produceTextureCHROMIUM, | 100 MOCK_METHOD3(produceTextureDirectCHROMIUM, |
101 void(GLenum target, const GLbyte* mailbox)); | 101 void(GLuint texture, GLenum target, const GLbyte* mailbox)); |
102 MOCK_METHOD2(consumeTextureCHROMIUM, | 102 MOCK_METHOD2(createAndConsumeTextureCHROMIUM, |
103 void(GLenum target, const GLbyte* mailbox)); | 103 unsigned(GLenum target, const GLbyte* mailbox)); |
104 | 104 |
105 // Force all textures to be consecutive numbers starting at "1", | 105 // Force all textures to be consecutive numbers starting at "1", |
106 // so we easily can test for them. | 106 // so we easily can test for them. |
107 GLuint NextTextureId() override { | 107 GLuint NextTextureId() override { |
108 base::AutoLock lock(namespace_->lock); | 108 base::AutoLock lock(namespace_->lock); |
109 return namespace_->next_texture_id++; | 109 return namespace_->next_texture_id++; |
110 } | 110 } |
111 void RetireTextureId(GLuint) override {} | 111 void RetireTextureId(GLuint) override {} |
112 }; | 112 }; |
113 | 113 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
251 ASSERT_EQ(GLDataFormat(BoundTexture(target)->format), format); | 251 ASSERT_EQ(GLDataFormat(BoundTexture(target)->format), format); |
252 } | 252 } |
253 ASSERT_TRUE(pixels); | 253 ASSERT_TRUE(pixels); |
254 SetPixels(xoffset, yoffset, width, height, pixels); | 254 SetPixels(xoffset, yoffset, width, height, pixels); |
255 } | 255 } |
256 | 256 |
257 void genMailboxCHROMIUM(GLbyte* mailbox) override { | 257 void genMailboxCHROMIUM(GLbyte* mailbox) override { |
258 return shared_data_->GenMailbox(mailbox); | 258 return shared_data_->GenMailbox(mailbox); |
259 } | 259 } |
260 | 260 |
261 void produceTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override { | 261 void produceTextureDirectCHROMIUM(GLuint texture, |
262 CheckTextureIsBound(target); | 262 GLenum target, |
263 | 263 const GLbyte* mailbox) override { |
264 // Delay moving the texture into the mailbox until the next | 264 // Delay moving the texture into the mailbox until the next |
265 // InsertSyncPoint, so that it is not visible to other contexts that | 265 // InsertSyncPoint, so that it is not visible to other contexts that |
266 // haven't waited on that sync point. | 266 // haven't waited on that sync point. |
267 scoped_ptr<PendingProduceTexture> pending(new PendingProduceTexture); | 267 scoped_ptr<PendingProduceTexture> pending(new PendingProduceTexture); |
268 memcpy(pending->mailbox, mailbox, sizeof(pending->mailbox)); | 268 memcpy(pending->mailbox, mailbox, sizeof(pending->mailbox)); |
269 base::AutoLock lock_for_texture_access(namespace_->lock); | 269 base::AutoLock lock_for_texture_access(namespace_->lock); |
270 pending->texture = BoundTexture(target); | 270 pending->texture = UnboundTexture(texture); |
271 pending_produce_textures_.push_back(pending.Pass()); | 271 pending_produce_textures_.push_back(pending.Pass()); |
272 } | 272 } |
273 | 273 |
274 void consumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override { | 274 GLuint createAndConsumeTextureCHROMIUM(GLenum target, |
275 CheckTextureIsBound(target); | 275 const GLbyte* mailbox) override { |
| 276 GLuint texture_id = createTexture(); |
276 base::AutoLock lock_for_texture_access(namespace_->lock); | 277 base::AutoLock lock_for_texture_access(namespace_->lock); |
277 scoped_refptr<TestTexture> texture = | 278 scoped_refptr<TestTexture> texture = |
278 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); | 279 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); |
279 namespace_->textures.Replace(BoundTextureId(target), texture); | 280 namespace_->textures.Replace(texture_id, texture); |
| 281 return texture_id; |
280 } | 282 } |
281 | 283 |
282 void GetPixels(const gfx::Size& size, | 284 void GetPixels(const gfx::Size& size, |
283 ResourceFormat format, | 285 ResourceFormat format, |
284 uint8_t* pixels) { | 286 uint8_t* pixels) { |
285 CheckTextureIsBound(GL_TEXTURE_2D); | 287 CheckTextureIsBound(GL_TEXTURE_2D); |
286 base::AutoLock lock_for_texture_access(namespace_->lock); | 288 base::AutoLock lock_for_texture_access(namespace_->lock); |
287 scoped_refptr<TestTexture> texture = BoundTexture(GL_TEXTURE_2D); | 289 scoped_refptr<TestTexture> texture = BoundTexture(GL_TEXTURE_2D); |
288 ASSERT_EQ(texture->size, size); | 290 ASSERT_EQ(texture->size, size); |
289 ASSERT_EQ(texture->format, format); | 291 ASSERT_EQ(texture->format, format); |
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 | 456 |
455 ResourceProviderContext* context() { return context3d_; } | 457 ResourceProviderContext* context() { return context3d_; } |
456 | 458 |
457 ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point, | 459 ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point, |
458 bool* lost_resource, | 460 bool* lost_resource, |
459 bool* release_called, | 461 bool* release_called, |
460 uint32* sync_point) { | 462 uint32* sync_point) { |
461 if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) { | 463 if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) { |
462 unsigned texture = child_context_->createTexture(); | 464 unsigned texture = child_context_->createTexture(); |
463 gpu::Mailbox gpu_mailbox; | 465 gpu::Mailbox gpu_mailbox; |
464 child_context_->bindTexture(GL_TEXTURE_2D, texture); | |
465 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); | 466 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); |
466 child_context_->produceTextureCHROMIUM(GL_TEXTURE_2D, gpu_mailbox.name); | 467 child_context_->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, |
| 468 gpu_mailbox.name); |
467 *sync_point = child_context_->insertSyncPoint(); | 469 *sync_point = child_context_->insertSyncPoint(); |
468 EXPECT_LT(0u, *sync_point); | 470 EXPECT_LT(0u, *sync_point); |
469 | 471 |
470 scoped_ptr<SharedBitmap> shared_bitmap; | 472 scoped_ptr<SharedBitmap> shared_bitmap; |
471 scoped_ptr<SingleReleaseCallbackImpl> callback = | 473 scoped_ptr<SingleReleaseCallbackImpl> callback = |
472 SingleReleaseCallbackImpl::Create(base::Bind( | 474 SingleReleaseCallbackImpl::Create(base::Bind( |
473 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), | 475 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), |
474 release_called, release_sync_point, lost_resource)); | 476 release_called, release_sync_point, lost_resource)); |
475 return child_resource_provider_->CreateResourceFromTextureMailbox( | 477 return child_resource_provider_->CreateResourceFromTextureMailbox( |
476 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), | 478 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 | 661 |
660 ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource( | 662 ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource( |
661 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 663 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
662 { | 664 { |
663 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 665 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
664 child_resource_provider_.get(), id3); | 666 child_resource_provider_.get(), id3); |
665 EXPECT_TRUE(!!lock.GetGpuMemoryBuffer()); | 667 EXPECT_TRUE(!!lock.GetGpuMemoryBuffer()); |
666 } | 668 } |
667 | 669 |
668 GLuint external_texture_id = child_context_->createExternalTexture(); | 670 GLuint external_texture_id = child_context_->createExternalTexture(); |
669 child_context_->bindTexture(GL_TEXTURE_EXTERNAL_OES, external_texture_id); | |
670 | 671 |
671 gpu::Mailbox external_mailbox; | 672 gpu::Mailbox external_mailbox; |
672 child_context_->genMailboxCHROMIUM(external_mailbox.name); | 673 child_context_->genMailboxCHROMIUM(external_mailbox.name); |
673 child_context_->produceTextureCHROMIUM(GL_TEXTURE_EXTERNAL_OES, | 674 child_context_->produceTextureDirectCHROMIUM( |
674 external_mailbox.name); | 675 external_texture_id, GL_TEXTURE_EXTERNAL_OES, external_mailbox.name); |
675 const GLuint external_sync_point = child_context_->insertSyncPoint(); | 676 const GLuint external_sync_point = child_context_->insertSyncPoint(); |
676 ResourceProvider::ResourceId id4 = | 677 ResourceProvider::ResourceId id4 = |
677 child_resource_provider_->CreateResourceFromTextureMailbox( | 678 child_resource_provider_->CreateResourceFromTextureMailbox( |
678 TextureMailbox( | 679 TextureMailbox( |
679 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), | 680 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), |
680 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); | 681 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); |
681 | 682 |
682 ReturnedResourceArray returned_to_child; | 683 ReturnedResourceArray returned_to_child; |
683 int child_id = | 684 int child_id = |
684 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); | 685 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); |
(...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1738 | 1739 |
1739 ReturnedResourceArray returned_to_child; | 1740 ReturnedResourceArray returned_to_child; |
1740 int child_id = parent_resource_provider->CreateChild( | 1741 int child_id = parent_resource_provider->CreateChild( |
1741 GetReturnCallback(&returned_to_child)); | 1742 GetReturnCallback(&returned_to_child)); |
1742 { | 1743 { |
1743 // Transfer some resource to the parent. | 1744 // Transfer some resource to the parent. |
1744 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 1745 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
1745 resource_ids_to_transfer.push_back(id); | 1746 resource_ids_to_transfer.push_back(id); |
1746 TransferableResourceArray list; | 1747 TransferableResourceArray list; |
1747 | 1748 |
1748 EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, child_texture_id)); | |
1749 EXPECT_CALL(*child_context, | 1749 EXPECT_CALL(*child_context, |
1750 produceTextureCHROMIUM(GL_TEXTURE_2D, _)); | 1750 produceTextureDirectCHROMIUM(_, GL_TEXTURE_2D, _)); |
1751 EXPECT_CALL(*child_context, insertSyncPoint()); | 1751 EXPECT_CALL(*child_context, insertSyncPoint()); |
1752 child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, | 1752 child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, |
1753 &list); | 1753 &list); |
1754 Mock::VerifyAndClearExpectations(child_context); | 1754 Mock::VerifyAndClearExpectations(child_context); |
1755 | 1755 |
1756 ASSERT_EQ(1u, list.size()); | 1756 ASSERT_EQ(1u, list.size()); |
1757 EXPECT_EQ(static_cast<unsigned>(child_filter), list[0].filter); | 1757 EXPECT_EQ(static_cast<unsigned>(child_filter), list[0].filter); |
1758 | 1758 |
1759 EXPECT_CALL(*parent_context, | 1759 EXPECT_CALL(*parent_context, |
1760 bindTexture(GL_TEXTURE_2D, parent_texture_id)); | 1760 createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, _)) |
1761 EXPECT_CALL(*parent_context, consumeTextureCHROMIUM(GL_TEXTURE_2D, _)); | 1761 .WillOnce(Return(parent_texture_id)); |
| 1762 |
1762 parent_resource_provider->ReceiveFromChild(child_id, list); | 1763 parent_resource_provider->ReceiveFromChild(child_id, list); |
1763 { | 1764 { |
1764 parent_resource_provider->WaitSyncPointIfNeeded(list[0].id); | 1765 parent_resource_provider->WaitSyncPointIfNeeded(list[0].id); |
1765 ResourceProvider::ScopedReadLockGL lock(parent_resource_provider.get(), | 1766 ResourceProvider::ScopedReadLockGL lock(parent_resource_provider.get(), |
1766 list[0].id); | 1767 list[0].id); |
1767 } | 1768 } |
1768 Mock::VerifyAndClearExpectations(parent_context); | 1769 Mock::VerifyAndClearExpectations(parent_context); |
1769 | 1770 |
1770 parent_resource_provider->DeclareUsedResourcesFromChild( | 1771 parent_resource_provider->DeclareUsedResourcesFromChild( |
1771 child_id, resource_ids_to_transfer); | 1772 child_id, resource_ids_to_transfer); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 // Other mailbox transfers tested elsewhere. | 1836 // Other mailbox transfers tested elsewhere. |
1836 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 1837 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
1837 return; | 1838 return; |
1838 unsigned texture = context()->createTexture(); | 1839 unsigned texture = context()->createTexture(); |
1839 context()->bindTexture(GL_TEXTURE_2D, texture); | 1840 context()->bindTexture(GL_TEXTURE_2D, texture); |
1840 uint8_t data[4] = { 1, 2, 3, 4 }; | 1841 uint8_t data[4] = { 1, 2, 3, 4 }; |
1841 context()->texImage2D( | 1842 context()->texImage2D( |
1842 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data); | 1843 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data); |
1843 gpu::Mailbox mailbox; | 1844 gpu::Mailbox mailbox; |
1844 context()->genMailboxCHROMIUM(mailbox.name); | 1845 context()->genMailboxCHROMIUM(mailbox.name); |
1845 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1846 context()->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, mailbox.name); |
1846 uint32 sync_point = context()->insertSyncPoint(); | 1847 uint32 sync_point = context()->insertSyncPoint(); |
1847 | 1848 |
1848 // All the logic below assumes that the sync points are all positive. | 1849 // All the logic below assumes that the sync points are all positive. |
1849 EXPECT_LT(0u, sync_point); | 1850 EXPECT_LT(0u, sync_point); |
1850 | 1851 |
1851 uint32 release_sync_point = 0; | 1852 uint32 release_sync_point = 0; |
1852 bool lost_resource = false; | 1853 bool lost_resource = false; |
1853 BlockingTaskRunner* main_thread_task_runner = NULL; | 1854 BlockingTaskRunner* main_thread_task_runner = NULL; |
1854 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, | 1855 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, |
1855 &release_sync_point, | 1856 &release_sync_point, |
(...skipping 13 matching lines...) Expand all Loading... |
1869 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); | 1870 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); |
1870 ASSERT_EQ(1u, list.size()); | 1871 ASSERT_EQ(1u, list.size()); |
1871 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); | 1872 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); |
1872 EXPECT_EQ(0, | 1873 EXPECT_EQ(0, |
1873 memcmp(mailbox.name, | 1874 memcmp(mailbox.name, |
1874 list[0].mailbox_holder.mailbox.name, | 1875 list[0].mailbox_holder.mailbox.name, |
1875 sizeof(mailbox.name))); | 1876 sizeof(mailbox.name))); |
1876 EXPECT_EQ(0u, release_sync_point); | 1877 EXPECT_EQ(0u, release_sync_point); |
1877 | 1878 |
1878 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); | 1879 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); |
1879 unsigned other_texture = context()->createTexture(); | 1880 unsigned other_texture = |
1880 context()->bindTexture(GL_TEXTURE_2D, other_texture); | 1881 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
1881 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
1882 uint8_t test_data[4] = { 0 }; | 1882 uint8_t test_data[4] = { 0 }; |
1883 context()->GetPixels( | 1883 context()->GetPixels( |
1884 gfx::Size(1, 1), RGBA_8888, test_data); | 1884 gfx::Size(1, 1), RGBA_8888, test_data); |
1885 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); | 1885 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); |
1886 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1886 |
| 1887 context()->produceTextureDirectCHROMIUM(other_texture, GL_TEXTURE_2D, |
| 1888 mailbox.name); |
1887 context()->deleteTexture(other_texture); | 1889 context()->deleteTexture(other_texture); |
1888 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); | 1890 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); |
1889 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); | 1891 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); |
1890 | 1892 |
1891 // Receive the resource, then delete it, expect the sync points to be | 1893 // Receive the resource, then delete it, expect the sync points to be |
1892 // consistent. | 1894 // consistent. |
1893 ReturnedResourceArray returned; | 1895 ReturnedResourceArray returned; |
1894 TransferableResource::ReturnResources(list, &returned); | 1896 TransferableResource::ReturnResources(list, &returned); |
1895 resource_provider_->ReceiveReturnsFromParent(returned); | 1897 resource_provider_->ReceiveReturnsFromParent(returned); |
1896 EXPECT_EQ(1u, context()->NumTextures()); | 1898 EXPECT_EQ(1u, context()->NumTextures()); |
(...skipping 23 matching lines...) Expand all Loading... |
1920 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); | 1922 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); |
1921 ASSERT_EQ(1u, list.size()); | 1923 ASSERT_EQ(1u, list.size()); |
1922 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); | 1924 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); |
1923 EXPECT_EQ(0, | 1925 EXPECT_EQ(0, |
1924 memcmp(mailbox.name, | 1926 memcmp(mailbox.name, |
1925 list[0].mailbox_holder.mailbox.name, | 1927 list[0].mailbox_holder.mailbox.name, |
1926 sizeof(mailbox.name))); | 1928 sizeof(mailbox.name))); |
1927 EXPECT_EQ(0u, release_sync_point); | 1929 EXPECT_EQ(0u, release_sync_point); |
1928 | 1930 |
1929 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); | 1931 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); |
1930 unsigned other_texture = context()->createTexture(); | 1932 unsigned other_texture = |
1931 context()->bindTexture(GL_TEXTURE_2D, other_texture); | 1933 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
1932 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
1933 uint8_t test_data[4] = { 0 }; | 1934 uint8_t test_data[4] = { 0 }; |
1934 context()->GetPixels( | 1935 context()->GetPixels( |
1935 gfx::Size(1, 1), RGBA_8888, test_data); | 1936 gfx::Size(1, 1), RGBA_8888, test_data); |
1936 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); | 1937 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); |
1937 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1938 |
| 1939 context()->produceTextureDirectCHROMIUM(other_texture, GL_TEXTURE_2D, |
| 1940 mailbox.name); |
1938 context()->deleteTexture(other_texture); | 1941 context()->deleteTexture(other_texture); |
1939 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); | 1942 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); |
1940 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); | 1943 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); |
1941 | 1944 |
1942 // Delete the resource, which shouldn't do anything. | 1945 // Delete the resource, which shouldn't do anything. |
1943 resource_provider_->DeleteResource(resource); | 1946 resource_provider_->DeleteResource(resource); |
1944 EXPECT_EQ(1u, context()->NumTextures()); | 1947 EXPECT_EQ(1u, context()->NumTextures()); |
1945 EXPECT_EQ(0u, release_sync_point); | 1948 EXPECT_EQ(0u, release_sync_point); |
1946 | 1949 |
1947 // Then receive the resource which should release the mailbox, expect the | 1950 // Then receive the resource which should release the mailbox, expect the |
1948 // sync points to be consistent. | 1951 // sync points to be consistent. |
1949 ReturnedResourceArray returned; | 1952 ReturnedResourceArray returned; |
1950 TransferableResource::ReturnResources(list, &returned); | 1953 TransferableResource::ReturnResources(list, &returned); |
1951 resource_provider_->ReceiveReturnsFromParent(returned); | 1954 resource_provider_->ReceiveReturnsFromParent(returned); |
1952 EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); | 1955 EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); |
1953 EXPECT_FALSE(lost_resource); | 1956 EXPECT_FALSE(lost_resource); |
1954 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); | 1957 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); |
1955 } | 1958 } |
1956 | 1959 |
1957 context()->waitSyncPoint(release_sync_point); | 1960 context()->waitSyncPoint(release_sync_point); |
1958 context()->bindTexture(GL_TEXTURE_2D, texture); | 1961 texture = |
1959 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1962 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
1960 context()->deleteTexture(texture); | 1963 context()->deleteTexture(texture); |
1961 } | 1964 } |
1962 | 1965 |
1963 TEST_P(ResourceProviderTest, LostResourceInParent) { | 1966 TEST_P(ResourceProviderTest, LostResourceInParent) { |
1964 gfx::Size size(1, 1); | 1967 gfx::Size size(1, 1); |
1965 ResourceFormat format = RGBA_8888; | 1968 ResourceFormat format = RGBA_8888; |
1966 ResourceProvider::ResourceId resource = | 1969 ResourceProvider::ResourceId resource = |
1967 child_resource_provider_->CreateResource( | 1970 child_resource_provider_->CreateResource( |
1968 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 1971 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
1969 format); | 1972 format); |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2257 } | 2260 } |
2258 | 2261 |
2259 TEST_P(ResourceProviderTest, LostContext) { | 2262 TEST_P(ResourceProviderTest, LostContext) { |
2260 // TextureMailbox callbacks only exist for GL textures for now. | 2263 // TextureMailbox callbacks only exist for GL textures for now. |
2261 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 2264 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
2262 return; | 2265 return; |
2263 unsigned texture = context()->createTexture(); | 2266 unsigned texture = context()->createTexture(); |
2264 context()->bindTexture(GL_TEXTURE_2D, texture); | 2267 context()->bindTexture(GL_TEXTURE_2D, texture); |
2265 gpu::Mailbox mailbox; | 2268 gpu::Mailbox mailbox; |
2266 context()->genMailboxCHROMIUM(mailbox.name); | 2269 context()->genMailboxCHROMIUM(mailbox.name); |
2267 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 2270 context()->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, mailbox.name); |
2268 uint32 sync_point = context()->insertSyncPoint(); | 2271 uint32 sync_point = context()->insertSyncPoint(); |
2269 | 2272 |
2270 EXPECT_LT(0u, sync_point); | 2273 EXPECT_LT(0u, sync_point); |
2271 | 2274 |
2272 uint32 release_sync_point = 0; | 2275 uint32 release_sync_point = 0; |
2273 bool lost_resource = false; | 2276 bool lost_resource = false; |
2274 BlockingTaskRunner* main_thread_task_runner = NULL; | 2277 BlockingTaskRunner* main_thread_task_runner = NULL; |
2275 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2278 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2276 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, | 2279 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, |
2277 &release_sync_point, | 2280 &release_sync_point, |
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2637 false, | 2640 false, |
2638 1)); | 2641 1)); |
2639 | 2642 |
2640 unsigned texture_id = 1; | 2643 unsigned texture_id = 1; |
2641 uint32 sync_point = 30; | 2644 uint32 sync_point = 30; |
2642 unsigned target = GL_TEXTURE_2D; | 2645 unsigned target = GL_TEXTURE_2D; |
2643 | 2646 |
2644 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2647 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2645 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2648 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2646 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2649 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2647 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2650 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2648 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2651 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2649 | 2652 |
2650 gpu::Mailbox gpu_mailbox; | 2653 gpu::Mailbox gpu_mailbox; |
2651 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2654 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2652 uint32 release_sync_point = 0; | 2655 uint32 release_sync_point = 0; |
2653 bool lost_resource = false; | 2656 bool lost_resource = false; |
2654 BlockingTaskRunner* mailbox_task_runner = NULL; | 2657 BlockingTaskRunner* mailbox_task_runner = NULL; |
2655 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2658 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2656 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2659 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
2657 &release_sync_point, | 2660 &release_sync_point, |
2658 &lost_resource, | 2661 &lost_resource, |
2659 &mailbox_task_runner)); | 2662 &mailbox_task_runner)); |
2660 | 2663 |
2661 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2664 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2662 mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); | 2665 mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); |
2663 | 2666 |
2664 ResourceProvider::ResourceId id = | 2667 ResourceProvider::ResourceId id = |
2665 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2668 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
2666 callback.Pass()); | 2669 callback.Pass()); |
2667 EXPECT_NE(0u, id); | 2670 EXPECT_NE(0u, id); |
2668 | 2671 |
2669 Mock::VerifyAndClearExpectations(context); | 2672 Mock::VerifyAndClearExpectations(context); |
2670 | 2673 |
2671 { | 2674 { |
2672 // Mailbox sync point WaitSyncPoint before using the texture. | 2675 // Mailbox sync point WaitSyncPoint before using the texture. |
2673 EXPECT_CALL(*context, waitSyncPoint(sync_point)); | 2676 EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
2674 resource_provider->WaitSyncPointIfNeeded(id); | 2677 resource_provider->WaitSyncPointIfNeeded(id); |
2675 Mock::VerifyAndClearExpectations(context); | 2678 Mock::VerifyAndClearExpectations(context); |
2676 | 2679 |
2677 // Using the texture does a consume of the mailbox. | 2680 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(target, _)) |
2678 EXPECT_CALL(*context, bindTexture(target, texture_id)).Times(2); | 2681 .WillOnce(Return(texture_id)); |
2679 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); | 2682 EXPECT_CALL(*context, bindTexture(target, texture_id)); |
2680 | 2683 |
2681 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2684 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2682 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2685 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2683 | 2686 |
2684 // The sampler will reset these if |mailbox_nearest_neighbor| does not | 2687 // The sampler will reset these if |mailbox_nearest_neighbor| does not |
2685 // match |sampler_filter|. | 2688 // match |sampler_filter|. |
2686 if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) { | 2689 if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) { |
2687 EXPECT_CALL(*context, texParameteri( | 2690 EXPECT_CALL(*context, texParameteri( |
2688 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter)); | 2691 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter)); |
2689 EXPECT_CALL(*context, texParameteri( | 2692 EXPECT_CALL(*context, texParameteri( |
2690 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter)); | 2693 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter)); |
2691 } | 2694 } |
2692 | 2695 |
2693 ResourceProvider::ScopedSamplerGL lock( | 2696 ResourceProvider::ScopedSamplerGL lock( |
2694 resource_provider.get(), id, sampler_filter); | 2697 resource_provider.get(), id, sampler_filter); |
2695 Mock::VerifyAndClearExpectations(context); | 2698 Mock::VerifyAndClearExpectations(context); |
2696 | 2699 |
2697 // When done with it, a sync point should be inserted, but no produce is | 2700 // When done with it, a sync point should be inserted, but no produce is |
2698 // necessary. | 2701 // necessary. |
2699 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2702 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2700 EXPECT_CALL(*context, insertSyncPoint()); | 2703 EXPECT_CALL(*context, insertSyncPoint()); |
2701 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2704 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2702 | 2705 |
2703 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2706 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2704 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2707 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2705 } | 2708 } |
2706 | 2709 |
2707 resource_provider->DeleteResource(id); | 2710 resource_provider->DeleteResource(id); |
2708 EXPECT_EQ(0u, release_sync_point); | 2711 EXPECT_EQ(0u, release_sync_point); |
2709 EXPECT_FALSE(lost_resource); | 2712 EXPECT_FALSE(lost_resource); |
2710 EXPECT_EQ(main_thread_task_runner, mailbox_task_runner); | 2713 EXPECT_EQ(main_thread_task_runner, mailbox_task_runner); |
2711 } | 2714 } |
2712 }; | 2715 }; |
2713 | 2716 |
2714 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) { | 2717 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) { |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2779 | 2782 |
2780 scoped_ptr<ResourceProvider> resource_provider( | 2783 scoped_ptr<ResourceProvider> resource_provider( |
2781 ResourceProvider::Create(output_surface.get(), | 2784 ResourceProvider::Create(output_surface.get(), |
2782 shared_bitmap_manager_.get(), | 2785 shared_bitmap_manager_.get(), |
2783 gpu_memory_buffer_manager_.get(), | 2786 gpu_memory_buffer_manager_.get(), |
2784 NULL, | 2787 NULL, |
2785 0, | 2788 0, |
2786 false, | 2789 false, |
2787 1)); | 2790 1)); |
2788 | 2791 |
2789 unsigned texture_id = 1; | |
2790 uint32 sync_point = 30; | 2792 uint32 sync_point = 30; |
2791 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2793 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2792 | 2794 |
2793 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2795 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2794 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2796 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2795 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2797 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2796 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2798 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2797 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2799 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2798 | 2800 |
2799 gpu::Mailbox gpu_mailbox; | 2801 gpu::Mailbox gpu_mailbox; |
2800 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2802 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2801 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2803 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2802 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 2804 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2803 | 2805 |
2804 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2806 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2805 | 2807 |
2806 ResourceProvider::ResourceId id = | 2808 ResourceProvider::ResourceId id = |
2807 resource_provider->CreateResourceFromTextureMailbox( | 2809 resource_provider->CreateResourceFromTextureMailbox( |
2808 mailbox, callback.Pass()); | 2810 mailbox, callback.Pass()); |
2809 EXPECT_NE(0u, id); | 2811 EXPECT_NE(0u, id); |
2810 | 2812 |
2811 Mock::VerifyAndClearExpectations(context); | 2813 Mock::VerifyAndClearExpectations(context); |
2812 | 2814 |
2813 { | 2815 { |
2814 // Mailbox sync point WaitSyncPoint before using the texture. | 2816 // Mailbox sync point WaitSyncPoint before using the texture. |
2815 EXPECT_CALL(*context, waitSyncPoint(sync_point)); | 2817 EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
2816 resource_provider->WaitSyncPointIfNeeded(id); | 2818 resource_provider->WaitSyncPointIfNeeded(id); |
2817 Mock::VerifyAndClearExpectations(context); | 2819 Mock::VerifyAndClearExpectations(context); |
2818 | 2820 |
2819 // Using the texture does a consume of the mailbox. | 2821 unsigned texture_id = 1; |
2820 EXPECT_CALL(*context, bindTexture(target, texture_id)); | 2822 |
2821 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); | 2823 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(target, _)) |
| 2824 .WillOnce(Return(texture_id)); |
2822 | 2825 |
2823 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2826 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2824 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2827 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2825 | 2828 |
2826 ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id); | 2829 ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id); |
2827 Mock::VerifyAndClearExpectations(context); | 2830 Mock::VerifyAndClearExpectations(context); |
2828 | 2831 |
2829 // When done with it, a sync point should be inserted, but no produce is | 2832 // When done with it, a sync point should be inserted, but no produce is |
2830 // necessary. | 2833 // necessary. |
2831 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2834 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2832 EXPECT_CALL(*context, insertSyncPoint()); | 2835 EXPECT_CALL(*context, insertSyncPoint()); |
2833 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2836 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2834 | 2837 |
2835 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2838 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2836 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2839 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2837 } | 2840 } |
2838 } | 2841 } |
2839 | 2842 |
2840 TEST_P(ResourceProviderTest, | 2843 TEST_P(ResourceProviderTest, |
2841 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) { | 2844 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) { |
2842 // Mailboxing is only supported for GL textures. | 2845 // Mailboxing is only supported for GL textures. |
2843 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 2846 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
2844 return; | 2847 return; |
2845 | 2848 |
2846 scoped_ptr<TextureStateTrackingContext> context_owned( | 2849 scoped_ptr<TextureStateTrackingContext> context_owned( |
(...skipping 13 matching lines...) Expand all Loading... |
2860 0, | 2863 0, |
2861 false, | 2864 false, |
2862 1)); | 2865 1)); |
2863 | 2866 |
2864 uint32 sync_point = 30; | 2867 uint32 sync_point = 30; |
2865 unsigned target = GL_TEXTURE_2D; | 2868 unsigned target = GL_TEXTURE_2D; |
2866 | 2869 |
2867 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2870 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2868 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2871 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2869 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2872 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2870 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2873 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2871 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2874 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2872 | 2875 |
2873 gpu::Mailbox gpu_mailbox; | 2876 gpu::Mailbox gpu_mailbox; |
2874 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2877 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2875 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2878 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2876 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 2879 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2877 | 2880 |
2878 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2881 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2879 | 2882 |
2880 ResourceProvider::ResourceId id = | 2883 ResourceProvider::ResourceId id = |
2881 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2884 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2919 0, | 2922 0, |
2920 false, | 2923 false, |
2921 1)); | 2924 1)); |
2922 | 2925 |
2923 uint32 sync_point = 0; | 2926 uint32 sync_point = 0; |
2924 unsigned target = GL_TEXTURE_2D; | 2927 unsigned target = GL_TEXTURE_2D; |
2925 | 2928 |
2926 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2929 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2927 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2930 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2928 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2931 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2929 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2932 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2930 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2933 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
2931 | 2934 |
2932 gpu::Mailbox gpu_mailbox; | 2935 gpu::Mailbox gpu_mailbox; |
2933 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2936 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2934 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2937 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2935 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 2938 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2936 | 2939 |
2937 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2940 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2938 | 2941 |
2939 ResourceProvider::ResourceId id = | 2942 ResourceProvider::ResourceId id = |
2940 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2943 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
(...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3722 resource_provider->AllocateForTesting(id); | 3725 resource_provider->AllocateForTesting(id); |
3723 Mock::VerifyAndClearExpectations(context); | 3726 Mock::VerifyAndClearExpectations(context); |
3724 | 3727 |
3725 DCHECK_EQ(10u, context->PeekTextureId()); | 3728 DCHECK_EQ(10u, context->PeekTextureId()); |
3726 resource_provider->DeleteResource(id); | 3729 resource_provider->DeleteResource(id); |
3727 } | 3730 } |
3728 } | 3731 } |
3729 | 3732 |
3730 } // namespace | 3733 } // namespace |
3731 } // namespace cc | 3734 } // namespace cc |
OLD | NEW |