Chromium Code Reviews| 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 GLuint createAndConsumeTextureCHROMIUM(GLenum target, | |
| 275 const GLbyte* mailbox) override { | |
| 276 GLuint texture_id = createTexture(); | |
| 277 base::AutoLock lock_for_texture_access(namespace_->lock); | |
| 278 scoped_refptr<TestTexture> texture = | |
| 279 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); | |
| 280 namespace_->textures.Replace(texture_id, texture); | |
| 281 return texture_id; | |
| 282 } | |
| 283 | |
| 274 void consumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override { | 284 void consumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override { |
|
danakj
2015/03/03 19:27:30
You said this is called from inside createAndConsu
sohanjg
2015/03/04 05:49:50
createAndConsumeTextureCHROMIUM, of TestWebGraphic
sohanjg
2015/03/05 05:44:26
Removed the func.
| |
| 275 CheckTextureIsBound(target); | 285 CheckTextureIsBound(target); |
| 276 base::AutoLock lock_for_texture_access(namespace_->lock); | 286 base::AutoLock lock_for_texture_access(namespace_->lock); |
| 277 scoped_refptr<TestTexture> texture = | 287 scoped_refptr<TestTexture> texture = |
| 278 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); | 288 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); |
| 279 namespace_->textures.Replace(BoundTextureId(target), texture); | 289 namespace_->textures.Replace(BoundTextureId(target), texture); |
| 280 } | 290 } |
| 281 | 291 |
| 282 void GetPixels(const gfx::Size& size, | 292 void GetPixels(const gfx::Size& size, |
| 283 ResourceFormat format, | 293 ResourceFormat format, |
| 284 uint8_t* pixels) { | 294 uint8_t* pixels) { |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 454 | 464 |
| 455 ResourceProviderContext* context() { return context3d_; } | 465 ResourceProviderContext* context() { return context3d_; } |
| 456 | 466 |
| 457 ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point, | 467 ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point, |
| 458 bool* lost_resource, | 468 bool* lost_resource, |
| 459 bool* release_called, | 469 bool* release_called, |
| 460 uint32* sync_point) { | 470 uint32* sync_point) { |
| 461 if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) { | 471 if (GetParam() == ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) { |
| 462 unsigned texture = child_context_->createTexture(); | 472 unsigned texture = child_context_->createTexture(); |
| 463 gpu::Mailbox gpu_mailbox; | 473 gpu::Mailbox gpu_mailbox; |
| 464 child_context_->bindTexture(GL_TEXTURE_2D, texture); | |
| 465 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); | 474 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); |
| 466 child_context_->produceTextureCHROMIUM(GL_TEXTURE_2D, gpu_mailbox.name); | 475 child_context_->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, |
| 476 gpu_mailbox.name); | |
| 467 *sync_point = child_context_->insertSyncPoint(); | 477 *sync_point = child_context_->insertSyncPoint(); |
| 468 EXPECT_LT(0u, *sync_point); | 478 EXPECT_LT(0u, *sync_point); |
| 469 | 479 |
| 470 scoped_ptr<SharedBitmap> shared_bitmap; | 480 scoped_ptr<SharedBitmap> shared_bitmap; |
| 471 scoped_ptr<SingleReleaseCallbackImpl> callback = | 481 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 472 SingleReleaseCallbackImpl::Create(base::Bind( | 482 SingleReleaseCallbackImpl::Create(base::Bind( |
| 473 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), | 483 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), |
| 474 release_called, release_sync_point, lost_resource)); | 484 release_called, release_sync_point, lost_resource)); |
| 475 return child_resource_provider_->CreateResourceFromTextureMailbox( | 485 return child_resource_provider_->CreateResourceFromTextureMailbox( |
| 476 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), | 486 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 659 | 669 |
| 660 ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource( | 670 ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource( |
| 661 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 671 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
| 662 { | 672 { |
| 663 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( | 673 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( |
| 664 child_resource_provider_.get(), id3); | 674 child_resource_provider_.get(), id3); |
| 665 EXPECT_TRUE(!!lock.GetGpuMemoryBuffer()); | 675 EXPECT_TRUE(!!lock.GetGpuMemoryBuffer()); |
| 666 } | 676 } |
| 667 | 677 |
| 668 GLuint external_texture_id = child_context_->createExternalTexture(); | 678 GLuint external_texture_id = child_context_->createExternalTexture(); |
| 669 child_context_->bindTexture(GL_TEXTURE_EXTERNAL_OES, external_texture_id); | |
| 670 | 679 |
| 671 gpu::Mailbox external_mailbox; | 680 gpu::Mailbox external_mailbox; |
| 672 child_context_->genMailboxCHROMIUM(external_mailbox.name); | 681 child_context_->genMailboxCHROMIUM(external_mailbox.name); |
| 673 child_context_->produceTextureCHROMIUM(GL_TEXTURE_EXTERNAL_OES, | 682 child_context_->produceTextureDirectCHROMIUM( |
| 674 external_mailbox.name); | 683 external_texture_id, GL_TEXTURE_EXTERNAL_OES, external_mailbox.name); |
| 675 const GLuint external_sync_point = child_context_->insertSyncPoint(); | 684 const GLuint external_sync_point = child_context_->insertSyncPoint(); |
| 676 ResourceProvider::ResourceId id4 = | 685 ResourceProvider::ResourceId id4 = |
| 677 child_resource_provider_->CreateResourceFromTextureMailbox( | 686 child_resource_provider_->CreateResourceFromTextureMailbox( |
| 678 TextureMailbox( | 687 TextureMailbox( |
| 679 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), | 688 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), |
| 680 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); | 689 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); |
| 681 | 690 |
| 682 ReturnedResourceArray returned_to_child; | 691 ReturnedResourceArray returned_to_child; |
| 683 int child_id = | 692 int child_id = |
| 684 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); | 693 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); |
| (...skipping 1053 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1738 | 1747 |
| 1739 ReturnedResourceArray returned_to_child; | 1748 ReturnedResourceArray returned_to_child; |
| 1740 int child_id = parent_resource_provider->CreateChild( | 1749 int child_id = parent_resource_provider->CreateChild( |
| 1741 GetReturnCallback(&returned_to_child)); | 1750 GetReturnCallback(&returned_to_child)); |
| 1742 { | 1751 { |
| 1743 // Transfer some resource to the parent. | 1752 // Transfer some resource to the parent. |
| 1744 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 1753 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
| 1745 resource_ids_to_transfer.push_back(id); | 1754 resource_ids_to_transfer.push_back(id); |
| 1746 TransferableResourceArray list; | 1755 TransferableResourceArray list; |
| 1747 | 1756 |
| 1748 EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, child_texture_id)); | |
| 1749 EXPECT_CALL(*child_context, | 1757 EXPECT_CALL(*child_context, |
| 1750 produceTextureCHROMIUM(GL_TEXTURE_2D, _)); | 1758 produceTextureDirectCHROMIUM(_, GL_TEXTURE_2D, _)); |
| 1751 EXPECT_CALL(*child_context, insertSyncPoint()); | 1759 EXPECT_CALL(*child_context, insertSyncPoint()); |
| 1752 child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, | 1760 child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, |
| 1753 &list); | 1761 &list); |
| 1754 Mock::VerifyAndClearExpectations(child_context); | 1762 Mock::VerifyAndClearExpectations(child_context); |
| 1755 | 1763 |
| 1756 ASSERT_EQ(1u, list.size()); | 1764 ASSERT_EQ(1u, list.size()); |
| 1757 EXPECT_EQ(static_cast<unsigned>(child_filter), list[0].filter); | 1765 EXPECT_EQ(static_cast<unsigned>(child_filter), list[0].filter); |
| 1758 | 1766 |
| 1759 EXPECT_CALL(*parent_context, | 1767 EXPECT_CALL(*parent_context, |
| 1760 bindTexture(GL_TEXTURE_2D, parent_texture_id)); | 1768 createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, _)) |
| 1761 EXPECT_CALL(*parent_context, consumeTextureCHROMIUM(GL_TEXTURE_2D, _)); | 1769 .WillOnce(Return(parent_texture_id)); |
| 1770 | |
| 1762 parent_resource_provider->ReceiveFromChild(child_id, list); | 1771 parent_resource_provider->ReceiveFromChild(child_id, list); |
| 1763 { | 1772 { |
| 1764 parent_resource_provider->WaitSyncPointIfNeeded(list[0].id); | 1773 parent_resource_provider->WaitSyncPointIfNeeded(list[0].id); |
| 1765 ResourceProvider::ScopedReadLockGL lock(parent_resource_provider.get(), | 1774 ResourceProvider::ScopedReadLockGL lock(parent_resource_provider.get(), |
| 1766 list[0].id); | 1775 list[0].id); |
| 1767 } | 1776 } |
| 1768 Mock::VerifyAndClearExpectations(parent_context); | 1777 Mock::VerifyAndClearExpectations(parent_context); |
| 1769 | 1778 |
| 1770 parent_resource_provider->DeclareUsedResourcesFromChild( | 1779 parent_resource_provider->DeclareUsedResourcesFromChild( |
| 1771 child_id, resource_ids_to_transfer); | 1780 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. | 1844 // Other mailbox transfers tested elsewhere. |
| 1836 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 1845 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 1837 return; | 1846 return; |
| 1838 unsigned texture = context()->createTexture(); | 1847 unsigned texture = context()->createTexture(); |
| 1839 context()->bindTexture(GL_TEXTURE_2D, texture); | 1848 context()->bindTexture(GL_TEXTURE_2D, texture); |
| 1840 uint8_t data[4] = { 1, 2, 3, 4 }; | 1849 uint8_t data[4] = { 1, 2, 3, 4 }; |
| 1841 context()->texImage2D( | 1850 context()->texImage2D( |
| 1842 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data); | 1851 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data); |
| 1843 gpu::Mailbox mailbox; | 1852 gpu::Mailbox mailbox; |
| 1844 context()->genMailboxCHROMIUM(mailbox.name); | 1853 context()->genMailboxCHROMIUM(mailbox.name); |
| 1845 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1854 context()->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, mailbox.name); |
| 1846 uint32 sync_point = context()->insertSyncPoint(); | 1855 uint32 sync_point = context()->insertSyncPoint(); |
| 1847 | 1856 |
| 1848 // All the logic below assumes that the sync points are all positive. | 1857 // All the logic below assumes that the sync points are all positive. |
| 1849 EXPECT_LT(0u, sync_point); | 1858 EXPECT_LT(0u, sync_point); |
| 1850 | 1859 |
| 1851 uint32 release_sync_point = 0; | 1860 uint32 release_sync_point = 0; |
| 1852 bool lost_resource = false; | 1861 bool lost_resource = false; |
| 1853 BlockingTaskRunner* main_thread_task_runner = NULL; | 1862 BlockingTaskRunner* main_thread_task_runner = NULL; |
| 1854 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, | 1863 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, |
| 1855 &release_sync_point, | 1864 &release_sync_point, |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 1869 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); | 1878 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); |
| 1870 ASSERT_EQ(1u, list.size()); | 1879 ASSERT_EQ(1u, list.size()); |
| 1871 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); | 1880 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); |
| 1872 EXPECT_EQ(0, | 1881 EXPECT_EQ(0, |
| 1873 memcmp(mailbox.name, | 1882 memcmp(mailbox.name, |
| 1874 list[0].mailbox_holder.mailbox.name, | 1883 list[0].mailbox_holder.mailbox.name, |
| 1875 sizeof(mailbox.name))); | 1884 sizeof(mailbox.name))); |
| 1876 EXPECT_EQ(0u, release_sync_point); | 1885 EXPECT_EQ(0u, release_sync_point); |
| 1877 | 1886 |
| 1878 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); | 1887 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); |
| 1879 unsigned other_texture = context()->createTexture(); | 1888 unsigned other_texture = |
| 1880 context()->bindTexture(GL_TEXTURE_2D, other_texture); | 1889 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 1881 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
| 1882 uint8_t test_data[4] = { 0 }; | 1890 uint8_t test_data[4] = { 0 }; |
| 1883 context()->GetPixels( | 1891 context()->GetPixels( |
| 1884 gfx::Size(1, 1), RGBA_8888, test_data); | 1892 gfx::Size(1, 1), RGBA_8888, test_data); |
| 1885 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); | 1893 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); |
| 1886 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1894 |
| 1895 context()->produceTextureDirectCHROMIUM(other_texture, GL_TEXTURE_2D, | |
| 1896 mailbox.name); | |
| 1887 context()->deleteTexture(other_texture); | 1897 context()->deleteTexture(other_texture); |
| 1888 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); | 1898 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); |
| 1889 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); | 1899 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); |
| 1890 | 1900 |
| 1891 // Receive the resource, then delete it, expect the sync points to be | 1901 // Receive the resource, then delete it, expect the sync points to be |
| 1892 // consistent. | 1902 // consistent. |
| 1893 ReturnedResourceArray returned; | 1903 ReturnedResourceArray returned; |
| 1894 TransferableResource::ReturnResources(list, &returned); | 1904 TransferableResource::ReturnResources(list, &returned); |
| 1895 resource_provider_->ReceiveReturnsFromParent(returned); | 1905 resource_provider_->ReceiveReturnsFromParent(returned); |
| 1896 EXPECT_EQ(1u, context()->NumTextures()); | 1906 EXPECT_EQ(1u, context()->NumTextures()); |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 1920 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); | 1930 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); |
| 1921 ASSERT_EQ(1u, list.size()); | 1931 ASSERT_EQ(1u, list.size()); |
| 1922 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); | 1932 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); |
| 1923 EXPECT_EQ(0, | 1933 EXPECT_EQ(0, |
| 1924 memcmp(mailbox.name, | 1934 memcmp(mailbox.name, |
| 1925 list[0].mailbox_holder.mailbox.name, | 1935 list[0].mailbox_holder.mailbox.name, |
| 1926 sizeof(mailbox.name))); | 1936 sizeof(mailbox.name))); |
| 1927 EXPECT_EQ(0u, release_sync_point); | 1937 EXPECT_EQ(0u, release_sync_point); |
| 1928 | 1938 |
| 1929 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); | 1939 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); |
| 1930 unsigned other_texture = context()->createTexture(); | 1940 unsigned other_texture = |
| 1931 context()->bindTexture(GL_TEXTURE_2D, other_texture); | 1941 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 1932 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | |
| 1933 uint8_t test_data[4] = { 0 }; | 1942 uint8_t test_data[4] = { 0 }; |
| 1934 context()->GetPixels( | 1943 context()->GetPixels( |
| 1935 gfx::Size(1, 1), RGBA_8888, test_data); | 1944 gfx::Size(1, 1), RGBA_8888, test_data); |
| 1936 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); | 1945 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); |
| 1937 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1946 |
| 1947 context()->produceTextureDirectCHROMIUM(other_texture, GL_TEXTURE_2D, | |
| 1948 mailbox.name); | |
| 1938 context()->deleteTexture(other_texture); | 1949 context()->deleteTexture(other_texture); |
| 1939 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); | 1950 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); |
| 1940 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); | 1951 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); |
| 1941 | 1952 |
| 1942 // Delete the resource, which shouldn't do anything. | 1953 // Delete the resource, which shouldn't do anything. |
| 1943 resource_provider_->DeleteResource(resource); | 1954 resource_provider_->DeleteResource(resource); |
| 1944 EXPECT_EQ(1u, context()->NumTextures()); | 1955 EXPECT_EQ(1u, context()->NumTextures()); |
| 1945 EXPECT_EQ(0u, release_sync_point); | 1956 EXPECT_EQ(0u, release_sync_point); |
| 1946 | 1957 |
| 1947 // Then receive the resource which should release the mailbox, expect the | 1958 // Then receive the resource which should release the mailbox, expect the |
| 1948 // sync points to be consistent. | 1959 // sync points to be consistent. |
| 1949 ReturnedResourceArray returned; | 1960 ReturnedResourceArray returned; |
| 1950 TransferableResource::ReturnResources(list, &returned); | 1961 TransferableResource::ReturnResources(list, &returned); |
| 1951 resource_provider_->ReceiveReturnsFromParent(returned); | 1962 resource_provider_->ReceiveReturnsFromParent(returned); |
| 1952 EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); | 1963 EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); |
| 1953 EXPECT_FALSE(lost_resource); | 1964 EXPECT_FALSE(lost_resource); |
| 1954 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); | 1965 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); |
| 1955 } | 1966 } |
| 1956 | 1967 |
| 1957 context()->waitSyncPoint(release_sync_point); | 1968 context()->waitSyncPoint(release_sync_point); |
| 1958 context()->bindTexture(GL_TEXTURE_2D, texture); | 1969 texture = |
| 1959 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1970 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
| 1960 context()->deleteTexture(texture); | 1971 context()->deleteTexture(texture); |
| 1961 } | 1972 } |
| 1962 | 1973 |
| 1963 TEST_P(ResourceProviderTest, LostResourceInParent) { | 1974 TEST_P(ResourceProviderTest, LostResourceInParent) { |
| 1964 gfx::Size size(1, 1); | 1975 gfx::Size size(1, 1); |
| 1965 ResourceFormat format = RGBA_8888; | 1976 ResourceFormat format = RGBA_8888; |
| 1966 ResourceProvider::ResourceId resource = | 1977 ResourceProvider::ResourceId resource = |
| 1967 child_resource_provider_->CreateResource( | 1978 child_resource_provider_->CreateResource( |
| 1968 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 1979 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 1969 format); | 1980 format); |
| (...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2257 } | 2268 } |
| 2258 | 2269 |
| 2259 TEST_P(ResourceProviderTest, LostContext) { | 2270 TEST_P(ResourceProviderTest, LostContext) { |
| 2260 // TextureMailbox callbacks only exist for GL textures for now. | 2271 // TextureMailbox callbacks only exist for GL textures for now. |
| 2261 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 2272 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 2262 return; | 2273 return; |
| 2263 unsigned texture = context()->createTexture(); | 2274 unsigned texture = context()->createTexture(); |
| 2264 context()->bindTexture(GL_TEXTURE_2D, texture); | 2275 context()->bindTexture(GL_TEXTURE_2D, texture); |
| 2265 gpu::Mailbox mailbox; | 2276 gpu::Mailbox mailbox; |
| 2266 context()->genMailboxCHROMIUM(mailbox.name); | 2277 context()->genMailboxCHROMIUM(mailbox.name); |
| 2267 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 2278 context()->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, mailbox.name); |
| 2268 uint32 sync_point = context()->insertSyncPoint(); | 2279 uint32 sync_point = context()->insertSyncPoint(); |
| 2269 | 2280 |
| 2270 EXPECT_LT(0u, sync_point); | 2281 EXPECT_LT(0u, sync_point); |
| 2271 | 2282 |
| 2272 uint32 release_sync_point = 0; | 2283 uint32 release_sync_point = 0; |
| 2273 bool lost_resource = false; | 2284 bool lost_resource = false; |
| 2274 BlockingTaskRunner* main_thread_task_runner = NULL; | 2285 BlockingTaskRunner* main_thread_task_runner = NULL; |
| 2275 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2286 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2276 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, | 2287 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, |
| 2277 &release_sync_point, | 2288 &release_sync_point, |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2637 false, | 2648 false, |
| 2638 1)); | 2649 1)); |
| 2639 | 2650 |
| 2640 unsigned texture_id = 1; | 2651 unsigned texture_id = 1; |
| 2641 uint32 sync_point = 30; | 2652 uint32 sync_point = 30; |
| 2642 unsigned target = GL_TEXTURE_2D; | 2653 unsigned target = GL_TEXTURE_2D; |
| 2643 | 2654 |
| 2644 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2655 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2645 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2656 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2646 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2657 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2647 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2658 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2648 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2659 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2649 | 2660 |
| 2650 gpu::Mailbox gpu_mailbox; | 2661 gpu::Mailbox gpu_mailbox; |
| 2651 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2662 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
| 2652 uint32 release_sync_point = 0; | 2663 uint32 release_sync_point = 0; |
| 2653 bool lost_resource = false; | 2664 bool lost_resource = false; |
| 2654 BlockingTaskRunner* mailbox_task_runner = NULL; | 2665 BlockingTaskRunner* mailbox_task_runner = NULL; |
| 2655 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2666 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2656 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2667 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
| 2657 &release_sync_point, | 2668 &release_sync_point, |
| 2658 &lost_resource, | 2669 &lost_resource, |
| 2659 &mailbox_task_runner)); | 2670 &mailbox_task_runner)); |
| 2660 | 2671 |
| 2661 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2672 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
| 2662 mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); | 2673 mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); |
| 2663 | 2674 |
| 2664 ResourceProvider::ResourceId id = | 2675 ResourceProvider::ResourceId id = |
| 2665 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2676 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
| 2666 callback.Pass()); | 2677 callback.Pass()); |
| 2667 EXPECT_NE(0u, id); | 2678 EXPECT_NE(0u, id); |
| 2668 | 2679 |
| 2669 Mock::VerifyAndClearExpectations(context); | 2680 Mock::VerifyAndClearExpectations(context); |
| 2670 | 2681 |
| 2671 { | 2682 { |
| 2672 // Mailbox sync point WaitSyncPoint before using the texture. | 2683 // Mailbox sync point WaitSyncPoint before using the texture. |
| 2673 EXPECT_CALL(*context, waitSyncPoint(sync_point)); | 2684 EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
| 2674 resource_provider->WaitSyncPointIfNeeded(id); | 2685 resource_provider->WaitSyncPointIfNeeded(id); |
| 2675 Mock::VerifyAndClearExpectations(context); | 2686 Mock::VerifyAndClearExpectations(context); |
| 2676 | 2687 |
| 2677 // Using the texture does a consume of the mailbox. | 2688 EXPECT_CALL(*context, bindTexture(target, texture_id)); |
|
danakj
2015/03/03 19:27:30
can you move this below the EXPECT_CALL(createAndC
sohanjg
2015/03/05 05:44:26
Done.
| |
| 2678 EXPECT_CALL(*context, bindTexture(target, texture_id)).Times(2); | 2689 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(target, _)) |
| 2679 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); | 2690 .WillOnce(Return(texture_id)); |
| 2680 | 2691 |
| 2681 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2692 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2682 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2693 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2683 | 2694 |
| 2684 // The sampler will reset these if |mailbox_nearest_neighbor| does not | 2695 // The sampler will reset these if |mailbox_nearest_neighbor| does not |
| 2685 // match |sampler_filter|. | 2696 // match |sampler_filter|. |
| 2686 if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) { | 2697 if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) { |
| 2687 EXPECT_CALL(*context, texParameteri( | 2698 EXPECT_CALL(*context, texParameteri( |
| 2688 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter)); | 2699 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter)); |
| 2689 EXPECT_CALL(*context, texParameteri( | 2700 EXPECT_CALL(*context, texParameteri( |
| 2690 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter)); | 2701 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter)); |
| 2691 } | 2702 } |
| 2692 | 2703 |
| 2693 ResourceProvider::ScopedSamplerGL lock( | 2704 ResourceProvider::ScopedSamplerGL lock( |
| 2694 resource_provider.get(), id, sampler_filter); | 2705 resource_provider.get(), id, sampler_filter); |
| 2695 Mock::VerifyAndClearExpectations(context); | 2706 Mock::VerifyAndClearExpectations(context); |
| 2696 | 2707 |
| 2697 // When done with it, a sync point should be inserted, but no produce is | 2708 // When done with it, a sync point should be inserted, but no produce is |
| 2698 // necessary. | 2709 // necessary. |
| 2699 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2710 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2700 EXPECT_CALL(*context, insertSyncPoint()); | 2711 EXPECT_CALL(*context, insertSyncPoint()); |
| 2701 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2712 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2702 | 2713 |
| 2703 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2714 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2704 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2715 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2705 } | 2716 } |
| 2706 | 2717 |
| 2707 resource_provider->DeleteResource(id); | 2718 resource_provider->DeleteResource(id); |
| 2708 EXPECT_EQ(0u, release_sync_point); | 2719 EXPECT_EQ(0u, release_sync_point); |
| 2709 EXPECT_FALSE(lost_resource); | 2720 EXPECT_FALSE(lost_resource); |
| 2710 EXPECT_EQ(main_thread_task_runner, mailbox_task_runner); | 2721 EXPECT_EQ(main_thread_task_runner, mailbox_task_runner); |
| 2711 } | 2722 } |
| 2712 }; | 2723 }; |
| 2713 | 2724 |
| 2714 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) { | 2725 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) { |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2779 | 2790 |
| 2780 scoped_ptr<ResourceProvider> resource_provider( | 2791 scoped_ptr<ResourceProvider> resource_provider( |
| 2781 ResourceProvider::Create(output_surface.get(), | 2792 ResourceProvider::Create(output_surface.get(), |
| 2782 shared_bitmap_manager_.get(), | 2793 shared_bitmap_manager_.get(), |
| 2783 gpu_memory_buffer_manager_.get(), | 2794 gpu_memory_buffer_manager_.get(), |
| 2784 NULL, | 2795 NULL, |
| 2785 0, | 2796 0, |
| 2786 false, | 2797 false, |
| 2787 1)); | 2798 1)); |
| 2788 | 2799 |
| 2789 unsigned texture_id = 1; | |
| 2790 uint32 sync_point = 30; | 2800 uint32 sync_point = 30; |
| 2791 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2801 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
| 2792 | 2802 |
| 2793 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2803 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2794 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2804 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2795 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2805 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2796 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2806 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2797 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2807 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2798 | 2808 |
| 2799 gpu::Mailbox gpu_mailbox; | 2809 gpu::Mailbox gpu_mailbox; |
| 2800 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2810 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
| 2801 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2811 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2802 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 2812 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
| 2803 | 2813 |
| 2804 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2814 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
| 2805 | 2815 |
| 2806 ResourceProvider::ResourceId id = | 2816 ResourceProvider::ResourceId id = |
| 2807 resource_provider->CreateResourceFromTextureMailbox( | 2817 resource_provider->CreateResourceFromTextureMailbox( |
| 2808 mailbox, callback.Pass()); | 2818 mailbox, callback.Pass()); |
| 2809 EXPECT_NE(0u, id); | 2819 EXPECT_NE(0u, id); |
| 2810 | 2820 |
| 2811 Mock::VerifyAndClearExpectations(context); | 2821 Mock::VerifyAndClearExpectations(context); |
| 2812 | 2822 |
| 2813 { | 2823 { |
| 2814 // Mailbox sync point WaitSyncPoint before using the texture. | 2824 // Mailbox sync point WaitSyncPoint before using the texture. |
| 2815 EXPECT_CALL(*context, waitSyncPoint(sync_point)); | 2825 EXPECT_CALL(*context, waitSyncPoint(sync_point)); |
| 2816 resource_provider->WaitSyncPointIfNeeded(id); | 2826 resource_provider->WaitSyncPointIfNeeded(id); |
| 2817 Mock::VerifyAndClearExpectations(context); | 2827 Mock::VerifyAndClearExpectations(context); |
| 2818 | 2828 |
| 2819 // Using the texture does a consume of the mailbox. | 2829 unsigned texture_id = 1; |
| 2820 EXPECT_CALL(*context, bindTexture(target, texture_id)); | 2830 |
| 2821 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _)); | 2831 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(target, _)) |
| 2832 .WillOnce(Return(texture_id)); | |
| 2822 | 2833 |
| 2823 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2834 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2824 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2835 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2825 | 2836 |
| 2826 ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id); | 2837 ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id); |
| 2827 Mock::VerifyAndClearExpectations(context); | 2838 Mock::VerifyAndClearExpectations(context); |
| 2828 | 2839 |
| 2829 // When done with it, a sync point should be inserted, but no produce is | 2840 // When done with it, a sync point should be inserted, but no produce is |
| 2830 // necessary. | 2841 // necessary. |
| 2831 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2842 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2832 EXPECT_CALL(*context, insertSyncPoint()); | 2843 EXPECT_CALL(*context, insertSyncPoint()); |
| 2833 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2844 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2834 | 2845 |
| 2835 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2846 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2836 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2847 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2837 } | 2848 } |
| 2838 } | 2849 } |
| 2839 | 2850 |
| 2840 TEST_P(ResourceProviderTest, | 2851 TEST_P(ResourceProviderTest, |
| 2841 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) { | 2852 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) { |
| 2842 // Mailboxing is only supported for GL textures. | 2853 // Mailboxing is only supported for GL textures. |
| 2843 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) | 2854 if (GetParam() != ResourceProvider::RESOURCE_TYPE_GL_TEXTURE) |
| 2844 return; | 2855 return; |
| 2845 | 2856 |
| 2846 scoped_ptr<TextureStateTrackingContext> context_owned( | 2857 scoped_ptr<TextureStateTrackingContext> context_owned( |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 2860 0, | 2871 0, |
| 2861 false, | 2872 false, |
| 2862 1)); | 2873 1)); |
| 2863 | 2874 |
| 2864 uint32 sync_point = 30; | 2875 uint32 sync_point = 30; |
| 2865 unsigned target = GL_TEXTURE_2D; | 2876 unsigned target = GL_TEXTURE_2D; |
| 2866 | 2877 |
| 2867 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2878 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2868 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2879 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2869 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2880 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2870 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2881 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2871 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2882 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2872 | 2883 |
| 2873 gpu::Mailbox gpu_mailbox; | 2884 gpu::Mailbox gpu_mailbox; |
| 2874 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2885 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
| 2875 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2886 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2876 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 2887 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
| 2877 | 2888 |
| 2878 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2889 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
| 2879 | 2890 |
| 2880 ResourceProvider::ResourceId id = | 2891 ResourceProvider::ResourceId id = |
| 2881 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2892 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2919 0, | 2930 0, |
| 2920 false, | 2931 false, |
| 2921 1)); | 2932 1)); |
| 2922 | 2933 |
| 2923 uint32 sync_point = 0; | 2934 uint32 sync_point = 0; |
| 2924 unsigned target = GL_TEXTURE_2D; | 2935 unsigned target = GL_TEXTURE_2D; |
| 2925 | 2936 |
| 2926 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2937 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 2927 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2938 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
| 2928 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2939 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
| 2929 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2940 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 2930 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2941 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| 2931 | 2942 |
| 2932 gpu::Mailbox gpu_mailbox; | 2943 gpu::Mailbox gpu_mailbox; |
| 2933 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2944 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
| 2934 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2945 scoped_ptr<SingleReleaseCallbackImpl> callback = |
| 2935 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); | 2946 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
| 2936 | 2947 |
| 2937 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2948 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
| 2938 | 2949 |
| 2939 ResourceProvider::ResourceId id = | 2950 ResourceProvider::ResourceId id = |
| 2940 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2951 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
| (...skipping 781 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3722 resource_provider->AllocateForTesting(id); | 3733 resource_provider->AllocateForTesting(id); |
| 3723 Mock::VerifyAndClearExpectations(context); | 3734 Mock::VerifyAndClearExpectations(context); |
| 3724 | 3735 |
| 3725 DCHECK_EQ(10u, context->PeekTextureId()); | 3736 DCHECK_EQ(10u, context->PeekTextureId()); |
| 3726 resource_provider->DeleteResource(id); | 3737 resource_provider->DeleteResource(id); |
| 3727 } | 3738 } |
| 3728 } | 3739 } |
| 3729 | 3740 |
| 3730 } // namespace | 3741 } // namespace |
| 3731 } // namespace cc | 3742 } // namespace cc |
| OLD | NEW |