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