Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: cc/resources/resource_provider_unittest.cc

Issue 635543002: cc: Make ResourceProvider use bindless Produce/ConsumeTextureCHROMIUM (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase + fix test expectations. Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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,
103 void(GLenum target, const GLbyte* mailbox));
104 102
105 // Force all textures to be consecutive numbers starting at "1", 103 // Force all textures to be consecutive numbers starting at "1",
106 // so we easily can test for them. 104 // so we easily can test for them.
107 GLuint NextTextureId() override { 105 GLuint NextTextureId() override {
108 base::AutoLock lock(namespace_->lock); 106 base::AutoLock lock(namespace_->lock);
109 return namespace_->next_texture_id++; 107 return namespace_->next_texture_id++;
110 } 108 }
111 void RetireTextureId(GLuint) override {} 109 void RetireTextureId(GLuint) override {}
112 }; 110 };
113 111
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 ASSERT_EQ(GLDataFormat(BoundTexture(target)->format), format); 249 ASSERT_EQ(GLDataFormat(BoundTexture(target)->format), format);
252 } 250 }
253 ASSERT_TRUE(pixels); 251 ASSERT_TRUE(pixels);
254 SetPixels(xoffset, yoffset, width, height, pixels); 252 SetPixels(xoffset, yoffset, width, height, pixels);
255 } 253 }
256 254
257 void genMailboxCHROMIUM(GLbyte* mailbox) override { 255 void genMailboxCHROMIUM(GLbyte* mailbox) override {
258 return shared_data_->GenMailbox(mailbox); 256 return shared_data_->GenMailbox(mailbox);
259 } 257 }
260 258
261 void produceTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override { 259 void produceTextureDirectCHROMIUM(GLuint texture,
262 CheckTextureIsBound(target); 260 GLenum target,
263 261 const GLbyte* mailbox) override {
264 // Delay moving the texture into the mailbox until the next 262 // Delay moving the texture into the mailbox until the next
265 // InsertSyncPoint, so that it is not visible to other contexts that 263 // InsertSyncPoint, so that it is not visible to other contexts that
266 // haven't waited on that sync point. 264 // haven't waited on that sync point.
267 scoped_ptr<PendingProduceTexture> pending(new PendingProduceTexture); 265 scoped_ptr<PendingProduceTexture> pending(new PendingProduceTexture);
268 memcpy(pending->mailbox, mailbox, sizeof(pending->mailbox)); 266 memcpy(pending->mailbox, mailbox, sizeof(pending->mailbox));
269 base::AutoLock lock_for_texture_access(namespace_->lock); 267 base::AutoLock lock_for_texture_access(namespace_->lock);
270 pending->texture = BoundTexture(target); 268 pending->texture = UnboundTexture(texture);
271 pending_produce_textures_.push_back(pending.Pass()); 269 pending_produce_textures_.push_back(pending.Pass());
272 } 270 }
273 271
274 void consumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override { 272 GLuint createAndConsumeTextureCHROMIUM(GLenum target,
275 CheckTextureIsBound(target); 273 const GLbyte* mailbox) override {
274 GLuint texture_id = createTexture();
276 base::AutoLock lock_for_texture_access(namespace_->lock); 275 base::AutoLock lock_for_texture_access(namespace_->lock);
277 scoped_refptr<TestTexture> texture = 276 scoped_refptr<TestTexture> texture =
278 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_); 277 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_);
279 namespace_->textures.Replace(BoundTextureId(target), texture); 278 namespace_->textures.Replace(texture_id, texture);
279 return texture_id;
280 }
281
282 void consumeTextureCHROMIUM(GLenum target, const GLbyte* mailbox) override {
vmiura 2015/02/04 06:29:52 Why do we need to remove the prior code? i.e. Ch
sohanjg 2015/02/05 09:50:33 Sorry for being late. no we dont need that. We won
283 base::AutoLock lock_for_texture_access(namespace_->lock);
284 scoped_refptr<TestTexture> texture =
285 shared_data_->ConsumeTexture(mailbox, last_waited_sync_point_);
280 } 286 }
281 287
282 void GetPixels(const gfx::Size& size, 288 void GetPixels(const gfx::Size& size,
283 ResourceFormat format, 289 ResourceFormat format,
284 uint8_t* pixels) { 290 uint8_t* pixels) {
285 CheckTextureIsBound(GL_TEXTURE_2D); 291 CheckTextureIsBound(GL_TEXTURE_2D);
286 base::AutoLock lock_for_texture_access(namespace_->lock); 292 base::AutoLock lock_for_texture_access(namespace_->lock);
287 scoped_refptr<TestTexture> texture = BoundTexture(GL_TEXTURE_2D); 293 scoped_refptr<TestTexture> texture = BoundTexture(GL_TEXTURE_2D);
288 ASSERT_EQ(texture->size, size); 294 ASSERT_EQ(texture->size, size);
289 ASSERT_EQ(texture->format, format); 295 ASSERT_EQ(texture->format, format);
290 memcpy(pixels, texture->data.get(), TextureSizeBytes(size, format)); 296 memcpy(pixels, texture->data.get(), TextureSizeBytes(size, format));
291 } 297 }
292 298
299 void GetPixelsForTexture(const gfx::Size& size,
300 ResourceFormat format,
301 uint8_t* pixels,
302 unsigned id) {
303 base::AutoLock lock_for_texture_access(namespace_->lock);
304 scoped_refptr<TestTexture> texture = BoundTexture(GL_TEXTURE_2D);
305 ASSERT_EQ(texture->size, size);
306 ASSERT_EQ(texture->format, format);
307 memcpy(pixels, texture->data.get(), TextureSizeBytes(size, format));
308 }
309
293 protected: 310 protected:
294 explicit ResourceProviderContext(ContextSharedData* shared_data) 311 explicit ResourceProviderContext(ContextSharedData* shared_data)
295 : shared_data_(shared_data), 312 : shared_data_(shared_data),
296 last_waited_sync_point_(0) {} 313 last_waited_sync_point_(0) {}
297 314
298 private: 315 private:
299 void AllocateTexture(const gfx::Size& size, GLenum format) { 316 void AllocateTexture(const gfx::Size& size, GLenum format) {
300 CheckTextureIsBound(GL_TEXTURE_2D); 317 CheckTextureIsBound(GL_TEXTURE_2D);
301 ResourceFormat texture_format = RGBA_8888; 318 ResourceFormat texture_format = RGBA_8888;
302 switch (format) { 319 switch (format) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
351 ResourceProvider::ResourceId id, 368 ResourceProvider::ResourceId id,
352 const gfx::Size& size, 369 const gfx::Size& size,
353 ResourceFormat format, 370 ResourceFormat format,
354 uint8_t* pixels) { 371 uint8_t* pixels) {
355 resource_provider->WaitSyncPointIfNeeded(id); 372 resource_provider->WaitSyncPointIfNeeded(id);
356 switch (resource_provider->default_resource_type()) { 373 switch (resource_provider->default_resource_type()) {
357 case ResourceProvider::GLTexture: { 374 case ResourceProvider::GLTexture: {
358 ResourceProvider::ScopedReadLockGL lock_gl(resource_provider, id); 375 ResourceProvider::ScopedReadLockGL lock_gl(resource_provider, id);
359 ASSERT_NE(0U, lock_gl.texture_id()); 376 ASSERT_NE(0U, lock_gl.texture_id());
360 context->bindTexture(GL_TEXTURE_2D, lock_gl.texture_id()); 377 context->bindTexture(GL_TEXTURE_2D, lock_gl.texture_id());
361 context->GetPixels(size, format, pixels); 378 context->GetPixelsForTexture(size, format, pixels, lock_gl.texture_id());
362 break; 379 break;
363 } 380 }
364 case ResourceProvider::Bitmap: { 381 case ResourceProvider::Bitmap: {
365 ResourceProvider::ScopedReadLockSoftware lock_software(resource_provider, 382 ResourceProvider::ScopedReadLockSoftware lock_software(resource_provider,
366 id); 383 id);
367 memcpy(pixels, 384 memcpy(pixels,
368 lock_software.sk_bitmap()->getPixels(), 385 lock_software.sk_bitmap()->getPixels(),
369 lock_software.sk_bitmap()->getSize()); 386 lock_software.sk_bitmap()->getSize());
370 break; 387 break;
371 } 388 }
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 471
455 ResourceProviderContext* context() { return context3d_; } 472 ResourceProviderContext* context() { return context3d_; }
456 473
457 ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point, 474 ResourceProvider::ResourceId CreateChildMailbox(uint32* release_sync_point,
458 bool* lost_resource, 475 bool* lost_resource,
459 bool* release_called, 476 bool* release_called,
460 uint32* sync_point) { 477 uint32* sync_point) {
461 if (GetParam() == ResourceProvider::GLTexture) { 478 if (GetParam() == ResourceProvider::GLTexture) {
462 unsigned texture = child_context_->createTexture(); 479 unsigned texture = child_context_->createTexture();
463 gpu::Mailbox gpu_mailbox; 480 gpu::Mailbox gpu_mailbox;
464 child_context_->bindTexture(GL_TEXTURE_2D, texture);
465 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); 481 child_context_->genMailboxCHROMIUM(gpu_mailbox.name);
466 child_context_->produceTextureCHROMIUM(GL_TEXTURE_2D, gpu_mailbox.name); 482 child_context_->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D,
483 gpu_mailbox.name);
467 *sync_point = child_context_->insertSyncPoint(); 484 *sync_point = child_context_->insertSyncPoint();
468 EXPECT_LT(0u, *sync_point); 485 EXPECT_LT(0u, *sync_point);
469 486
470 scoped_ptr<SharedBitmap> shared_bitmap; 487 scoped_ptr<SharedBitmap> shared_bitmap;
471 scoped_ptr<SingleReleaseCallbackImpl> callback = 488 scoped_ptr<SingleReleaseCallbackImpl> callback =
472 SingleReleaseCallbackImpl::Create(base::Bind( 489 SingleReleaseCallbackImpl::Create(base::Bind(
473 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap), 490 ReleaseSharedBitmapCallback, base::Passed(&shared_bitmap),
474 release_called, release_sync_point, lost_resource)); 491 release_called, release_sync_point, lost_resource));
475 return child_resource_provider_->CreateResourceFromTextureMailbox( 492 return child_resource_provider_->CreateResourceFromTextureMailbox(
476 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), 493 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point),
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 646
630 ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource( 647 ResourceProvider::ResourceId id3 = child_resource_provider_->CreateResource(
631 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); 648 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format);
632 { 649 {
633 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock( 650 ResourceProvider::ScopedWriteLockGpuMemoryBuffer lock(
634 child_resource_provider_.get(), id3); 651 child_resource_provider_.get(), id3);
635 EXPECT_TRUE(!!lock.GetGpuMemoryBuffer()); 652 EXPECT_TRUE(!!lock.GetGpuMemoryBuffer());
636 } 653 }
637 654
638 GLuint external_texture_id = child_context_->createExternalTexture(); 655 GLuint external_texture_id = child_context_->createExternalTexture();
639 child_context_->bindTexture(GL_TEXTURE_EXTERNAL_OES, external_texture_id);
640 656
641 gpu::Mailbox external_mailbox; 657 gpu::Mailbox external_mailbox;
642 child_context_->genMailboxCHROMIUM(external_mailbox.name); 658 child_context_->genMailboxCHROMIUM(external_mailbox.name);
643 child_context_->produceTextureCHROMIUM(GL_TEXTURE_EXTERNAL_OES, 659 child_context_->produceTextureDirectCHROMIUM(
644 external_mailbox.name); 660 external_texture_id, GL_TEXTURE_EXTERNAL_OES, external_mailbox.name);
645 const GLuint external_sync_point = child_context_->insertSyncPoint(); 661 const GLuint external_sync_point = child_context_->insertSyncPoint();
646 ResourceProvider::ResourceId id4 = 662 ResourceProvider::ResourceId id4 =
647 child_resource_provider_->CreateResourceFromTextureMailbox( 663 child_resource_provider_->CreateResourceFromTextureMailbox(
648 TextureMailbox( 664 TextureMailbox(
649 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), 665 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point),
650 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); 666 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)));
651 667
652 ReturnedResourceArray returned_to_child; 668 ReturnedResourceArray returned_to_child;
653 int child_id = 669 int child_id =
654 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); 670 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child));
(...skipping 1061 matching lines...) Expand 10 before | Expand all | Expand 10 after
1716 1732
1717 ReturnedResourceArray returned_to_child; 1733 ReturnedResourceArray returned_to_child;
1718 int child_id = parent_resource_provider->CreateChild( 1734 int child_id = parent_resource_provider->CreateChild(
1719 GetReturnCallback(&returned_to_child)); 1735 GetReturnCallback(&returned_to_child));
1720 { 1736 {
1721 // Transfer some resource to the parent. 1737 // Transfer some resource to the parent.
1722 ResourceProvider::ResourceIdArray resource_ids_to_transfer; 1738 ResourceProvider::ResourceIdArray resource_ids_to_transfer;
1723 resource_ids_to_transfer.push_back(id); 1739 resource_ids_to_transfer.push_back(id);
1724 TransferableResourceArray list; 1740 TransferableResourceArray list;
1725 1741
1726 EXPECT_CALL(*child_context, bindTexture(GL_TEXTURE_2D, child_texture_id));
1727 EXPECT_CALL(*child_context, 1742 EXPECT_CALL(*child_context,
1728 produceTextureCHROMIUM(GL_TEXTURE_2D, _)); 1743 produceTextureDirectCHROMIUM(_, GL_TEXTURE_2D, _));
1729 EXPECT_CALL(*child_context, insertSyncPoint()); 1744 EXPECT_CALL(*child_context, insertSyncPoint());
1730 child_resource_provider->PrepareSendToParent(resource_ids_to_transfer, 1745 child_resource_provider->PrepareSendToParent(resource_ids_to_transfer,
1731 &list); 1746 &list);
1732 Mock::VerifyAndClearExpectations(child_context); 1747 Mock::VerifyAndClearExpectations(child_context);
1733 1748
1734 ASSERT_EQ(1u, list.size()); 1749 ASSERT_EQ(1u, list.size());
1735 EXPECT_EQ(static_cast<unsigned>(child_filter), list[0].filter); 1750 EXPECT_EQ(static_cast<unsigned>(child_filter), list[0].filter);
1736 1751
1737 EXPECT_CALL(*parent_context,
1738 bindTexture(GL_TEXTURE_2D, parent_texture_id));
1739 EXPECT_CALL(*parent_context, consumeTextureCHROMIUM(GL_TEXTURE_2D, _));
1740 parent_resource_provider->ReceiveFromChild(child_id, list); 1752 parent_resource_provider->ReceiveFromChild(child_id, list);
1741 { 1753 {
1742 parent_resource_provider->WaitSyncPointIfNeeded(list[0].id); 1754 parent_resource_provider->WaitSyncPointIfNeeded(list[0].id);
1743 ResourceProvider::ScopedReadLockGL lock(parent_resource_provider.get(), 1755 ResourceProvider::ScopedReadLockGL lock(parent_resource_provider.get(),
1744 list[0].id); 1756 list[0].id);
1745 } 1757 }
1746 Mock::VerifyAndClearExpectations(parent_context); 1758 Mock::VerifyAndClearExpectations(parent_context);
1747 1759
1748 parent_resource_provider->DeclareUsedResourcesFromChild( 1760 parent_resource_provider->DeclareUsedResourcesFromChild(
1749 child_id, resource_ids_to_transfer); 1761 child_id, resource_ids_to_transfer);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
1813 // Other mailbox transfers tested elsewhere. 1825 // Other mailbox transfers tested elsewhere.
1814 if (GetParam() != ResourceProvider::GLTexture) 1826 if (GetParam() != ResourceProvider::GLTexture)
1815 return; 1827 return;
1816 unsigned texture = context()->createTexture(); 1828 unsigned texture = context()->createTexture();
1817 context()->bindTexture(GL_TEXTURE_2D, texture); 1829 context()->bindTexture(GL_TEXTURE_2D, texture);
1818 uint8_t data[4] = { 1, 2, 3, 4 }; 1830 uint8_t data[4] = { 1, 2, 3, 4 };
1819 context()->texImage2D( 1831 context()->texImage2D(
1820 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data); 1832 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &data);
1821 gpu::Mailbox mailbox; 1833 gpu::Mailbox mailbox;
1822 context()->genMailboxCHROMIUM(mailbox.name); 1834 context()->genMailboxCHROMIUM(mailbox.name);
1823 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1835 context()->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, mailbox.name);
1824 uint32 sync_point = context()->insertSyncPoint(); 1836 uint32 sync_point = context()->insertSyncPoint();
1825 1837
1826 // All the logic below assumes that the sync points are all positive. 1838 // All the logic below assumes that the sync points are all positive.
1827 EXPECT_LT(0u, sync_point); 1839 EXPECT_LT(0u, sync_point);
1828 1840
1829 uint32 release_sync_point = 0; 1841 uint32 release_sync_point = 0;
1830 bool lost_resource = false; 1842 bool lost_resource = false;
1831 BlockingTaskRunner* main_thread_task_runner = NULL; 1843 BlockingTaskRunner* main_thread_task_runner = NULL;
1832 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback, 1844 ReleaseCallbackImpl callback = base::Bind(ReleaseCallback,
1833 &release_sync_point, 1845 &release_sync_point,
(...skipping 13 matching lines...) Expand all
1847 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); 1859 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
1848 ASSERT_EQ(1u, list.size()); 1860 ASSERT_EQ(1u, list.size());
1849 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); 1861 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point);
1850 EXPECT_EQ(0, 1862 EXPECT_EQ(0,
1851 memcmp(mailbox.name, 1863 memcmp(mailbox.name,
1852 list[0].mailbox_holder.mailbox.name, 1864 list[0].mailbox_holder.mailbox.name,
1853 sizeof(mailbox.name))); 1865 sizeof(mailbox.name)));
1854 EXPECT_EQ(0u, release_sync_point); 1866 EXPECT_EQ(0u, release_sync_point);
1855 1867
1856 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); 1868 context()->waitSyncPoint(list[0].mailbox_holder.sync_point);
1857 unsigned other_texture = context()->createTexture(); 1869 unsigned other_texture =
1858 context()->bindTexture(GL_TEXTURE_2D, other_texture); 1870 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1859 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1860 uint8_t test_data[4] = { 0 }; 1871 uint8_t test_data[4] = { 0 };
1861 context()->GetPixels( 1872 context()->GetPixels(
1862 gfx::Size(1, 1), RGBA_8888, test_data); 1873 gfx::Size(1, 1), RGBA_8888, test_data);
1863 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); 1874 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data)));
1864 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1875
1876 context()->produceTextureDirectCHROMIUM(other_texture, GL_TEXTURE_2D,
1877 mailbox.name);
1865 context()->deleteTexture(other_texture); 1878 context()->deleteTexture(other_texture);
1866 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); 1879 list[0].mailbox_holder.sync_point = context()->insertSyncPoint();
1867 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); 1880 EXPECT_LT(0u, list[0].mailbox_holder.sync_point);
1868 1881
1869 // Receive the resource, then delete it, expect the sync points to be 1882 // Receive the resource, then delete it, expect the sync points to be
1870 // consistent. 1883 // consistent.
1871 ReturnedResourceArray returned; 1884 ReturnedResourceArray returned;
1872 TransferableResource::ReturnResources(list, &returned); 1885 TransferableResource::ReturnResources(list, &returned);
1873 resource_provider_->ReceiveReturnsFromParent(returned); 1886 resource_provider_->ReceiveReturnsFromParent(returned);
1874 EXPECT_EQ(1u, context()->NumTextures()); 1887 EXPECT_EQ(1u, context()->NumTextures());
(...skipping 23 matching lines...) Expand all
1898 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); 1911 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list);
1899 ASSERT_EQ(1u, list.size()); 1912 ASSERT_EQ(1u, list.size());
1900 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); 1913 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point);
1901 EXPECT_EQ(0, 1914 EXPECT_EQ(0,
1902 memcmp(mailbox.name, 1915 memcmp(mailbox.name,
1903 list[0].mailbox_holder.mailbox.name, 1916 list[0].mailbox_holder.mailbox.name,
1904 sizeof(mailbox.name))); 1917 sizeof(mailbox.name)));
1905 EXPECT_EQ(0u, release_sync_point); 1918 EXPECT_EQ(0u, release_sync_point);
1906 1919
1907 context()->waitSyncPoint(list[0].mailbox_holder.sync_point); 1920 context()->waitSyncPoint(list[0].mailbox_holder.sync_point);
1908 unsigned other_texture = context()->createTexture(); 1921 unsigned other_texture =
1909 context()->bindTexture(GL_TEXTURE_2D, other_texture); 1922 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1910 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1911 uint8_t test_data[4] = { 0 }; 1923 uint8_t test_data[4] = { 0 };
1912 context()->GetPixels( 1924 context()->GetPixels(
1913 gfx::Size(1, 1), RGBA_8888, test_data); 1925 gfx::Size(1, 1), RGBA_8888, test_data);
1914 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data))); 1926 EXPECT_EQ(0, memcmp(data, test_data, sizeof(data)));
1915 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1927
1928 context()->produceTextureDirectCHROMIUM(other_texture, GL_TEXTURE_2D,
1929 mailbox.name);
1916 context()->deleteTexture(other_texture); 1930 context()->deleteTexture(other_texture);
1917 list[0].mailbox_holder.sync_point = context()->insertSyncPoint(); 1931 list[0].mailbox_holder.sync_point = context()->insertSyncPoint();
1918 EXPECT_LT(0u, list[0].mailbox_holder.sync_point); 1932 EXPECT_LT(0u, list[0].mailbox_holder.sync_point);
1919 1933
1920 // Delete the resource, which shouldn't do anything. 1934 // Delete the resource, which shouldn't do anything.
1921 resource_provider_->DeleteResource(resource); 1935 resource_provider_->DeleteResource(resource);
1922 EXPECT_EQ(1u, context()->NumTextures()); 1936 EXPECT_EQ(1u, context()->NumTextures());
1923 EXPECT_EQ(0u, release_sync_point); 1937 EXPECT_EQ(0u, release_sync_point);
1924 1938
1925 // Then receive the resource which should release the mailbox, expect the 1939 // Then receive the resource which should release the mailbox, expect the
1926 // sync points to be consistent. 1940 // sync points to be consistent.
1927 ReturnedResourceArray returned; 1941 ReturnedResourceArray returned;
1928 TransferableResource::ReturnResources(list, &returned); 1942 TransferableResource::ReturnResources(list, &returned);
1929 resource_provider_->ReceiveReturnsFromParent(returned); 1943 resource_provider_->ReceiveReturnsFromParent(returned);
1930 EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point); 1944 EXPECT_LE(list[0].mailbox_holder.sync_point, release_sync_point);
1931 EXPECT_FALSE(lost_resource); 1945 EXPECT_FALSE(lost_resource);
1932 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner); 1946 EXPECT_EQ(main_thread_task_runner_.get(), main_thread_task_runner);
1933 } 1947 }
1934 1948
1935 context()->waitSyncPoint(release_sync_point); 1949 context()->waitSyncPoint(release_sync_point);
1936 context()->bindTexture(GL_TEXTURE_2D, texture); 1950 texture =
1937 context()->consumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 1951 context()->createAndConsumeTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name);
1938 context()->deleteTexture(texture); 1952 context()->deleteTexture(texture);
1939 } 1953 }
1940 1954
1941 TEST_P(ResourceProviderTest, LostResourceInParent) { 1955 TEST_P(ResourceProviderTest, LostResourceInParent) {
1942 gfx::Size size(1, 1); 1956 gfx::Size size(1, 1);
1943 ResourceFormat format = RGBA_8888; 1957 ResourceFormat format = RGBA_8888;
1944 ResourceProvider::ResourceId resource = 1958 ResourceProvider::ResourceId resource =
1945 child_resource_provider_->CreateResource( 1959 child_resource_provider_->CreateResource(
1946 size, 1960 size,
1947 GL_CLAMP_TO_EDGE, 1961 GL_CLAMP_TO_EDGE,
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
2237 } 2251 }
2238 2252
2239 TEST_P(ResourceProviderTest, LostContext) { 2253 TEST_P(ResourceProviderTest, LostContext) {
2240 // TextureMailbox callbacks only exist for GL textures for now. 2254 // TextureMailbox callbacks only exist for GL textures for now.
2241 if (GetParam() != ResourceProvider::GLTexture) 2255 if (GetParam() != ResourceProvider::GLTexture)
2242 return; 2256 return;
2243 unsigned texture = context()->createTexture(); 2257 unsigned texture = context()->createTexture();
2244 context()->bindTexture(GL_TEXTURE_2D, texture); 2258 context()->bindTexture(GL_TEXTURE_2D, texture);
2245 gpu::Mailbox mailbox; 2259 gpu::Mailbox mailbox;
2246 context()->genMailboxCHROMIUM(mailbox.name); 2260 context()->genMailboxCHROMIUM(mailbox.name);
2247 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); 2261 context()->produceTextureDirectCHROMIUM(texture, GL_TEXTURE_2D, mailbox.name);
2248 uint32 sync_point = context()->insertSyncPoint(); 2262 uint32 sync_point = context()->insertSyncPoint();
2249 2263
2250 EXPECT_LT(0u, sync_point); 2264 EXPECT_LT(0u, sync_point);
2251 2265
2252 uint32 release_sync_point = 0; 2266 uint32 release_sync_point = 0;
2253 bool lost_resource = false; 2267 bool lost_resource = false;
2254 BlockingTaskRunner* main_thread_task_runner = NULL; 2268 BlockingTaskRunner* main_thread_task_runner = NULL;
2255 scoped_ptr<SingleReleaseCallbackImpl> callback = 2269 scoped_ptr<SingleReleaseCallbackImpl> callback =
2256 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback, 2270 SingleReleaseCallbackImpl::Create(base::Bind(ReleaseCallback,
2257 &release_sync_point, 2271 &release_sync_point,
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
2617 2631
2618 scoped_ptr<ResourceProvider> resource_provider( 2632 scoped_ptr<ResourceProvider> resource_provider(
2619 ResourceProvider::Create(output_surface.get(), 2633 ResourceProvider::Create(output_surface.get(),
2620 shared_bitmap_manager, 2634 shared_bitmap_manager,
2621 gpu_memory_buffer_manager, 2635 gpu_memory_buffer_manager,
2622 main_thread_task_runner, 2636 main_thread_task_runner,
2623 0, 2637 0,
2624 false, 2638 false,
2625 1)); 2639 1));
2626 2640
2627 unsigned texture_id = 1;
2628 uint32 sync_point = 30; 2641 uint32 sync_point = 30;
2629 unsigned target = GL_TEXTURE_2D; 2642 unsigned target = GL_TEXTURE_2D;
2630 2643
2631 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2644 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2632 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2645 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2633 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2646 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2634 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2647 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2635 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
2636 2648
2637 gpu::Mailbox gpu_mailbox; 2649 gpu::Mailbox gpu_mailbox;
2638 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); 2650 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
2639 uint32 release_sync_point = 0; 2651 uint32 release_sync_point = 0;
2640 bool lost_resource = false; 2652 bool lost_resource = false;
2641 BlockingTaskRunner* mailbox_task_runner = NULL; 2653 BlockingTaskRunner* mailbox_task_runner = NULL;
2642 scoped_ptr<SingleReleaseCallbackImpl> callback = 2654 scoped_ptr<SingleReleaseCallbackImpl> callback =
2643 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, 2655 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback,
2644 &release_sync_point, 2656 &release_sync_point,
2645 &lost_resource, 2657 &lost_resource,
2646 &mailbox_task_runner)); 2658 &mailbox_task_runner));
2647 2659
2648 TextureMailbox mailbox(gpu_mailbox, target, sync_point); 2660 TextureMailbox mailbox(gpu_mailbox, target, sync_point);
2649 mailbox.set_nearest_neighbor(mailbox_nearest_neighbor); 2661 mailbox.set_nearest_neighbor(mailbox_nearest_neighbor);
2650 2662
2651 ResourceProvider::ResourceId id = 2663 ResourceProvider::ResourceId id =
2652 resource_provider->CreateResourceFromTextureMailbox(mailbox, 2664 resource_provider->CreateResourceFromTextureMailbox(mailbox,
2653 callback.Pass()); 2665 callback.Pass());
2654 EXPECT_NE(0u, id); 2666 EXPECT_NE(0u, id);
2655 2667
2656 Mock::VerifyAndClearExpectations(context); 2668 Mock::VerifyAndClearExpectations(context);
2657 2669
2658 { 2670 {
2659 // Mailbox sync point WaitSyncPoint before using the texture. 2671 // Mailbox sync point WaitSyncPoint before using the texture.
2660 EXPECT_CALL(*context, waitSyncPoint(sync_point)); 2672 EXPECT_CALL(*context, waitSyncPoint(sync_point));
2661 resource_provider->WaitSyncPointIfNeeded(id); 2673 resource_provider->WaitSyncPointIfNeeded(id);
2662 Mock::VerifyAndClearExpectations(context); 2674 Mock::VerifyAndClearExpectations(context);
2663 2675
2664 // Using the texture does a consume of the mailbox.
2665 EXPECT_CALL(*context, bindTexture(target, texture_id)).Times(2);
2666 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _));
2667
2668 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2676 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2669 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2677 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2670 2678
2671 // The sampler will reset these if |mailbox_nearest_neighbor| does not 2679 // The sampler will reset these if |mailbox_nearest_neighbor| does not
2672 // match |sampler_filter|. 2680 // match |sampler_filter|.
2673 if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) { 2681 if (mailbox_nearest_neighbor != (sampler_filter == GL_NEAREST)) {
2674 EXPECT_CALL(*context, texParameteri( 2682 EXPECT_CALL(*context, texParameteri(
2675 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter)); 2683 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, sampler_filter));
2676 EXPECT_CALL(*context, texParameteri( 2684 EXPECT_CALL(*context, texParameteri(
2677 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter)); 2685 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, sampler_filter));
2678 } 2686 }
2679 2687
2680 ResourceProvider::ScopedSamplerGL lock( 2688 ResourceProvider::ScopedSamplerGL lock(
2681 resource_provider.get(), id, sampler_filter); 2689 resource_provider.get(), id, sampler_filter);
2682 Mock::VerifyAndClearExpectations(context); 2690 Mock::VerifyAndClearExpectations(context);
2683 2691
2684 // When done with it, a sync point should be inserted, but no produce is 2692 // When done with it, a sync point should be inserted, but no produce is
2685 // necessary. 2693 // necessary.
2686 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2694 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2687 EXPECT_CALL(*context, insertSyncPoint()); 2695 EXPECT_CALL(*context, insertSyncPoint());
2688 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2696 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2689 2697
2690 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2698 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2691 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
2692 } 2699 }
2693 2700
2694 resource_provider->DeleteResource(id); 2701 resource_provider->DeleteResource(id);
2695 EXPECT_EQ(0u, release_sync_point); 2702 EXPECT_EQ(0u, release_sync_point);
2696 EXPECT_FALSE(lost_resource); 2703 EXPECT_FALSE(lost_resource);
2697 EXPECT_EQ(main_thread_task_runner, mailbox_task_runner); 2704 EXPECT_EQ(main_thread_task_runner, mailbox_task_runner);
2698 } 2705 }
2699 }; 2706 };
2700 2707
2701 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) { 2708 TEST_P(ResourceProviderTest, TextureMailbox_GLTexture2D_LinearToLinear) {
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
2766 2773
2767 scoped_ptr<ResourceProvider> resource_provider( 2774 scoped_ptr<ResourceProvider> resource_provider(
2768 ResourceProvider::Create(output_surface.get(), 2775 ResourceProvider::Create(output_surface.get(),
2769 shared_bitmap_manager_.get(), 2776 shared_bitmap_manager_.get(),
2770 gpu_memory_buffer_manager_.get(), 2777 gpu_memory_buffer_manager_.get(),
2771 NULL, 2778 NULL,
2772 0, 2779 0,
2773 false, 2780 false,
2774 1)); 2781 1));
2775 2782
2776 unsigned texture_id = 1;
2777 uint32 sync_point = 30; 2783 uint32 sync_point = 30;
2778 unsigned target = GL_TEXTURE_EXTERNAL_OES; 2784 unsigned target = GL_TEXTURE_EXTERNAL_OES;
2779 2785
2780 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2786 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2781 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2787 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2782 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2788 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2783 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2789 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2784 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
2785 2790
2786 gpu::Mailbox gpu_mailbox; 2791 gpu::Mailbox gpu_mailbox;
2787 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); 2792 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
2788 scoped_ptr<SingleReleaseCallbackImpl> callback = 2793 scoped_ptr<SingleReleaseCallbackImpl> callback =
2789 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); 2794 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback));
2790 2795
2791 TextureMailbox mailbox(gpu_mailbox, target, sync_point); 2796 TextureMailbox mailbox(gpu_mailbox, target, sync_point);
2792 2797
2793 ResourceProvider::ResourceId id = 2798 ResourceProvider::ResourceId id =
2794 resource_provider->CreateResourceFromTextureMailbox( 2799 resource_provider->CreateResourceFromTextureMailbox(
2795 mailbox, callback.Pass()); 2800 mailbox, callback.Pass());
2796 EXPECT_NE(0u, id); 2801 EXPECT_NE(0u, id);
2797 2802
2798 Mock::VerifyAndClearExpectations(context); 2803 Mock::VerifyAndClearExpectations(context);
2799 2804
2800 { 2805 {
2801 // Mailbox sync point WaitSyncPoint before using the texture. 2806 // Mailbox sync point WaitSyncPoint before using the texture.
2802 EXPECT_CALL(*context, waitSyncPoint(sync_point)); 2807 EXPECT_CALL(*context, waitSyncPoint(sync_point));
2803 resource_provider->WaitSyncPointIfNeeded(id); 2808 resource_provider->WaitSyncPointIfNeeded(id);
2804 Mock::VerifyAndClearExpectations(context); 2809 Mock::VerifyAndClearExpectations(context);
2805 2810
2806 // Using the texture does a consume of the mailbox.
2807 EXPECT_CALL(*context, bindTexture(target, texture_id));
2808 EXPECT_CALL(*context, consumeTextureCHROMIUM(target, _));
2809
2810 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2811 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2811 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2812 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2812 2813
2813 ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id); 2814 ResourceProvider::ScopedReadLockGL lock(resource_provider.get(), id);
2814 Mock::VerifyAndClearExpectations(context); 2815 Mock::VerifyAndClearExpectations(context);
2815 2816
2816 // When done with it, a sync point should be inserted, but no produce is 2817 // When done with it, a sync point should be inserted, but no produce is
2817 // necessary. 2818 // necessary.
2818 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2819 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2819 EXPECT_CALL(*context, insertSyncPoint()); 2820 EXPECT_CALL(*context, insertSyncPoint());
2820 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2821 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2821 2822
2822 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2823 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2823 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
2824 } 2824 }
2825 } 2825 }
2826 2826
2827 TEST_P(ResourceProviderTest, 2827 TEST_P(ResourceProviderTest,
2828 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) { 2828 TextureMailbox_WaitSyncPointIfNeeded_WithSyncPoint) {
2829 // Mailboxing is only supported for GL textures. 2829 // Mailboxing is only supported for GL textures.
2830 if (GetParam() != ResourceProvider::GLTexture) 2830 if (GetParam() != ResourceProvider::GLTexture)
2831 return; 2831 return;
2832 2832
2833 scoped_ptr<TextureStateTrackingContext> context_owned( 2833 scoped_ptr<TextureStateTrackingContext> context_owned(
(...skipping 13 matching lines...) Expand all
2847 0, 2847 0,
2848 false, 2848 false,
2849 1)); 2849 1));
2850 2850
2851 uint32 sync_point = 30; 2851 uint32 sync_point = 30;
2852 unsigned target = GL_TEXTURE_2D; 2852 unsigned target = GL_TEXTURE_2D;
2853 2853
2854 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2854 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2855 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2855 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2856 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2856 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2857 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2857 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2858 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
2859 2858
2860 gpu::Mailbox gpu_mailbox; 2859 gpu::Mailbox gpu_mailbox;
2861 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); 2860 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
2862 scoped_ptr<SingleReleaseCallbackImpl> callback = 2861 scoped_ptr<SingleReleaseCallbackImpl> callback =
2863 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); 2862 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback));
2864 2863
2865 TextureMailbox mailbox(gpu_mailbox, target, sync_point); 2864 TextureMailbox mailbox(gpu_mailbox, target, sync_point);
2866 2865
2867 ResourceProvider::ResourceId id = 2866 ResourceProvider::ResourceId id =
2868 resource_provider->CreateResourceFromTextureMailbox(mailbox, 2867 resource_provider->CreateResourceFromTextureMailbox(mailbox,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
2906 0, 2905 0,
2907 false, 2906 false,
2908 1)); 2907 1));
2909 2908
2910 uint32 sync_point = 0; 2909 uint32 sync_point = 0;
2911 unsigned target = GL_TEXTURE_2D; 2910 unsigned target = GL_TEXTURE_2D;
2912 2911
2913 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); 2912 EXPECT_CALL(*context, bindTexture(_, _)).Times(0);
2914 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); 2913 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0);
2915 EXPECT_CALL(*context, insertSyncPoint()).Times(0); 2914 EXPECT_CALL(*context, insertSyncPoint()).Times(0);
2916 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); 2915 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0);
2917 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0);
2918 2916
2919 gpu::Mailbox gpu_mailbox; 2917 gpu::Mailbox gpu_mailbox;
2920 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); 2918 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1);
2921 scoped_ptr<SingleReleaseCallbackImpl> callback = 2919 scoped_ptr<SingleReleaseCallbackImpl> callback =
2922 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); 2920 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback));
2923 2921
2924 TextureMailbox mailbox(gpu_mailbox, target, sync_point); 2922 TextureMailbox mailbox(gpu_mailbox, target, sync_point);
2925 2923
2926 ResourceProvider::ResourceId id = 2924 ResourceProvider::ResourceId id =
2927 resource_provider->CreateResourceFromTextureMailbox(mailbox, 2925 resource_provider->CreateResourceFromTextureMailbox(mailbox,
(...skipping 777 matching lines...) Expand 10 before | Expand all | Expand 10 after
3705 resource_provider->AllocateForTesting(id); 3703 resource_provider->AllocateForTesting(id);
3706 Mock::VerifyAndClearExpectations(context); 3704 Mock::VerifyAndClearExpectations(context);
3707 3705
3708 DCHECK_EQ(10u, context->PeekTextureId()); 3706 DCHECK_EQ(10u, context->PeekTextureId());
3709 resource_provider->DeleteResource(id); 3707 resource_provider->DeleteResource(id);
3710 } 3708 }
3711 } 3709 }
3712 3710
3713 } // namespace 3711 } // namespace
3714 } // namespace cc 3712 } // namespace cc
OLDNEW
« no previous file with comments | « cc/resources/resource_provider.cc ('k') | cc/test/test_web_graphics_context_3d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698