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

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