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 |
11 #include "base/bind.h" | 11 #include "base/bind.h" |
12 #include "base/containers/hash_tables.h" | 12 #include "base/containers/hash_tables.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/ref_counted.h" | 14 #include "base/memory/ref_counted.h" |
15 #include "cc/base/scoped_ptr_deque.h" | 15 #include "cc/base/scoped_ptr_deque.h" |
16 #include "cc/output/output_surface.h" | 16 #include "cc/output/output_surface.h" |
17 #include "cc/resources/returned_resource.h" | 17 #include "cc/resources/returned_resource.h" |
18 #include "cc/resources/shared_bitmap_manager.h" | 18 #include "cc/resources/shared_bitmap_manager.h" |
19 #include "cc/resources/single_release_callback.h" | 19 #include "cc/resources/single_release_callback.h" |
20 #include "cc/test/fake_output_surface.h" | 20 #include "cc/test/fake_output_surface.h" |
21 #include "cc/test/fake_output_surface_client.h" | 21 #include "cc/test/fake_output_surface_client.h" |
22 #include "cc/test/test_shared_bitmap_manager.h" | 22 #include "cc/test/test_shared_bitmap_manager.h" |
23 #include "cc/test/test_texture.h" | 23 #include "cc/test/test_texture.h" |
24 #include "cc/test/test_web_graphics_context_3d.h" | 24 #include "cc/test/test_web_graphics_context_3d.h" |
| 25 #include "cc/trees/blocking_task_runner.h" |
25 #include "gpu/GLES2/gl2extchromium.h" | 26 #include "gpu/GLES2/gl2extchromium.h" |
26 #include "testing/gmock/include/gmock/gmock.h" | 27 #include "testing/gmock/include/gmock/gmock.h" |
27 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
28 #include "third_party/khronos/GLES2/gl2.h" | 29 #include "third_party/khronos/GLES2/gl2.h" |
29 #include "third_party/khronos/GLES2/gl2ext.h" | 30 #include "third_party/khronos/GLES2/gl2ext.h" |
30 #include "ui/gfx/rect.h" | 31 #include "ui/gfx/rect.h" |
31 | 32 |
32 using testing::Mock; | 33 using testing::Mock; |
33 using testing::NiceMock; | 34 using testing::NiceMock; |
34 using testing::Return; | 35 using testing::Return; |
35 using testing::SetArgPointee; | 36 using testing::SetArgPointee; |
36 using testing::StrictMock; | 37 using testing::StrictMock; |
37 using testing::_; | 38 using testing::_; |
38 | 39 |
39 namespace cc { | 40 namespace cc { |
40 namespace { | 41 namespace { |
41 | 42 |
42 static void EmptyReleaseCallback(uint32 sync_point, bool lost_resource) {} | 43 static void EmptyReleaseCallback( |
| 44 uint32 sync_point, |
| 45 bool lost_resource, |
| 46 scoped_refptr<BlockingTaskRunner> main_thread_task_runner) { |
| 47 } |
43 | 48 |
44 static void SharedMemoryReleaseCallback(scoped_ptr<base::SharedMemory> memory, | 49 static void SharedMemoryReleaseCallback( |
45 uint32 sync_point, | 50 scoped_ptr<base::SharedMemory> memory, |
46 bool lost_resource) {} | 51 uint32 sync_point, |
| 52 bool lost_resource, |
| 53 scoped_refptr<BlockingTaskRunner> main_thread_task_runner) { |
| 54 } |
47 | 55 |
48 static void ReleaseTextureMailbox(uint32* release_sync_point, | 56 static void ReleaseTextureMailbox( |
49 bool* release_lost_resource, | 57 uint32* release_sync_point, |
50 uint32 sync_point, | 58 bool* release_lost_resource, |
51 bool lost_resource) { | 59 uint32 sync_point, |
| 60 bool lost_resource, |
| 61 scoped_refptr<BlockingTaskRunner> main_thread_task_runner) { |
52 *release_sync_point = sync_point; | 62 *release_sync_point = sync_point; |
53 *release_lost_resource = lost_resource; | 63 *release_lost_resource = lost_resource; |
54 } | 64 } |
55 | 65 |
56 static void ReleaseSharedMemoryCallback( | 66 static void ReleaseSharedMemoryCallback( |
57 scoped_ptr<base::SharedMemory> shared_memory, | 67 scoped_ptr<base::SharedMemory> shared_memory, |
58 bool* release_called, | 68 bool* release_called, |
59 uint32* release_sync_point, | 69 uint32* release_sync_point, |
60 bool* lost_resource_result, | 70 bool* lost_resource_result, |
61 uint32 sync_point, | 71 uint32 sync_point, |
62 bool lost_resource) { | 72 bool lost_resource, |
| 73 scoped_refptr<BlockingTaskRunner> main_thread_task_runner) { |
63 *release_called = true; | 74 *release_called = true; |
64 *release_sync_point = sync_point; | 75 *release_sync_point = sync_point; |
65 *lost_resource_result = lost_resource; | 76 *lost_resource_result = lost_resource; |
66 } | 77 } |
67 | 78 |
68 static scoped_ptr<base::SharedMemory> CreateAndFillSharedMemory( | 79 static scoped_ptr<base::SharedMemory> CreateAndFillSharedMemory( |
69 const gfx::Size& size, | 80 const gfx::Size& size, |
70 uint32_t value) { | 81 uint32_t value) { |
71 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); | 82 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory); |
72 CHECK(shared_memory->CreateAndMapAnonymous(4 * size.GetArea())); | 83 CHECK(shared_memory->CreateAndMapAnonymous(4 * size.GetArea())); |
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
396 break; | 407 break; |
397 case ResourceProvider::InvalidType: | 408 case ResourceProvider::InvalidType: |
398 NOTREACHED(); | 409 NOTREACHED(); |
399 break; | 410 break; |
400 } | 411 } |
401 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 412 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
402 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); | 413 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); |
403 | 414 |
404 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); | 415 shared_bitmap_manager_.reset(new TestSharedBitmapManager()); |
405 | 416 |
406 resource_provider_ = ResourceProvider::Create( | 417 resource_provider_ = ResourceProvider::Create(output_surface_.get(), |
407 output_surface_.get(), shared_bitmap_manager_.get(), 0, false, 1, | 418 shared_bitmap_manager_.get(), |
408 false); | 419 NULL, |
409 child_resource_provider_ = ResourceProvider::Create( | 420 0, |
410 child_output_surface_.get(), | 421 false, |
411 shared_bitmap_manager_.get(), | 422 1, |
412 0, | 423 false); |
413 false, | 424 child_resource_provider_ = |
414 1, | 425 ResourceProvider::Create(child_output_surface_.get(), |
415 false); | 426 shared_bitmap_manager_.get(), |
| 427 NULL, |
| 428 0, |
| 429 false, |
| 430 1, |
| 431 false); |
416 } | 432 } |
417 | 433 |
418 static void CollectResources(ReturnedResourceArray* array, | 434 static void CollectResources( |
419 const ReturnedResourceArray& returned) { | 435 ReturnedResourceArray* array, |
| 436 const ReturnedResourceArray& returned, |
| 437 scoped_refptr<BlockingTaskRunner> main_thread_task_runner) { |
420 array->insert(array->end(), returned.begin(), returned.end()); | 438 array->insert(array->end(), returned.begin(), returned.end()); |
421 } | 439 } |
422 | 440 |
423 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { | 441 static ReturnCallback GetReturnCallback(ReturnedResourceArray* array) { |
424 return base::Bind(&ResourceProviderTest::CollectResources, array); | 442 return base::Bind(&ResourceProviderTest::CollectResources, array); |
425 } | 443 } |
426 | 444 |
427 static void SetResourceFilter(ResourceProvider* resource_provider, | 445 static void SetResourceFilter(ResourceProvider* resource_provider, |
428 ResourceProvider::ResourceId id, | 446 ResourceProvider::ResourceId id, |
429 GLenum filter) { | 447 GLenum filter) { |
(...skipping 10 matching lines...) Expand all Loading... |
440 if (GetParam() == ResourceProvider::GLTexture) { | 458 if (GetParam() == ResourceProvider::GLTexture) { |
441 unsigned texture = child_context_->createTexture(); | 459 unsigned texture = child_context_->createTexture(); |
442 gpu::Mailbox gpu_mailbox; | 460 gpu::Mailbox gpu_mailbox; |
443 child_context_->bindTexture(GL_TEXTURE_2D, texture); | 461 child_context_->bindTexture(GL_TEXTURE_2D, texture); |
444 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); | 462 child_context_->genMailboxCHROMIUM(gpu_mailbox.name); |
445 child_context_->produceTextureCHROMIUM(GL_TEXTURE_2D, gpu_mailbox.name); | 463 child_context_->produceTextureCHROMIUM(GL_TEXTURE_2D, gpu_mailbox.name); |
446 *sync_point = child_context_->insertSyncPoint(); | 464 *sync_point = child_context_->insertSyncPoint(); |
447 EXPECT_LT(0u, *sync_point); | 465 EXPECT_LT(0u, *sync_point); |
448 | 466 |
449 scoped_ptr<base::SharedMemory> shared_memory; | 467 scoped_ptr<base::SharedMemory> shared_memory; |
450 scoped_ptr<SingleReleaseCallback> callback = | 468 scoped_ptr<SingleReleaseCallbackImpl> callback = |
451 SingleReleaseCallback::Create(base::Bind(ReleaseSharedMemoryCallback, | 469 SingleReleaseCallbackImpl::Create( |
452 base::Passed(&shared_memory), | 470 base::Bind(ReleaseSharedMemoryCallback, |
453 release_called, | 471 base::Passed(&shared_memory), |
454 release_sync_point, | 472 release_called, |
455 lost_resource)); | 473 release_sync_point, |
| 474 lost_resource)); |
456 return child_resource_provider_->CreateResourceFromTextureMailbox( | 475 return child_resource_provider_->CreateResourceFromTextureMailbox( |
457 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), | 476 TextureMailbox(gpu_mailbox, GL_TEXTURE_2D, *sync_point), |
458 callback.Pass()); | 477 callback.Pass()); |
459 } else { | 478 } else { |
460 gfx::Size size(64, 64); | 479 gfx::Size size(64, 64); |
461 scoped_ptr<base::SharedMemory> shared_memory( | 480 scoped_ptr<base::SharedMemory> shared_memory( |
462 CreateAndFillSharedMemory(size, 0)); | 481 CreateAndFillSharedMemory(size, 0)); |
463 | 482 |
464 base::SharedMemory* shared_memory_ptr = shared_memory.get(); | 483 base::SharedMemory* shared_memory_ptr = shared_memory.get(); |
465 scoped_ptr<SingleReleaseCallback> callback = | 484 scoped_ptr<SingleReleaseCallbackImpl> callback = |
466 SingleReleaseCallback::Create(base::Bind(ReleaseSharedMemoryCallback, | 485 SingleReleaseCallbackImpl::Create( |
467 base::Passed(&shared_memory), | 486 base::Bind(ReleaseSharedMemoryCallback, |
468 release_called, | 487 base::Passed(&shared_memory), |
469 release_sync_point, | 488 release_called, |
470 lost_resource)); | 489 release_sync_point, |
| 490 lost_resource)); |
471 return child_resource_provider_->CreateResourceFromTextureMailbox( | 491 return child_resource_provider_->CreateResourceFromTextureMailbox( |
472 TextureMailbox(shared_memory_ptr, size), callback.Pass()); | 492 TextureMailbox(shared_memory_ptr, size), callback.Pass()); |
473 } | 493 } |
474 } | 494 } |
475 | 495 |
476 protected: | 496 protected: |
477 scoped_ptr<ContextSharedData> shared_data_; | 497 scoped_ptr<ContextSharedData> shared_data_; |
478 ResourceProviderContext* context3d_; | 498 ResourceProviderContext* context3d_; |
479 ResourceProviderContext* child_context_; | 499 ResourceProviderContext* child_context_; |
480 FakeOutputSurfaceClient output_surface_client_; | 500 FakeOutputSurfaceClient output_surface_client_; |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 | 638 |
619 gpu::Mailbox external_mailbox; | 639 gpu::Mailbox external_mailbox; |
620 child_context_->genMailboxCHROMIUM(external_mailbox.name); | 640 child_context_->genMailboxCHROMIUM(external_mailbox.name); |
621 child_context_->produceTextureCHROMIUM(GL_TEXTURE_EXTERNAL_OES, | 641 child_context_->produceTextureCHROMIUM(GL_TEXTURE_EXTERNAL_OES, |
622 external_mailbox.name); | 642 external_mailbox.name); |
623 const GLuint external_sync_point = child_context_->insertSyncPoint(); | 643 const GLuint external_sync_point = child_context_->insertSyncPoint(); |
624 ResourceProvider::ResourceId id4 = | 644 ResourceProvider::ResourceId id4 = |
625 child_resource_provider_->CreateResourceFromTextureMailbox( | 645 child_resource_provider_->CreateResourceFromTextureMailbox( |
626 TextureMailbox( | 646 TextureMailbox( |
627 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), | 647 external_mailbox, GL_TEXTURE_EXTERNAL_OES, external_sync_point), |
628 SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback))); | 648 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback))); |
629 | 649 |
630 ReturnedResourceArray returned_to_child; | 650 ReturnedResourceArray returned_to_child; |
631 int child_id = | 651 int child_id = |
632 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); | 652 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); |
633 { | 653 { |
634 // Transfer some resources to the parent. | 654 // Transfer some resources to the parent. |
635 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 655 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
636 resource_ids_to_transfer.push_back(id1); | 656 resource_ids_to_transfer.push_back(id1); |
637 resource_ids_to_transfer.push_back(id2); | 657 resource_ids_to_transfer.push_back(id2); |
638 resource_ids_to_transfer.push_back(id3); | 658 resource_ids_to_transfer.push_back(id3); |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 } | 905 } |
886 | 906 |
887 TEST_P(ResourceProviderTest, AllowOverlayTransfersToParent) { | 907 TEST_P(ResourceProviderTest, AllowOverlayTransfersToParent) { |
888 // Overlays only supported on the GL path. | 908 // Overlays only supported on the GL path. |
889 if (GetParam() != ResourceProvider::GLTexture) | 909 if (GetParam() != ResourceProvider::GLTexture) |
890 return; | 910 return; |
891 | 911 |
892 uint32 sync_point = 0; | 912 uint32 sync_point = 0; |
893 TextureMailbox mailbox(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); | 913 TextureMailbox mailbox(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); |
894 mailbox.set_allow_overlay(true); | 914 mailbox.set_allow_overlay(true); |
895 scoped_ptr<SingleReleaseCallback> release_callback = | 915 scoped_ptr<SingleReleaseCallbackImpl> release_callback = |
896 SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback)); | 916 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
897 ResourceProvider::ResourceId id1 = | 917 ResourceProvider::ResourceId id1 = |
898 child_resource_provider_->CreateResourceFromTextureMailbox( | 918 child_resource_provider_->CreateResourceFromTextureMailbox( |
899 mailbox, release_callback.Pass()); | 919 mailbox, release_callback.Pass()); |
900 | 920 |
901 TextureMailbox mailbox2(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); | 921 TextureMailbox mailbox2(gpu::Mailbox::Generate(), GL_TEXTURE_2D, sync_point); |
902 mailbox2.set_allow_overlay(false); | 922 mailbox2.set_allow_overlay(false); |
903 scoped_ptr<SingleReleaseCallback> release_callback2 = | 923 scoped_ptr<SingleReleaseCallbackImpl> release_callback2 = |
904 SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback)); | 924 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
905 ResourceProvider::ResourceId id2 = | 925 ResourceProvider::ResourceId id2 = |
906 child_resource_provider_->CreateResourceFromTextureMailbox( | 926 child_resource_provider_->CreateResourceFromTextureMailbox( |
907 mailbox2, release_callback2.Pass()); | 927 mailbox2, release_callback2.Pass()); |
908 | 928 |
909 ReturnedResourceArray returned_to_child; | 929 ReturnedResourceArray returned_to_child; |
910 int child_id = | 930 int child_id = |
911 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); | 931 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); |
912 | 932 |
913 // Transfer some resources to the parent. | 933 // Transfer some resources to the parent. |
914 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 934 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
966 raster_buffer->ReleaseSkCanvas(canvas); | 986 raster_buffer->ReleaseSkCanvas(canvas); |
967 canvas.clear(); | 987 canvas.clear(); |
968 child_resource_provider_->ReleaseImageRasterBuffer(id3); | 988 child_resource_provider_->ReleaseImageRasterBuffer(id3); |
969 | 989 |
970 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); | 990 scoped_ptr<base::SharedMemory> shared_memory(new base::SharedMemory()); |
971 shared_memory->CreateAndMapAnonymous(1); | 991 shared_memory->CreateAndMapAnonymous(1); |
972 base::SharedMemory* shared_memory_ptr = shared_memory.get(); | 992 base::SharedMemory* shared_memory_ptr = shared_memory.get(); |
973 ResourceProvider::ResourceId id4 = | 993 ResourceProvider::ResourceId id4 = |
974 child_resource_provider_->CreateResourceFromTextureMailbox( | 994 child_resource_provider_->CreateResourceFromTextureMailbox( |
975 TextureMailbox(shared_memory_ptr, gfx::Size(1, 1)), | 995 TextureMailbox(shared_memory_ptr, gfx::Size(1, 1)), |
976 SingleReleaseCallback::Create(base::Bind( | 996 SingleReleaseCallbackImpl::Create(base::Bind( |
977 &SharedMemoryReleaseCallback, base::Passed(&shared_memory)))); | 997 &SharedMemoryReleaseCallback, base::Passed(&shared_memory)))); |
978 | 998 |
979 ReturnedResourceArray returned_to_child; | 999 ReturnedResourceArray returned_to_child; |
980 int child_id = | 1000 int child_id = |
981 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); | 1001 resource_provider_->CreateChild(GetReturnCallback(&returned_to_child)); |
982 { | 1002 { |
983 // Transfer some resources to the parent. | 1003 // Transfer some resources to the parent. |
984 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 1004 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
985 resource_ids_to_transfer.push_back(id1); | 1005 resource_ids_to_transfer.push_back(id1); |
986 resource_ids_to_transfer.push_back(id2); | 1006 resource_ids_to_transfer.push_back(id2); |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1168 return; | 1188 return; |
1169 | 1189 |
1170 scoped_ptr<ResourceProviderContext> child_context_owned( | 1190 scoped_ptr<ResourceProviderContext> child_context_owned( |
1171 ResourceProviderContext::Create(shared_data_.get())); | 1191 ResourceProviderContext::Create(shared_data_.get())); |
1172 | 1192 |
1173 FakeOutputSurfaceClient child_output_surface_client; | 1193 FakeOutputSurfaceClient child_output_surface_client; |
1174 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( | 1194 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( |
1175 child_context_owned.PassAs<TestWebGraphicsContext3D>())); | 1195 child_context_owned.PassAs<TestWebGraphicsContext3D>())); |
1176 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1196 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1177 | 1197 |
1178 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( | 1198 scoped_ptr<ResourceProvider> child_resource_provider( |
1179 child_output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, | 1199 ResourceProvider::Create(child_output_surface.get(), |
1180 false)); | 1200 shared_bitmap_manager_.get(), |
| 1201 NULL, |
| 1202 0, |
| 1203 false, |
| 1204 1, |
| 1205 false)); |
1181 | 1206 |
1182 gfx::Size size(1, 1); | 1207 gfx::Size size(1, 1); |
1183 ResourceFormat format = RGBA_8888; | 1208 ResourceFormat format = RGBA_8888; |
1184 size_t pixel_size = TextureSizeBytes(size, format); | 1209 size_t pixel_size = TextureSizeBytes(size, format); |
1185 ASSERT_EQ(4U, pixel_size); | 1210 ASSERT_EQ(4U, pixel_size); |
1186 | 1211 |
1187 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( | 1212 ResourceProvider::ResourceId id1 = child_resource_provider->CreateResource( |
1188 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 1213 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
1189 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1214 uint8_t data1[4] = { 1, 2, 3, 4 }; |
1190 gfx::Rect rect(size); | 1215 gfx::Rect rect(size); |
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1648 FakeOutputSurfaceClient child_output_surface_client; | 1673 FakeOutputSurfaceClient child_output_surface_client; |
1649 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( | 1674 scoped_ptr<OutputSurface> child_output_surface(FakeOutputSurface::Create3d( |
1650 child_context_owned.PassAs<TestWebGraphicsContext3D>())); | 1675 child_context_owned.PassAs<TestWebGraphicsContext3D>())); |
1651 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1676 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1652 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1677 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1653 new TestSharedBitmapManager()); | 1678 new TestSharedBitmapManager()); |
1654 | 1679 |
1655 scoped_ptr<ResourceProvider> child_resource_provider( | 1680 scoped_ptr<ResourceProvider> child_resource_provider( |
1656 ResourceProvider::Create(child_output_surface.get(), | 1681 ResourceProvider::Create(child_output_surface.get(), |
1657 shared_bitmap_manager.get(), | 1682 shared_bitmap_manager.get(), |
| 1683 NULL, |
1658 0, | 1684 0, |
1659 false, | 1685 false, |
1660 1, | 1686 1, |
1661 false)); | 1687 false)); |
1662 | 1688 |
1663 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1689 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
1664 new TextureStateTrackingContext); | 1690 new TextureStateTrackingContext); |
1665 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1691 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
1666 | 1692 |
1667 FakeOutputSurfaceClient parent_output_surface_client; | 1693 FakeOutputSurfaceClient parent_output_surface_client; |
1668 scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d( | 1694 scoped_ptr<OutputSurface> parent_output_surface(FakeOutputSurface::Create3d( |
1669 parent_context_owned.PassAs<TestWebGraphicsContext3D>())); | 1695 parent_context_owned.PassAs<TestWebGraphicsContext3D>())); |
1670 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1696 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
1671 | 1697 |
1672 scoped_ptr<ResourceProvider> parent_resource_provider( | 1698 scoped_ptr<ResourceProvider> parent_resource_provider( |
1673 ResourceProvider::Create(parent_output_surface.get(), | 1699 ResourceProvider::Create(parent_output_surface.get(), |
1674 shared_bitmap_manager.get(), | 1700 shared_bitmap_manager.get(), |
| 1701 NULL, |
1675 0, | 1702 0, |
1676 false, | 1703 false, |
1677 1, | 1704 1, |
1678 false)); | 1705 false)); |
1679 | 1706 |
1680 gfx::Size size(1, 1); | 1707 gfx::Size size(1, 1); |
1681 ResourceFormat format = RGBA_8888; | 1708 ResourceFormat format = RGBA_8888; |
1682 int child_texture_id = 1; | 1709 int child_texture_id = 1; |
1683 int parent_texture_id = 2; | 1710 int parent_texture_id = 2; |
1684 | 1711 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1835 gpu::Mailbox mailbox; | 1862 gpu::Mailbox mailbox; |
1836 context()->genMailboxCHROMIUM(mailbox.name); | 1863 context()->genMailboxCHROMIUM(mailbox.name); |
1837 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 1864 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
1838 uint32 sync_point = context()->insertSyncPoint(); | 1865 uint32 sync_point = context()->insertSyncPoint(); |
1839 | 1866 |
1840 // All the logic below assumes that the sync points are all positive. | 1867 // All the logic below assumes that the sync points are all positive. |
1841 EXPECT_LT(0u, sync_point); | 1868 EXPECT_LT(0u, sync_point); |
1842 | 1869 |
1843 uint32 release_sync_point = 0; | 1870 uint32 release_sync_point = 0; |
1844 bool lost_resource = false; | 1871 bool lost_resource = false; |
1845 ReleaseCallback callback = | 1872 ReleaseCallbackImpl callback = |
1846 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); | 1873 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource); |
1847 ResourceProvider::ResourceId resource = | 1874 ResourceProvider::ResourceId resource = |
1848 resource_provider_->CreateResourceFromTextureMailbox( | 1875 resource_provider_->CreateResourceFromTextureMailbox( |
1849 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), | 1876 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
1850 SingleReleaseCallback::Create(callback)); | 1877 SingleReleaseCallbackImpl::Create(callback)); |
1851 EXPECT_EQ(1u, context()->NumTextures()); | 1878 EXPECT_EQ(1u, context()->NumTextures()); |
1852 EXPECT_EQ(0u, release_sync_point); | 1879 EXPECT_EQ(0u, release_sync_point); |
1853 { | 1880 { |
1854 // Transfer the resource, expect the sync points to be consistent. | 1881 // Transfer the resource, expect the sync points to be consistent. |
1855 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 1882 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
1856 resource_ids_to_transfer.push_back(resource); | 1883 resource_ids_to_transfer.push_back(resource); |
1857 TransferableResourceArray list; | 1884 TransferableResourceArray list; |
1858 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); | 1885 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); |
1859 ASSERT_EQ(1u, list.size()); | 1886 ASSERT_EQ(1u, list.size()); |
1860 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); | 1887 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); |
(...skipping 29 matching lines...) Expand all Loading... |
1890 EXPECT_FALSE(lost_resource); | 1917 EXPECT_FALSE(lost_resource); |
1891 } | 1918 } |
1892 | 1919 |
1893 // We're going to do the same thing as above, but testing the case where we | 1920 // We're going to do the same thing as above, but testing the case where we |
1894 // delete the resource before we receive it back. | 1921 // delete the resource before we receive it back. |
1895 sync_point = release_sync_point; | 1922 sync_point = release_sync_point; |
1896 EXPECT_LT(0u, sync_point); | 1923 EXPECT_LT(0u, sync_point); |
1897 release_sync_point = 0; | 1924 release_sync_point = 0; |
1898 resource = resource_provider_->CreateResourceFromTextureMailbox( | 1925 resource = resource_provider_->CreateResourceFromTextureMailbox( |
1899 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), | 1926 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), |
1900 SingleReleaseCallback::Create(callback)); | 1927 SingleReleaseCallbackImpl::Create(callback)); |
1901 EXPECT_EQ(1u, context()->NumTextures()); | 1928 EXPECT_EQ(1u, context()->NumTextures()); |
1902 EXPECT_EQ(0u, release_sync_point); | 1929 EXPECT_EQ(0u, release_sync_point); |
1903 { | 1930 { |
1904 // Transfer the resource, expect the sync points to be consistent. | 1931 // Transfer the resource, expect the sync points to be consistent. |
1905 ResourceProvider::ResourceIdArray resource_ids_to_transfer; | 1932 ResourceProvider::ResourceIdArray resource_ids_to_transfer; |
1906 resource_ids_to_transfer.push_back(resource); | 1933 resource_ids_to_transfer.push_back(resource); |
1907 TransferableResourceArray list; | 1934 TransferableResourceArray list; |
1908 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); | 1935 resource_provider_->PrepareSendToParent(resource_ids_to_transfer, &list); |
1909 ASSERT_EQ(1u, list.size()); | 1936 ASSERT_EQ(1u, list.size()); |
1910 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); | 1937 EXPECT_LE(sync_point, list[0].mailbox_holder.sync_point); |
(...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2253 context()->bindTexture(GL_TEXTURE_2D, texture); | 2280 context()->bindTexture(GL_TEXTURE_2D, texture); |
2254 gpu::Mailbox mailbox; | 2281 gpu::Mailbox mailbox; |
2255 context()->genMailboxCHROMIUM(mailbox.name); | 2282 context()->genMailboxCHROMIUM(mailbox.name); |
2256 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); | 2283 context()->produceTextureCHROMIUM(GL_TEXTURE_2D, mailbox.name); |
2257 uint32 sync_point = context()->insertSyncPoint(); | 2284 uint32 sync_point = context()->insertSyncPoint(); |
2258 | 2285 |
2259 EXPECT_LT(0u, sync_point); | 2286 EXPECT_LT(0u, sync_point); |
2260 | 2287 |
2261 uint32 release_sync_point = 0; | 2288 uint32 release_sync_point = 0; |
2262 bool lost_resource = false; | 2289 bool lost_resource = false; |
2263 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( | 2290 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2264 base::Bind(ReleaseTextureMailbox, &release_sync_point, &lost_resource)); | 2291 SingleReleaseCallbackImpl::Create(base::Bind( |
| 2292 ReleaseTextureMailbox, &release_sync_point, &lost_resource)); |
2265 resource_provider_->CreateResourceFromTextureMailbox( | 2293 resource_provider_->CreateResourceFromTextureMailbox( |
2266 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass()); | 2294 TextureMailbox(mailbox, GL_TEXTURE_2D, sync_point), callback.Pass()); |
2267 | 2295 |
2268 EXPECT_EQ(0u, release_sync_point); | 2296 EXPECT_EQ(0u, release_sync_point); |
2269 EXPECT_FALSE(lost_resource); | 2297 EXPECT_FALSE(lost_resource); |
2270 | 2298 |
2271 resource_provider_->DidLoseOutputSurface(); | 2299 resource_provider_->DidLoseOutputSurface(); |
2272 resource_provider_.reset(); | 2300 resource_provider_.reset(); |
2273 | 2301 |
2274 EXPECT_LE(sync_point, release_sync_point); | 2302 EXPECT_LE(sync_point, release_sync_point); |
2275 EXPECT_TRUE(lost_resource); | 2303 EXPECT_TRUE(lost_resource); |
2276 } | 2304 } |
2277 | 2305 |
2278 TEST_P(ResourceProviderTest, ScopedSampler) { | 2306 TEST_P(ResourceProviderTest, ScopedSampler) { |
2279 // Sampling is only supported for GL textures. | 2307 // Sampling is only supported for GL textures. |
2280 if (GetParam() != ResourceProvider::GLTexture) | 2308 if (GetParam() != ResourceProvider::GLTexture) |
2281 return; | 2309 return; |
2282 | 2310 |
2283 scoped_ptr<TextureStateTrackingContext> context_owned( | 2311 scoped_ptr<TextureStateTrackingContext> context_owned( |
2284 new TextureStateTrackingContext); | 2312 new TextureStateTrackingContext); |
2285 TextureStateTrackingContext* context = context_owned.get(); | 2313 TextureStateTrackingContext* context = context_owned.get(); |
2286 | 2314 |
2287 FakeOutputSurfaceClient output_surface_client; | 2315 FakeOutputSurfaceClient output_surface_client; |
2288 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2316 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2289 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2317 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2290 CHECK(output_surface->BindToClient(&output_surface_client)); | 2318 CHECK(output_surface->BindToClient(&output_surface_client)); |
2291 | 2319 |
2292 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2320 scoped_ptr<ResourceProvider> resource_provider( |
2293 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2321 ResourceProvider::Create(output_surface.get(), |
| 2322 shared_bitmap_manager_.get(), |
| 2323 NULL, |
| 2324 0, |
| 2325 false, |
| 2326 1, |
| 2327 false)); |
2294 | 2328 |
2295 gfx::Size size(1, 1); | 2329 gfx::Size size(1, 1); |
2296 ResourceFormat format = RGBA_8888; | 2330 ResourceFormat format = RGBA_8888; |
2297 int texture_id = 1; | 2331 int texture_id = 1; |
2298 | 2332 |
2299 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 2333 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
2300 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 2334 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
2301 | 2335 |
2302 // Check that the texture gets created with the right sampler settings. | 2336 // Check that the texture gets created with the right sampler settings. |
2303 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) | 2337 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2363 | 2397 |
2364 scoped_ptr<TextureStateTrackingContext> context_owned( | 2398 scoped_ptr<TextureStateTrackingContext> context_owned( |
2365 new TextureStateTrackingContext); | 2399 new TextureStateTrackingContext); |
2366 TextureStateTrackingContext* context = context_owned.get(); | 2400 TextureStateTrackingContext* context = context_owned.get(); |
2367 | 2401 |
2368 FakeOutputSurfaceClient output_surface_client; | 2402 FakeOutputSurfaceClient output_surface_client; |
2369 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2403 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2370 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2404 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2371 CHECK(output_surface->BindToClient(&output_surface_client)); | 2405 CHECK(output_surface->BindToClient(&output_surface_client)); |
2372 | 2406 |
2373 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2407 scoped_ptr<ResourceProvider> resource_provider( |
2374 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2408 ResourceProvider::Create(output_surface.get(), |
| 2409 shared_bitmap_manager_.get(), |
| 2410 NULL, |
| 2411 0, |
| 2412 false, |
| 2413 1, |
| 2414 false)); |
2375 | 2415 |
2376 gfx::Size size(1, 1); | 2416 gfx::Size size(1, 1); |
2377 ResourceFormat format = RGBA_8888; | 2417 ResourceFormat format = RGBA_8888; |
2378 int texture_id = 1; | 2418 int texture_id = 1; |
2379 | 2419 |
2380 // Check that the texture gets created with the right sampler settings. | 2420 // Check that the texture gets created with the right sampler settings. |
2381 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( | 2421 ResourceProvider::ResourceId id = resource_provider->CreateManagedResource( |
2382 size, | 2422 size, |
2383 GL_TEXTURE_2D, | 2423 GL_TEXTURE_2D, |
2384 GL_CLAMP_TO_EDGE, | 2424 GL_CLAMP_TO_EDGE, |
(...skipping 27 matching lines...) Expand all Loading... |
2412 | 2452 |
2413 scoped_ptr<TextureStateTrackingContext> context_owned( | 2453 scoped_ptr<TextureStateTrackingContext> context_owned( |
2414 new TextureStateTrackingContext); | 2454 new TextureStateTrackingContext); |
2415 TextureStateTrackingContext* context = context_owned.get(); | 2455 TextureStateTrackingContext* context = context_owned.get(); |
2416 | 2456 |
2417 FakeOutputSurfaceClient output_surface_client; | 2457 FakeOutputSurfaceClient output_surface_client; |
2418 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2458 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2419 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2459 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2420 CHECK(output_surface->BindToClient(&output_surface_client)); | 2460 CHECK(output_surface->BindToClient(&output_surface_client)); |
2421 | 2461 |
2422 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2462 scoped_ptr<ResourceProvider> resource_provider( |
2423 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2463 ResourceProvider::Create(output_surface.get(), |
| 2464 shared_bitmap_manager_.get(), |
| 2465 NULL, |
| 2466 0, |
| 2467 false, |
| 2468 1, |
| 2469 false)); |
2424 | 2470 |
2425 gfx::Size size(1, 1); | 2471 gfx::Size size(1, 1); |
2426 ResourceFormat format = RGBA_8888; | 2472 ResourceFormat format = RGBA_8888; |
2427 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2473 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2428 | 2474 |
2429 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2475 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
2430 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; | 2476 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
2431 // Check that the texture gets created with the right sampler settings. | 2477 // Check that the texture gets created with the right sampler settings. |
2432 ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( | 2478 ResourceProvider::ResourceId id = resource_provider->CreateGLTexture( |
2433 size, | 2479 size, |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 new TextureStateTrackingContext); | 2511 new TextureStateTrackingContext); |
2466 TextureStateTrackingContext* context = context_owned.get(); | 2512 TextureStateTrackingContext* context = context_owned.get(); |
2467 context->set_support_texture_storage(true); | 2513 context->set_support_texture_storage(true); |
2468 context->set_support_texture_usage(true); | 2514 context->set_support_texture_usage(true); |
2469 | 2515 |
2470 FakeOutputSurfaceClient output_surface_client; | 2516 FakeOutputSurfaceClient output_surface_client; |
2471 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2517 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2472 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2518 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2473 CHECK(output_surface->BindToClient(&output_surface_client)); | 2519 CHECK(output_surface->BindToClient(&output_surface_client)); |
2474 | 2520 |
2475 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2521 scoped_ptr<ResourceProvider> resource_provider( |
2476 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2522 ResourceProvider::Create(output_surface.get(), |
| 2523 shared_bitmap_manager_.get(), |
| 2524 NULL, |
| 2525 0, |
| 2526 false, |
| 2527 1, |
| 2528 false)); |
2477 | 2529 |
2478 gfx::Size size(1, 1); | 2530 gfx::Size size(1, 1); |
2479 ResourceFormat format = RGBA_8888; | 2531 ResourceFormat format = RGBA_8888; |
2480 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2532 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2481 | 2533 |
2482 const ResourceProvider::TextureHint hints[4] = { | 2534 const ResourceProvider::TextureHint hints[4] = { |
2483 ResourceProvider::TextureHintDefault, | 2535 ResourceProvider::TextureHintDefault, |
2484 ResourceProvider::TextureHintImmutable, | 2536 ResourceProvider::TextureHintImmutable, |
2485 ResourceProvider::TextureHintFramebuffer, | 2537 ResourceProvider::TextureHintFramebuffer, |
2486 ResourceProvider::TextureHintImmutableFramebuffer, | 2538 ResourceProvider::TextureHintImmutableFramebuffer, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2532 const uint32_t kBadBeef = 0xbadbeef; | 2584 const uint32_t kBadBeef = 0xbadbeef; |
2533 scoped_ptr<base::SharedMemory> shared_memory( | 2585 scoped_ptr<base::SharedMemory> shared_memory( |
2534 CreateAndFillSharedMemory(size, kBadBeef)); | 2586 CreateAndFillSharedMemory(size, kBadBeef)); |
2535 | 2587 |
2536 FakeOutputSurfaceClient output_surface_client; | 2588 FakeOutputSurfaceClient output_surface_client; |
2537 scoped_ptr<OutputSurface> output_surface( | 2589 scoped_ptr<OutputSurface> output_surface( |
2538 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 2590 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
2539 new SoftwareOutputDevice))); | 2591 new SoftwareOutputDevice))); |
2540 CHECK(output_surface->BindToClient(&output_surface_client)); | 2592 CHECK(output_surface->BindToClient(&output_surface_client)); |
2541 | 2593 |
2542 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2594 scoped_ptr<ResourceProvider> resource_provider( |
2543 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2595 ResourceProvider::Create(output_surface.get(), |
| 2596 shared_bitmap_manager_.get(), |
| 2597 NULL, |
| 2598 0, |
| 2599 false, |
| 2600 1, |
| 2601 false)); |
2544 | 2602 |
2545 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( | 2603 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2546 base::Bind(&EmptyReleaseCallback)); | 2604 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2547 TextureMailbox mailbox(shared_memory.get(), size); | 2605 TextureMailbox mailbox(shared_memory.get(), size); |
2548 | 2606 |
2549 ResourceProvider::ResourceId id = | 2607 ResourceProvider::ResourceId id = |
2550 resource_provider->CreateResourceFromTextureMailbox( | 2608 resource_provider->CreateResourceFromTextureMailbox( |
2551 mailbox, callback.Pass()); | 2609 mailbox, callback.Pass()); |
2552 EXPECT_NE(0u, id); | 2610 EXPECT_NE(0u, id); |
2553 | 2611 |
2554 { | 2612 { |
2555 ResourceProvider::ScopedReadLockSoftware lock(resource_provider.get(), id); | 2613 ResourceProvider::ScopedReadLockSoftware lock(resource_provider.get(), id); |
2556 const SkBitmap* sk_bitmap = lock.sk_bitmap(); | 2614 const SkBitmap* sk_bitmap = lock.sk_bitmap(); |
(...skipping 10 matching lines...) Expand all Loading... |
2567 | 2625 |
2568 scoped_ptr<TextureStateTrackingContext> context_owned( | 2626 scoped_ptr<TextureStateTrackingContext> context_owned( |
2569 new TextureStateTrackingContext); | 2627 new TextureStateTrackingContext); |
2570 TextureStateTrackingContext* context = context_owned.get(); | 2628 TextureStateTrackingContext* context = context_owned.get(); |
2571 | 2629 |
2572 FakeOutputSurfaceClient output_surface_client; | 2630 FakeOutputSurfaceClient output_surface_client; |
2573 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2631 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2574 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2632 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2575 CHECK(output_surface->BindToClient(&output_surface_client)); | 2633 CHECK(output_surface->BindToClient(&output_surface_client)); |
2576 | 2634 |
2577 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2635 scoped_ptr<ResourceProvider> resource_provider( |
2578 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2636 ResourceProvider::Create(output_surface.get(), |
| 2637 shared_bitmap_manager_.get(), |
| 2638 NULL, |
| 2639 0, |
| 2640 false, |
| 2641 1, |
| 2642 false)); |
2579 | 2643 |
2580 unsigned texture_id = 1; | 2644 unsigned texture_id = 1; |
2581 uint32 sync_point = 30; | 2645 uint32 sync_point = 30; |
2582 unsigned target = GL_TEXTURE_2D; | 2646 unsigned target = GL_TEXTURE_2D; |
2583 | 2647 |
2584 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2648 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2585 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2649 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2586 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2650 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2587 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2651 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2588 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2652 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2589 | 2653 |
2590 gpu::Mailbox gpu_mailbox; | 2654 gpu::Mailbox gpu_mailbox; |
2591 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2655 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2592 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( | 2656 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2593 base::Bind(&EmptyReleaseCallback)); | 2657 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2594 | 2658 |
2595 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2659 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2596 | 2660 |
2597 ResourceProvider::ResourceId id = | 2661 ResourceProvider::ResourceId id = |
2598 resource_provider->CreateResourceFromTextureMailbox( | 2662 resource_provider->CreateResourceFromTextureMailbox( |
2599 mailbox, callback.Pass()); | 2663 mailbox, callback.Pass()); |
2600 EXPECT_NE(0u, id); | 2664 EXPECT_NE(0u, id); |
2601 | 2665 |
2602 Mock::VerifyAndClearExpectations(context); | 2666 Mock::VerifyAndClearExpectations(context); |
2603 | 2667 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2635 | 2699 |
2636 scoped_ptr<TextureStateTrackingContext> context_owned( | 2700 scoped_ptr<TextureStateTrackingContext> context_owned( |
2637 new TextureStateTrackingContext); | 2701 new TextureStateTrackingContext); |
2638 TextureStateTrackingContext* context = context_owned.get(); | 2702 TextureStateTrackingContext* context = context_owned.get(); |
2639 | 2703 |
2640 FakeOutputSurfaceClient output_surface_client; | 2704 FakeOutputSurfaceClient output_surface_client; |
2641 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2705 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2642 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2706 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2643 CHECK(output_surface->BindToClient(&output_surface_client)); | 2707 CHECK(output_surface->BindToClient(&output_surface_client)); |
2644 | 2708 |
2645 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2709 scoped_ptr<ResourceProvider> resource_provider( |
2646 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2710 ResourceProvider::Create(output_surface.get(), |
| 2711 shared_bitmap_manager_.get(), |
| 2712 NULL, |
| 2713 0, |
| 2714 false, |
| 2715 1, |
| 2716 false)); |
2647 | 2717 |
2648 unsigned texture_id = 1; | 2718 unsigned texture_id = 1; |
2649 uint32 sync_point = 30; | 2719 uint32 sync_point = 30; |
2650 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2720 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2651 | 2721 |
2652 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2722 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2653 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2723 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2654 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2724 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2655 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2725 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2656 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2726 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2657 | 2727 |
2658 gpu::Mailbox gpu_mailbox; | 2728 gpu::Mailbox gpu_mailbox; |
2659 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2729 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2660 scoped_ptr<SingleReleaseCallback> callback = SingleReleaseCallback::Create( | 2730 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2661 base::Bind(&EmptyReleaseCallback)); | 2731 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2662 | 2732 |
2663 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2733 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2664 | 2734 |
2665 ResourceProvider::ResourceId id = | 2735 ResourceProvider::ResourceId id = |
2666 resource_provider->CreateResourceFromTextureMailbox( | 2736 resource_provider->CreateResourceFromTextureMailbox( |
2667 mailbox, callback.Pass()); | 2737 mailbox, callback.Pass()); |
2668 EXPECT_NE(0u, id); | 2738 EXPECT_NE(0u, id); |
2669 | 2739 |
2670 Mock::VerifyAndClearExpectations(context); | 2740 Mock::VerifyAndClearExpectations(context); |
2671 | 2741 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 | 2774 |
2705 scoped_ptr<TextureStateTrackingContext> context_owned( | 2775 scoped_ptr<TextureStateTrackingContext> context_owned( |
2706 new TextureStateTrackingContext); | 2776 new TextureStateTrackingContext); |
2707 TextureStateTrackingContext* context = context_owned.get(); | 2777 TextureStateTrackingContext* context = context_owned.get(); |
2708 | 2778 |
2709 FakeOutputSurfaceClient output_surface_client; | 2779 FakeOutputSurfaceClient output_surface_client; |
2710 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2780 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2711 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2781 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2712 CHECK(output_surface->BindToClient(&output_surface_client)); | 2782 CHECK(output_surface->BindToClient(&output_surface_client)); |
2713 | 2783 |
2714 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2784 scoped_ptr<ResourceProvider> resource_provider( |
2715 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2785 ResourceProvider::Create(output_surface.get(), |
| 2786 shared_bitmap_manager_.get(), |
| 2787 NULL, |
| 2788 0, |
| 2789 false, |
| 2790 1, |
| 2791 false)); |
2716 | 2792 |
2717 uint32 sync_point = 30; | 2793 uint32 sync_point = 30; |
2718 unsigned target = GL_TEXTURE_2D; | 2794 unsigned target = GL_TEXTURE_2D; |
2719 | 2795 |
2720 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2796 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2721 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2797 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2722 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2798 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2723 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2799 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2724 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2800 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2725 | 2801 |
2726 gpu::Mailbox gpu_mailbox; | 2802 gpu::Mailbox gpu_mailbox; |
2727 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2803 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2728 scoped_ptr<SingleReleaseCallback> callback = | 2804 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2729 SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback)); | 2805 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2730 | 2806 |
2731 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2807 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2732 | 2808 |
2733 ResourceProvider::ResourceId id = | 2809 ResourceProvider::ResourceId id = |
2734 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2810 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
2735 callback.Pass()); | 2811 callback.Pass()); |
2736 EXPECT_NE(0u, id); | 2812 EXPECT_NE(0u, id); |
2737 | 2813 |
2738 Mock::VerifyAndClearExpectations(context); | 2814 Mock::VerifyAndClearExpectations(context); |
2739 | 2815 |
(...skipping 17 matching lines...) Expand all Loading... |
2757 | 2833 |
2758 scoped_ptr<TextureStateTrackingContext> context_owned( | 2834 scoped_ptr<TextureStateTrackingContext> context_owned( |
2759 new TextureStateTrackingContext); | 2835 new TextureStateTrackingContext); |
2760 TextureStateTrackingContext* context = context_owned.get(); | 2836 TextureStateTrackingContext* context = context_owned.get(); |
2761 | 2837 |
2762 FakeOutputSurfaceClient output_surface_client; | 2838 FakeOutputSurfaceClient output_surface_client; |
2763 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2839 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2764 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2840 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2765 CHECK(output_surface->BindToClient(&output_surface_client)); | 2841 CHECK(output_surface->BindToClient(&output_surface_client)); |
2766 | 2842 |
2767 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2843 scoped_ptr<ResourceProvider> resource_provider( |
2768 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2844 ResourceProvider::Create(output_surface.get(), |
| 2845 shared_bitmap_manager_.get(), |
| 2846 NULL, |
| 2847 0, |
| 2848 false, |
| 2849 1, |
| 2850 false)); |
2769 | 2851 |
2770 uint32 sync_point = 0; | 2852 uint32 sync_point = 0; |
2771 unsigned target = GL_TEXTURE_2D; | 2853 unsigned target = GL_TEXTURE_2D; |
2772 | 2854 |
2773 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2855 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2774 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2856 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2775 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2857 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2776 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); | 2858 EXPECT_CALL(*context, produceTextureCHROMIUM(_, _)).Times(0); |
2777 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); | 2859 EXPECT_CALL(*context, consumeTextureCHROMIUM(_, _)).Times(0); |
2778 | 2860 |
2779 gpu::Mailbox gpu_mailbox; | 2861 gpu::Mailbox gpu_mailbox; |
2780 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); | 2862 memcpy(gpu_mailbox.name, "Hello world", strlen("Hello world") + 1); |
2781 scoped_ptr<SingleReleaseCallback> callback = | 2863 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2782 SingleReleaseCallback::Create(base::Bind(&EmptyReleaseCallback)); | 2864 SingleReleaseCallbackImpl::Create(base::Bind(&EmptyReleaseCallback)); |
2783 | 2865 |
2784 TextureMailbox mailbox(gpu_mailbox, target, sync_point); | 2866 TextureMailbox mailbox(gpu_mailbox, target, sync_point); |
2785 | 2867 |
2786 ResourceProvider::ResourceId id = | 2868 ResourceProvider::ResourceId id = |
2787 resource_provider->CreateResourceFromTextureMailbox(mailbox, | 2869 resource_provider->CreateResourceFromTextureMailbox(mailbox, |
2788 callback.Pass()); | 2870 callback.Pass()); |
2789 EXPECT_NE(0u, id); | 2871 EXPECT_NE(0u, id); |
2790 | 2872 |
2791 Mock::VerifyAndClearExpectations(context); | 2873 Mock::VerifyAndClearExpectations(context); |
2792 | 2874 |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2879 return; | 2961 return; |
2880 scoped_ptr<AllocationTrackingContext3D> context_owned( | 2962 scoped_ptr<AllocationTrackingContext3D> context_owned( |
2881 new StrictMock<AllocationTrackingContext3D>); | 2963 new StrictMock<AllocationTrackingContext3D>); |
2882 AllocationTrackingContext3D* context = context_owned.get(); | 2964 AllocationTrackingContext3D* context = context_owned.get(); |
2883 | 2965 |
2884 FakeOutputSurfaceClient output_surface_client; | 2966 FakeOutputSurfaceClient output_surface_client; |
2885 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 2967 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2886 context_owned.PassAs<TestWebGraphicsContext3D>())); | 2968 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2887 CHECK(output_surface->BindToClient(&output_surface_client)); | 2969 CHECK(output_surface->BindToClient(&output_surface_client)); |
2888 | 2970 |
2889 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2971 scoped_ptr<ResourceProvider> resource_provider( |
2890 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 2972 ResourceProvider::Create(output_surface.get(), |
| 2973 shared_bitmap_manager_.get(), |
| 2974 NULL, |
| 2975 0, |
| 2976 false, |
| 2977 1, |
| 2978 false)); |
2891 | 2979 |
2892 gfx::Size size(2, 2); | 2980 gfx::Size size(2, 2); |
2893 gfx::Vector2d offset(0, 0); | 2981 gfx::Vector2d offset(0, 0); |
2894 gfx::Rect rect(0, 0, 2, 2); | 2982 gfx::Rect rect(0, 0, 2, 2); |
2895 ResourceFormat format = RGBA_8888; | 2983 ResourceFormat format = RGBA_8888; |
2896 ResourceProvider::ResourceId id = 0; | 2984 ResourceProvider::ResourceId id = 0; |
2897 uint8_t pixels[16] = { 0 }; | 2985 uint8_t pixels[16] = { 0 }; |
2898 int texture_id = 123; | 2986 int texture_id = 123; |
2899 | 2987 |
2900 // Lazy allocation. Don't allocate when creating the resource. | 2988 // Lazy allocation. Don't allocate when creating the resource. |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2956 new StrictMock<AllocationTrackingContext3D>); | 3044 new StrictMock<AllocationTrackingContext3D>); |
2957 AllocationTrackingContext3D* context = context_owned.get(); | 3045 AllocationTrackingContext3D* context = context_owned.get(); |
2958 context->set_support_texture_storage(true); | 3046 context->set_support_texture_storage(true); |
2959 context->set_support_texture_usage(true); | 3047 context->set_support_texture_usage(true); |
2960 | 3048 |
2961 FakeOutputSurfaceClient output_surface_client; | 3049 FakeOutputSurfaceClient output_surface_client; |
2962 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3050 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
2963 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3051 context_owned.PassAs<TestWebGraphicsContext3D>())); |
2964 CHECK(output_surface->BindToClient(&output_surface_client)); | 3052 CHECK(output_surface->BindToClient(&output_surface_client)); |
2965 | 3053 |
2966 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3054 scoped_ptr<ResourceProvider> resource_provider( |
2967 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3055 ResourceProvider::Create(output_surface.get(), |
| 3056 shared_bitmap_manager_.get(), |
| 3057 NULL, |
| 3058 0, |
| 3059 false, |
| 3060 1, |
| 3061 false)); |
2968 | 3062 |
2969 gfx::Size size(2, 2); | 3063 gfx::Size size(2, 2); |
2970 | 3064 |
2971 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3065 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
2972 const ResourceProvider::TextureHint hints[4] = { | 3066 const ResourceProvider::TextureHint hints[4] = { |
2973 ResourceProvider::TextureHintDefault, | 3067 ResourceProvider::TextureHintDefault, |
2974 ResourceProvider::TextureHintImmutable, | 3068 ResourceProvider::TextureHintImmutable, |
2975 ResourceProvider::TextureHintFramebuffer, | 3069 ResourceProvider::TextureHintFramebuffer, |
2976 ResourceProvider::TextureHintImmutableFramebuffer, | 3070 ResourceProvider::TextureHintImmutableFramebuffer, |
2977 }; | 3071 }; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3010 AllocationTrackingContext3D* context = context_owned.get(); | 3104 AllocationTrackingContext3D* context = context_owned.get(); |
3011 context->set_support_texture_format_bgra8888(true); | 3105 context->set_support_texture_format_bgra8888(true); |
3012 context->set_support_texture_storage(true); | 3106 context->set_support_texture_storage(true); |
3013 context->set_support_texture_usage(true); | 3107 context->set_support_texture_usage(true); |
3014 | 3108 |
3015 FakeOutputSurfaceClient output_surface_client; | 3109 FakeOutputSurfaceClient output_surface_client; |
3016 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3110 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3017 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3111 context_owned.PassAs<TestWebGraphicsContext3D>())); |
3018 CHECK(output_surface->BindToClient(&output_surface_client)); | 3112 CHECK(output_surface->BindToClient(&output_surface_client)); |
3019 | 3113 |
3020 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3114 scoped_ptr<ResourceProvider> resource_provider( |
3021 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3115 ResourceProvider::Create(output_surface.get(), |
| 3116 shared_bitmap_manager_.get(), |
| 3117 NULL, |
| 3118 0, |
| 3119 false, |
| 3120 1, |
| 3121 false)); |
3022 | 3122 |
3023 gfx::Size size(2, 2); | 3123 gfx::Size size(2, 2); |
3024 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3124 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3025 | 3125 |
3026 const ResourceProvider::TextureHint hints[4] = { | 3126 const ResourceProvider::TextureHint hints[4] = { |
3027 ResourceProvider::TextureHintDefault, | 3127 ResourceProvider::TextureHintDefault, |
3028 ResourceProvider::TextureHintImmutable, | 3128 ResourceProvider::TextureHintImmutable, |
3029 ResourceProvider::TextureHintFramebuffer, | 3129 ResourceProvider::TextureHintFramebuffer, |
3030 ResourceProvider::TextureHintImmutableFramebuffer, | 3130 ResourceProvider::TextureHintImmutableFramebuffer, |
3031 }; | 3131 }; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3063 FakeOutputSurfaceClient output_surface_client; | 3163 FakeOutputSurfaceClient output_surface_client; |
3064 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3164 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3065 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3165 context_owned.PassAs<TestWebGraphicsContext3D>())); |
3066 CHECK(output_surface->BindToClient(&output_surface_client)); | 3166 CHECK(output_surface->BindToClient(&output_surface_client)); |
3067 | 3167 |
3068 gfx::Size size(2, 2); | 3168 gfx::Size size(2, 2); |
3069 ResourceFormat format = RGBA_8888; | 3169 ResourceFormat format = RGBA_8888; |
3070 ResourceProvider::ResourceId id = 0; | 3170 ResourceProvider::ResourceId id = 0; |
3071 int texture_id = 123; | 3171 int texture_id = 123; |
3072 | 3172 |
3073 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3173 scoped_ptr<ResourceProvider> resource_provider( |
3074 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3174 ResourceProvider::Create(output_surface.get(), |
| 3175 shared_bitmap_manager_.get(), |
| 3176 NULL, |
| 3177 0, |
| 3178 false, |
| 3179 1, |
| 3180 false)); |
3075 | 3181 |
3076 id = resource_provider->CreateResource( | 3182 id = resource_provider->CreateResource( |
3077 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3183 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3078 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); | 3184 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); |
3079 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); | 3185 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); |
3080 raster_buffer->ReleaseSkCanvas(canvas); | 3186 raster_buffer->ReleaseSkCanvas(canvas); |
3081 canvas.clear(); | 3187 canvas.clear(); |
3082 | 3188 |
3083 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3189 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3084 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3190 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
(...skipping 22 matching lines...) Expand all Loading... |
3107 FakeOutputSurfaceClient output_surface_client; | 3213 FakeOutputSurfaceClient output_surface_client; |
3108 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3214 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3109 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3215 context_owned.PassAs<TestWebGraphicsContext3D>())); |
3110 CHECK(output_surface->BindToClient(&output_surface_client)); | 3216 CHECK(output_surface->BindToClient(&output_surface_client)); |
3111 | 3217 |
3112 gfx::Size size(2, 2); | 3218 gfx::Size size(2, 2); |
3113 ResourceFormat format = RGBA_8888; | 3219 ResourceFormat format = RGBA_8888; |
3114 ResourceProvider::ResourceId id = 0; | 3220 ResourceProvider::ResourceId id = 0; |
3115 int texture_id = 123; | 3221 int texture_id = 123; |
3116 | 3222 |
3117 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3223 scoped_ptr<ResourceProvider> resource_provider( |
3118 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3224 ResourceProvider::Create(output_surface.get(), |
| 3225 shared_bitmap_manager_.get(), |
| 3226 NULL, |
| 3227 0, |
| 3228 false, |
| 3229 1, |
| 3230 false)); |
3119 | 3231 |
3120 id = resource_provider->CreateResource( | 3232 id = resource_provider->CreateResource( |
3121 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3233 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3122 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); | 3234 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); |
3123 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); | 3235 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); |
3124 raster_buffer->ReleaseSkCanvas(canvas); | 3236 raster_buffer->ReleaseSkCanvas(canvas); |
3125 canvas.clear(); | 3237 canvas.clear(); |
3126 | 3238 |
3127 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3239 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3128 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3240 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
(...skipping 22 matching lines...) Expand all Loading... |
3151 FakeOutputSurfaceClient output_surface_client; | 3263 FakeOutputSurfaceClient output_surface_client; |
3152 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3264 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3153 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3265 context_owned.PassAs<TestWebGraphicsContext3D>())); |
3154 CHECK(output_surface->BindToClient(&output_surface_client)); | 3266 CHECK(output_surface->BindToClient(&output_surface_client)); |
3155 | 3267 |
3156 gfx::Size size(2, 2); | 3268 gfx::Size size(2, 2); |
3157 ResourceFormat format = RGBA_8888; | 3269 ResourceFormat format = RGBA_8888; |
3158 ResourceProvider::ResourceId id = 0; | 3270 ResourceProvider::ResourceId id = 0; |
3159 int texture_id = 123; | 3271 int texture_id = 123; |
3160 | 3272 |
3161 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3273 scoped_ptr<ResourceProvider> resource_provider( |
3162 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3274 ResourceProvider::Create(output_surface.get(), |
| 3275 shared_bitmap_manager_.get(), |
| 3276 NULL, |
| 3277 0, |
| 3278 false, |
| 3279 1, |
| 3280 false)); |
3163 | 3281 |
3164 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); | 3282 EXPECT_CALL(*context, NextTextureId()).WillRepeatedly(Return(texture_id)); |
3165 | 3283 |
3166 id = resource_provider->CreateResource( | 3284 id = resource_provider->CreateResource( |
3167 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3285 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3168 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, | 3286 context->loseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB, |
3169 GL_INNOCENT_CONTEXT_RESET_ARB); | 3287 GL_INNOCENT_CONTEXT_RESET_ARB); |
3170 | 3288 |
3171 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); | 3289 RasterBuffer* raster_buffer = resource_provider->AcquirePixelRasterBuffer(id); |
3172 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); | 3290 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); |
(...skipping 18 matching lines...) Expand all Loading... |
3191 CHECK(output_surface->BindToClient(&output_surface_client)); | 3309 CHECK(output_surface->BindToClient(&output_surface_client)); |
3192 | 3310 |
3193 const int kWidth = 2; | 3311 const int kWidth = 2; |
3194 const int kHeight = 2; | 3312 const int kHeight = 2; |
3195 gfx::Size size(kWidth, kHeight); | 3313 gfx::Size size(kWidth, kHeight); |
3196 ResourceFormat format = RGBA_8888; | 3314 ResourceFormat format = RGBA_8888; |
3197 ResourceProvider::ResourceId id = 0; | 3315 ResourceProvider::ResourceId id = 0; |
3198 const unsigned kTextureId = 123u; | 3316 const unsigned kTextureId = 123u; |
3199 const unsigned kImageId = 234u; | 3317 const unsigned kImageId = 234u; |
3200 | 3318 |
3201 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3319 scoped_ptr<ResourceProvider> resource_provider( |
3202 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3320 ResourceProvider::Create(output_surface.get(), |
| 3321 shared_bitmap_manager_.get(), |
| 3322 NULL, |
| 3323 0, |
| 3324 false, |
| 3325 1, |
| 3326 false)); |
3203 | 3327 |
3204 id = resource_provider->CreateResource( | 3328 id = resource_provider->CreateResource( |
3205 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3329 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3206 | 3330 |
3207 const int kStride = 4; | 3331 const int kStride = 4; |
3208 void* dummy_mapped_buffer_address = NULL; | 3332 void* dummy_mapped_buffer_address = NULL; |
3209 EXPECT_CALL( | 3333 EXPECT_CALL( |
3210 *context, | 3334 *context, |
3211 createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) | 3335 createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) |
3212 .WillOnce(Return(kImageId)) | 3336 .WillOnce(Return(kImageId)) |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3277 scoped_ptr<OutputSurface> output_surface( | 3401 scoped_ptr<OutputSurface> output_surface( |
3278 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 3402 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
3279 new SoftwareOutputDevice))); | 3403 new SoftwareOutputDevice))); |
3280 CHECK(output_surface->BindToClient(&output_surface_client)); | 3404 CHECK(output_surface->BindToClient(&output_surface_client)); |
3281 | 3405 |
3282 gfx::Size size(1, 1); | 3406 gfx::Size size(1, 1); |
3283 ResourceFormat format = RGBA_8888; | 3407 ResourceFormat format = RGBA_8888; |
3284 ResourceProvider::ResourceId id = 0; | 3408 ResourceProvider::ResourceId id = 0; |
3285 const uint32_t kBadBeef = 0xbadbeef; | 3409 const uint32_t kBadBeef = 0xbadbeef; |
3286 | 3410 |
3287 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3411 scoped_ptr<ResourceProvider> resource_provider( |
3288 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3412 ResourceProvider::Create(output_surface.get(), |
| 3413 shared_bitmap_manager_.get(), |
| 3414 NULL, |
| 3415 0, |
| 3416 false, |
| 3417 1, |
| 3418 false)); |
3289 | 3419 |
3290 id = resource_provider->CreateResource( | 3420 id = resource_provider->CreateResource( |
3291 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3421 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3292 | 3422 |
3293 SkBitmap bitmap; | 3423 SkBitmap bitmap; |
3294 bitmap.allocN32Pixels(size.width(), size.height()); | 3424 bitmap.allocN32Pixels(size.width(), size.height()); |
3295 *(bitmap.getAddr32(0, 0)) = kBadBeef; | 3425 *(bitmap.getAddr32(0, 0)) = kBadBeef; |
3296 RasterBuffer* raster_buffer = resource_provider->AcquireImageRasterBuffer(id); | 3426 RasterBuffer* raster_buffer = resource_provider->AcquireImageRasterBuffer(id); |
3297 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); | 3427 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); |
3298 ASSERT_TRUE(!!canvas); | 3428 ASSERT_TRUE(!!canvas); |
(...skipping 29 matching lines...) Expand all Loading... |
3328 const int kWidth = 2; | 3458 const int kWidth = 2; |
3329 const int kHeight = 2; | 3459 const int kHeight = 2; |
3330 gfx::Size size(kWidth, kHeight); | 3460 gfx::Size size(kWidth, kHeight); |
3331 ResourceFormat format = RGBA_8888; | 3461 ResourceFormat format = RGBA_8888; |
3332 ResourceProvider::ResourceId source_id = 0; | 3462 ResourceProvider::ResourceId source_id = 0; |
3333 ResourceProvider::ResourceId dest_id = 0; | 3463 ResourceProvider::ResourceId dest_id = 0; |
3334 const unsigned kSourceTextureId = 123u; | 3464 const unsigned kSourceTextureId = 123u; |
3335 const unsigned kDestTextureId = 321u; | 3465 const unsigned kDestTextureId = 321u; |
3336 const unsigned kImageId = 234u; | 3466 const unsigned kImageId = 234u; |
3337 | 3467 |
3338 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3468 scoped_ptr<ResourceProvider> resource_provider( |
3339 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3469 ResourceProvider::Create(output_surface.get(), |
| 3470 shared_bitmap_manager_.get(), |
| 3471 NULL, |
| 3472 0, |
| 3473 false, |
| 3474 1, |
| 3475 false)); |
3340 | 3476 |
3341 source_id = resource_provider->CreateResource( | 3477 source_id = resource_provider->CreateResource( |
3342 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3478 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3343 | 3479 |
3344 const int kStride = 4; | 3480 const int kStride = 4; |
3345 void* dummy_mapped_buffer_address = NULL; | 3481 void* dummy_mapped_buffer_address = NULL; |
3346 EXPECT_CALL( | 3482 EXPECT_CALL( |
3347 *context, | 3483 *context, |
3348 createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) | 3484 createImageCHROMIUM(kWidth, kHeight, GL_RGBA8_OES, GL_IMAGE_MAP_CHROMIUM)) |
3349 .WillOnce(Return(kImageId)) | 3485 .WillOnce(Return(kImageId)) |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3401 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::CreateSoftware( | 3537 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::CreateSoftware( |
3402 make_scoped_ptr(new SoftwareOutputDevice))); | 3538 make_scoped_ptr(new SoftwareOutputDevice))); |
3403 CHECK(output_surface->BindToClient(&output_surface_client)); | 3539 CHECK(output_surface->BindToClient(&output_surface_client)); |
3404 | 3540 |
3405 gfx::Size size(1, 1); | 3541 gfx::Size size(1, 1); |
3406 ResourceFormat format = RGBA_8888; | 3542 ResourceFormat format = RGBA_8888; |
3407 ResourceProvider::ResourceId source_id = 0; | 3543 ResourceProvider::ResourceId source_id = 0; |
3408 ResourceProvider::ResourceId dest_id = 0; | 3544 ResourceProvider::ResourceId dest_id = 0; |
3409 const uint32_t kBadBeef = 0xbadbeef; | 3545 const uint32_t kBadBeef = 0xbadbeef; |
3410 | 3546 |
3411 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3547 scoped_ptr<ResourceProvider> resource_provider( |
3412 output_surface.get(), shared_bitmap_manager_.get(), 0, false, 1, false)); | 3548 ResourceProvider::Create(output_surface.get(), |
| 3549 shared_bitmap_manager_.get(), |
| 3550 NULL, |
| 3551 0, |
| 3552 false, |
| 3553 1, |
| 3554 false)); |
3413 | 3555 |
3414 source_id = resource_provider->CreateResource( | 3556 source_id = resource_provider->CreateResource( |
3415 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3557 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3416 | 3558 |
3417 SkBitmap bitmap; | 3559 SkBitmap bitmap; |
3418 bitmap.allocN32Pixels(size.width(), size.height()); | 3560 bitmap.allocN32Pixels(size.width(), size.height()); |
3419 *(bitmap.getAddr32(0, 0)) = kBadBeef; | 3561 *(bitmap.getAddr32(0, 0)) = kBadBeef; |
3420 RasterBuffer* raster_buffer = | 3562 RasterBuffer* raster_buffer = |
3421 resource_provider->AcquireImageRasterBuffer(source_id); | 3563 resource_provider->AcquireImageRasterBuffer(source_id); |
3422 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); | 3564 skia::RefPtr<SkCanvas> canvas = raster_buffer->AcquireSkCanvas(); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3464 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create(); | 3606 scoped_ptr<ContextSharedData> shared_data = ContextSharedData::Create(); |
3465 bool delegated_rendering = false; | 3607 bool delegated_rendering = false; |
3466 scoped_ptr<FakeOutputSurface> output_surface( | 3608 scoped_ptr<FakeOutputSurface> output_surface( |
3467 FakeOutputSurface::CreateDeferredGL( | 3609 FakeOutputSurface::CreateDeferredGL( |
3468 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), | 3610 scoped_ptr<SoftwareOutputDevice>(new SoftwareOutputDevice), |
3469 delegated_rendering)); | 3611 delegated_rendering)); |
3470 FakeOutputSurfaceClient client(output_surface.get()); | 3612 FakeOutputSurfaceClient client(output_surface.get()); |
3471 EXPECT_TRUE(output_surface->BindToClient(&client)); | 3613 EXPECT_TRUE(output_surface->BindToClient(&client)); |
3472 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3614 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
3473 new TestSharedBitmapManager()); | 3615 new TestSharedBitmapManager()); |
3474 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3616 scoped_ptr<ResourceProvider> resource_provider( |
3475 output_surface.get(), shared_bitmap_manager.get(), 0, false, 1, false)); | 3617 ResourceProvider::Create(output_surface.get(), |
| 3618 shared_bitmap_manager.get(), |
| 3619 NULL, |
| 3620 0, |
| 3621 false, |
| 3622 1, |
| 3623 false)); |
3476 | 3624 |
3477 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3625 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); |
3478 | 3626 |
3479 InitializeGLAndCheck(shared_data.get(), | 3627 InitializeGLAndCheck(shared_data.get(), |
3480 resource_provider.get(), | 3628 resource_provider.get(), |
3481 output_surface.get()); | 3629 output_surface.get()); |
3482 | 3630 |
3483 resource_provider->InitializeSoftware(); | 3631 resource_provider->InitializeSoftware(); |
3484 output_surface->ReleaseGL(); | 3632 output_surface->ReleaseGL(); |
3485 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); | 3633 CheckCreateResource(ResourceProvider::Bitmap, resource_provider.get(), NULL); |
(...skipping 14 matching lines...) Expand all Loading... |
3500 | 3648 |
3501 FakeOutputSurfaceClient output_surface_client; | 3649 FakeOutputSurfaceClient output_surface_client; |
3502 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3650 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3503 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3651 context_owned.PassAs<TestWebGraphicsContext3D>())); |
3504 CHECK(output_surface->BindToClient(&output_surface_client)); | 3652 CHECK(output_surface->BindToClient(&output_surface_client)); |
3505 | 3653 |
3506 gfx::Size size(4, 4); | 3654 gfx::Size size(4, 4); |
3507 scoped_ptr<ResourceProvider> resource_provider( | 3655 scoped_ptr<ResourceProvider> resource_provider( |
3508 ResourceProvider::Create(output_surface.get(), | 3656 ResourceProvider::Create(output_surface.get(), |
3509 shared_bitmap_manager_.get(), | 3657 shared_bitmap_manager_.get(), |
| 3658 NULL, |
3510 0, | 3659 0, |
3511 false, | 3660 false, |
3512 1, | 3661 1, |
3513 false)); | 3662 false)); |
3514 int texture_id = 123; | 3663 int texture_id = 123; |
3515 | 3664 |
3516 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3665 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3517 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3666 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
3518 EXPECT_NE(0u, id); | 3667 EXPECT_NE(0u, id); |
3519 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3668 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
(...skipping 15 matching lines...) Expand all Loading... |
3535 | 3684 |
3536 FakeOutputSurfaceClient output_surface_client; | 3685 FakeOutputSurfaceClient output_surface_client; |
3537 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( | 3686 scoped_ptr<OutputSurface> output_surface(FakeOutputSurface::Create3d( |
3538 context_owned.PassAs<TestWebGraphicsContext3D>())); | 3687 context_owned.PassAs<TestWebGraphicsContext3D>())); |
3539 CHECK(output_surface->BindToClient(&output_surface_client)); | 3688 CHECK(output_surface->BindToClient(&output_surface_client)); |
3540 | 3689 |
3541 gfx::Size size(4, 4); | 3690 gfx::Size size(4, 4); |
3542 scoped_ptr<ResourceProvider> resource_provider( | 3691 scoped_ptr<ResourceProvider> resource_provider( |
3543 ResourceProvider::Create(output_surface.get(), | 3692 ResourceProvider::Create(output_surface.get(), |
3544 shared_bitmap_manager_.get(), | 3693 shared_bitmap_manager_.get(), |
| 3694 NULL, |
3545 0, | 3695 0, |
3546 false, | 3696 false, |
3547 1, | 3697 1, |
3548 false)); | 3698 false)); |
3549 int texture_id = 123; | 3699 int texture_id = 123; |
3550 uint8_t pixels[8]; | 3700 uint8_t pixels[8]; |
3551 | 3701 |
3552 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3702 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3553 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); | 3703 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, ETC1); |
3554 EXPECT_NE(0u, id); | 3704 EXPECT_NE(0u, id); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3595 new TestSharedBitmapManager()); | 3745 new TestSharedBitmapManager()); |
3596 | 3746 |
3597 gfx::Size size(1, 1); | 3747 gfx::Size size(1, 1); |
3598 ResourceFormat format = RGBA_8888; | 3748 ResourceFormat format = RGBA_8888; |
3599 | 3749 |
3600 { | 3750 { |
3601 size_t kTextureAllocationChunkSize = 1; | 3751 size_t kTextureAllocationChunkSize = 1; |
3602 scoped_ptr<ResourceProvider> resource_provider( | 3752 scoped_ptr<ResourceProvider> resource_provider( |
3603 ResourceProvider::Create(output_surface.get(), | 3753 ResourceProvider::Create(output_surface.get(), |
3604 shared_bitmap_manager.get(), | 3754 shared_bitmap_manager.get(), |
| 3755 NULL, |
3605 0, | 3756 0, |
3606 false, | 3757 false, |
3607 kTextureAllocationChunkSize, | 3758 kTextureAllocationChunkSize, |
3608 false)); | 3759 false)); |
3609 | 3760 |
3610 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3761 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3611 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3762 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3612 resource_provider->AllocateForTesting(id); | 3763 resource_provider->AllocateForTesting(id); |
3613 Mock::VerifyAndClearExpectations(context); | 3764 Mock::VerifyAndClearExpectations(context); |
3614 | 3765 |
3615 DCHECK_EQ(2u, context->PeekTextureId()); | 3766 DCHECK_EQ(2u, context->PeekTextureId()); |
3616 resource_provider->DeleteResource(id); | 3767 resource_provider->DeleteResource(id); |
3617 } | 3768 } |
3618 | 3769 |
3619 { | 3770 { |
3620 size_t kTextureAllocationChunkSize = 8; | 3771 size_t kTextureAllocationChunkSize = 8; |
3621 scoped_ptr<ResourceProvider> resource_provider( | 3772 scoped_ptr<ResourceProvider> resource_provider( |
3622 ResourceProvider::Create(output_surface.get(), | 3773 ResourceProvider::Create(output_surface.get(), |
3623 shared_bitmap_manager.get(), | 3774 shared_bitmap_manager.get(), |
| 3775 NULL, |
3624 0, | 3776 0, |
3625 false, | 3777 false, |
3626 kTextureAllocationChunkSize, | 3778 kTextureAllocationChunkSize, |
3627 false)); | 3779 false)); |
3628 | 3780 |
3629 ResourceProvider::ResourceId id = resource_provider->CreateResource( | 3781 ResourceProvider::ResourceId id = resource_provider->CreateResource( |
3630 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); | 3782 size, GL_CLAMP_TO_EDGE, ResourceProvider::TextureHintImmutable, format); |
3631 resource_provider->AllocateForTesting(id); | 3783 resource_provider->AllocateForTesting(id); |
3632 Mock::VerifyAndClearExpectations(context); | 3784 Mock::VerifyAndClearExpectations(context); |
3633 | 3785 |
3634 DCHECK_EQ(10u, context->PeekTextureId()); | 3786 DCHECK_EQ(10u, context->PeekTextureId()); |
3635 resource_provider->DeleteResource(id); | 3787 resource_provider->DeleteResource(id); |
3636 } | 3788 } |
3637 } | 3789 } |
3638 | 3790 |
3639 } // namespace | 3791 } // namespace |
3640 } // namespace cc | 3792 } // namespace cc |
OLD | NEW |