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 #include <vector> | 10 #include <vector> |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 break; | 414 break; |
415 } | 415 } |
416 CHECK(output_surface_->BindToClient(&output_surface_client_)); | 416 CHECK(output_surface_->BindToClient(&output_surface_client_)); |
417 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); | 417 CHECK(child_output_surface_->BindToClient(&child_output_surface_client_)); |
418 | 418 |
419 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 419 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
420 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 420 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
421 | 421 |
422 resource_provider_ = ResourceProvider::Create( | 422 resource_provider_ = ResourceProvider::Create( |
423 output_surface_.get(), shared_bitmap_manager_.get(), | 423 output_surface_.get(), shared_bitmap_manager_.get(), |
424 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 424 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
425 false, 1, use_image_texture_targets_); | 425 use_image_texture_targets_); |
426 child_resource_provider_ = ResourceProvider::Create( | 426 child_resource_provider_ = ResourceProvider::Create( |
427 child_output_surface_.get(), shared_bitmap_manager_.get(), | 427 child_output_surface_.get(), shared_bitmap_manager_.get(), |
428 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 428 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
429 false, 1, use_image_texture_targets_); | 429 use_image_texture_targets_); |
430 } | 430 } |
431 | 431 |
432 ResourceProviderTest() : ResourceProviderTest(true) {} | 432 ResourceProviderTest() : ResourceProviderTest(true) {} |
433 | 433 |
434 static void CollectResources(ReturnedResourceArray* array, | 434 static void CollectResources(ReturnedResourceArray* array, |
435 const ReturnedResourceArray& returned, | 435 const ReturnedResourceArray& returned, |
436 BlockingTaskRunner* main_thread_task_runner) { | 436 BlockingTaskRunner* main_thread_task_runner) { |
437 array->insert(array->end(), returned.begin(), returned.end()); | 437 array->insert(array->end(), returned.begin(), returned.end()); |
438 } | 438 } |
439 | 439 |
(...skipping 931 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 scoped_ptr<ResourceProviderContext> child_context_owned( | 1371 scoped_ptr<ResourceProviderContext> child_context_owned( |
1372 ResourceProviderContext::Create(shared_data_.get())); | 1372 ResourceProviderContext::Create(shared_data_.get())); |
1373 | 1373 |
1374 FakeOutputSurfaceClient child_output_surface_client; | 1374 FakeOutputSurfaceClient child_output_surface_client; |
1375 scoped_ptr<OutputSurface> child_output_surface( | 1375 scoped_ptr<OutputSurface> child_output_surface( |
1376 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1376 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1377 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1377 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1378 | 1378 |
1379 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( | 1379 scoped_ptr<ResourceProvider> child_resource_provider(ResourceProvider::Create( |
1380 child_output_surface.get(), shared_bitmap_manager_.get(), | 1380 child_output_surface.get(), shared_bitmap_manager_.get(), |
1381 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 1381 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
1382 use_image_texture_targets_)); | 1382 use_image_texture_targets_)); |
1383 | 1383 |
1384 gfx::Size size(1, 1); | 1384 gfx::Size size(1, 1); |
1385 ResourceFormat format = RGBA_8888; | 1385 ResourceFormat format = RGBA_8888; |
1386 size_t pixel_size = TextureSizeBytes(size, format); | 1386 size_t pixel_size = TextureSizeBytes(size, format); |
1387 ASSERT_EQ(4U, pixel_size); | 1387 ASSERT_EQ(4U, pixel_size); |
1388 | 1388 |
1389 ResourceId id1 = child_resource_provider->CreateResource( | 1389 ResourceId id1 = child_resource_provider->CreateResource( |
1390 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 1390 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
1391 uint8_t data1[4] = { 1, 2, 3, 4 }; | 1391 uint8_t data1[4] = { 1, 2, 3, 4 }; |
(...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1855 | 1855 |
1856 FakeOutputSurfaceClient child_output_surface_client; | 1856 FakeOutputSurfaceClient child_output_surface_client; |
1857 scoped_ptr<OutputSurface> child_output_surface( | 1857 scoped_ptr<OutputSurface> child_output_surface( |
1858 FakeOutputSurface::Create3d(child_context_owned.Pass())); | 1858 FakeOutputSurface::Create3d(child_context_owned.Pass())); |
1859 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1859 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
1860 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 1860 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
1861 new TestSharedBitmapManager()); | 1861 new TestSharedBitmapManager()); |
1862 | 1862 |
1863 scoped_ptr<ResourceProvider> child_resource_provider( | 1863 scoped_ptr<ResourceProvider> child_resource_provider( |
1864 ResourceProvider::Create(child_output_surface.get(), | 1864 ResourceProvider::Create(child_output_surface.get(), |
1865 shared_bitmap_manager.get(), NULL, NULL, 0, | 1865 shared_bitmap_manager.get(), NULL, NULL, 0, 1, |
1866 false, 1, use_image_texture_targets_)); | 1866 use_image_texture_targets_)); |
1867 | 1867 |
1868 scoped_ptr<TextureStateTrackingContext> parent_context_owned( | 1868 scoped_ptr<TextureStateTrackingContext> parent_context_owned( |
1869 new TextureStateTrackingContext); | 1869 new TextureStateTrackingContext); |
1870 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 1870 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
1871 | 1871 |
1872 FakeOutputSurfaceClient parent_output_surface_client; | 1872 FakeOutputSurfaceClient parent_output_surface_client; |
1873 scoped_ptr<OutputSurface> parent_output_surface( | 1873 scoped_ptr<OutputSurface> parent_output_surface( |
1874 FakeOutputSurface::Create3d(parent_context_owned.Pass())); | 1874 FakeOutputSurface::Create3d(parent_context_owned.Pass())); |
1875 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 1875 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
1876 | 1876 |
1877 scoped_ptr<ResourceProvider> parent_resource_provider( | 1877 scoped_ptr<ResourceProvider> parent_resource_provider( |
1878 ResourceProvider::Create(parent_output_surface.get(), | 1878 ResourceProvider::Create(parent_output_surface.get(), |
1879 shared_bitmap_manager.get(), NULL, NULL, 0, | 1879 shared_bitmap_manager.get(), NULL, NULL, 0, 1, |
1880 false, 1, use_image_texture_targets_)); | 1880 use_image_texture_targets_)); |
1881 | 1881 |
1882 gfx::Size size(1, 1); | 1882 gfx::Size size(1, 1); |
1883 ResourceFormat format = RGBA_8888; | 1883 ResourceFormat format = RGBA_8888; |
1884 int child_texture_id = 1; | 1884 int child_texture_id = 1; |
1885 int parent_texture_id = 2; | 1885 int parent_texture_id = 2; |
1886 | 1886 |
1887 size_t pixel_size = TextureSizeBytes(size, format); | 1887 size_t pixel_size = TextureSizeBytes(size, format); |
1888 ASSERT_EQ(4U, pixel_size); | 1888 ASSERT_EQ(4U, pixel_size); |
1889 | 1889 |
1890 ResourceId id = child_resource_provider->CreateResource( | 1890 ResourceId id = child_resource_provider->CreateResource( |
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2502 new TextureStateTrackingContext); | 2502 new TextureStateTrackingContext); |
2503 TextureStateTrackingContext* context = context_owned.get(); | 2503 TextureStateTrackingContext* context = context_owned.get(); |
2504 | 2504 |
2505 FakeOutputSurfaceClient output_surface_client; | 2505 FakeOutputSurfaceClient output_surface_client; |
2506 scoped_ptr<OutputSurface> output_surface( | 2506 scoped_ptr<OutputSurface> output_surface( |
2507 FakeOutputSurface::Create3d(context_owned.Pass())); | 2507 FakeOutputSurface::Create3d(context_owned.Pass())); |
2508 CHECK(output_surface->BindToClient(&output_surface_client)); | 2508 CHECK(output_surface->BindToClient(&output_surface_client)); |
2509 | 2509 |
2510 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2510 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2511 output_surface.get(), shared_bitmap_manager_.get(), | 2511 output_surface.get(), shared_bitmap_manager_.get(), |
2512 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 2512 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2513 use_image_texture_targets_)); | 2513 use_image_texture_targets_)); |
2514 | 2514 |
2515 gfx::Size size(1, 1); | 2515 gfx::Size size(1, 1); |
2516 ResourceFormat format = RGBA_8888; | 2516 ResourceFormat format = RGBA_8888; |
2517 int texture_id = 1; | 2517 int texture_id = 1; |
2518 | 2518 |
2519 ResourceId id = resource_provider->CreateResource( | 2519 ResourceId id = resource_provider->CreateResource( |
2520 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2520 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
2521 | 2521 |
2522 // Check that the texture gets created with the right sampler settings. | 2522 // Check that the texture gets created with the right sampler settings. |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2585 new TextureStateTrackingContext); | 2585 new TextureStateTrackingContext); |
2586 TextureStateTrackingContext* context = context_owned.get(); | 2586 TextureStateTrackingContext* context = context_owned.get(); |
2587 | 2587 |
2588 FakeOutputSurfaceClient output_surface_client; | 2588 FakeOutputSurfaceClient output_surface_client; |
2589 scoped_ptr<OutputSurface> output_surface( | 2589 scoped_ptr<OutputSurface> output_surface( |
2590 FakeOutputSurface::Create3d(context_owned.Pass())); | 2590 FakeOutputSurface::Create3d(context_owned.Pass())); |
2591 CHECK(output_surface->BindToClient(&output_surface_client)); | 2591 CHECK(output_surface->BindToClient(&output_surface_client)); |
2592 | 2592 |
2593 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2593 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2594 output_surface.get(), shared_bitmap_manager_.get(), | 2594 output_surface.get(), shared_bitmap_manager_.get(), |
2595 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 2595 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2596 use_image_texture_targets_)); | 2596 use_image_texture_targets_)); |
2597 | 2597 |
2598 gfx::Size size(1, 1); | 2598 gfx::Size size(1, 1); |
2599 ResourceFormat format = RGBA_8888; | 2599 ResourceFormat format = RGBA_8888; |
2600 int texture_id = 1; | 2600 int texture_id = 1; |
2601 | 2601 |
2602 // Check that the texture gets created with the right sampler settings. | 2602 // Check that the texture gets created with the right sampler settings. |
2603 ResourceId id = resource_provider->CreateManagedResource( | 2603 ResourceId id = resource_provider->CreateManagedResource( |
2604 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, | 2604 size, GL_TEXTURE_2D, GL_CLAMP_TO_EDGE, |
2605 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 2605 ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
(...skipping 27 matching lines...) Expand all Loading... |
2633 new TextureStateTrackingContext); | 2633 new TextureStateTrackingContext); |
2634 TextureStateTrackingContext* context = context_owned.get(); | 2634 TextureStateTrackingContext* context = context_owned.get(); |
2635 | 2635 |
2636 FakeOutputSurfaceClient output_surface_client; | 2636 FakeOutputSurfaceClient output_surface_client; |
2637 scoped_ptr<OutputSurface> output_surface( | 2637 scoped_ptr<OutputSurface> output_surface( |
2638 FakeOutputSurface::Create3d(context_owned.Pass())); | 2638 FakeOutputSurface::Create3d(context_owned.Pass())); |
2639 CHECK(output_surface->BindToClient(&output_surface_client)); | 2639 CHECK(output_surface->BindToClient(&output_surface_client)); |
2640 | 2640 |
2641 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2641 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2642 output_surface.get(), shared_bitmap_manager_.get(), | 2642 output_surface.get(), shared_bitmap_manager_.get(), |
2643 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 2643 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2644 use_image_texture_targets_)); | 2644 use_image_texture_targets_)); |
2645 | 2645 |
2646 gfx::Size size(1, 1); | 2646 gfx::Size size(1, 1); |
2647 ResourceFormat format = RGBA_8888; | 2647 ResourceFormat format = RGBA_8888; |
2648 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2648 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2649 | 2649 |
2650 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2650 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
2651 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; | 2651 GLint wrap_mode = texture_id == 1 ? GL_CLAMP_TO_EDGE : GL_REPEAT; |
2652 // Check that the texture gets created with the right sampler settings. | 2652 // Check that the texture gets created with the right sampler settings. |
2653 ResourceId id = resource_provider->CreateGLTexture( | 2653 ResourceId id = resource_provider->CreateGLTexture( |
(...skipping 30 matching lines...) Expand all Loading... |
2684 context->set_support_texture_storage(true); | 2684 context->set_support_texture_storage(true); |
2685 context->set_support_texture_usage(true); | 2685 context->set_support_texture_usage(true); |
2686 | 2686 |
2687 FakeOutputSurfaceClient output_surface_client; | 2687 FakeOutputSurfaceClient output_surface_client; |
2688 scoped_ptr<OutputSurface> output_surface( | 2688 scoped_ptr<OutputSurface> output_surface( |
2689 FakeOutputSurface::Create3d(context_owned.Pass())); | 2689 FakeOutputSurface::Create3d(context_owned.Pass())); |
2690 CHECK(output_surface->BindToClient(&output_surface_client)); | 2690 CHECK(output_surface->BindToClient(&output_surface_client)); |
2691 | 2691 |
2692 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2692 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2693 output_surface.get(), shared_bitmap_manager_.get(), | 2693 output_surface.get(), shared_bitmap_manager_.get(), |
2694 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 2694 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2695 use_image_texture_targets_)); | 2695 use_image_texture_targets_)); |
2696 | 2696 |
2697 gfx::Size size(1, 1); | 2697 gfx::Size size(1, 1); |
2698 ResourceFormat format = RGBA_8888; | 2698 ResourceFormat format = RGBA_8888; |
2699 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; | 2699 GLenum texture_pool = GL_TEXTURE_POOL_UNMANAGED_CHROMIUM; |
2700 | 2700 |
2701 const ResourceProvider::TextureHint hints[4] = { | 2701 const ResourceProvider::TextureHint hints[4] = { |
2702 ResourceProvider::TEXTURE_HINT_DEFAULT, | 2702 ResourceProvider::TEXTURE_HINT_DEFAULT, |
2703 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2703 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
2704 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 2704 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2749 CreateAndFillSharedBitmap(shared_bitmap_manager_.get(), size, kBadBeef)); | 2749 CreateAndFillSharedBitmap(shared_bitmap_manager_.get(), size, kBadBeef)); |
2750 | 2750 |
2751 FakeOutputSurfaceClient output_surface_client; | 2751 FakeOutputSurfaceClient output_surface_client; |
2752 scoped_ptr<OutputSurface> output_surface( | 2752 scoped_ptr<OutputSurface> output_surface( |
2753 FakeOutputSurface::CreateSoftware(make_scoped_ptr( | 2753 FakeOutputSurface::CreateSoftware(make_scoped_ptr( |
2754 new SoftwareOutputDevice))); | 2754 new SoftwareOutputDevice))); |
2755 CHECK(output_surface->BindToClient(&output_surface_client)); | 2755 CHECK(output_surface->BindToClient(&output_surface_client)); |
2756 | 2756 |
2757 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2757 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2758 output_surface.get(), shared_bitmap_manager_.get(), | 2758 output_surface.get(), shared_bitmap_manager_.get(), |
2759 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 2759 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
2760 false, 1, use_image_texture_targets_)); | 2760 use_image_texture_targets_)); |
2761 | 2761 |
2762 uint32 release_sync_point = 0; | 2762 uint32 release_sync_point = 0; |
2763 bool lost_resource = false; | 2763 bool lost_resource = false; |
2764 BlockingTaskRunner* main_thread_task_runner = NULL; | 2764 BlockingTaskRunner* main_thread_task_runner = NULL; |
2765 scoped_ptr<SingleReleaseCallbackImpl> callback = | 2765 scoped_ptr<SingleReleaseCallbackImpl> callback = |
2766 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, | 2766 SingleReleaseCallbackImpl::Create(base::Bind(&ReleaseCallback, |
2767 &release_sync_point, | 2767 &release_sync_point, |
2768 &lost_resource, | 2768 &lost_resource, |
2769 &main_thread_task_runner)); | 2769 &main_thread_task_runner)); |
2770 TextureMailbox mailbox(shared_bitmap.get(), size); | 2770 TextureMailbox mailbox(shared_bitmap.get(), size); |
(...skipping 28 matching lines...) Expand all Loading... |
2799 new TextureStateTrackingContext); | 2799 new TextureStateTrackingContext); |
2800 TextureStateTrackingContext* context = context_owned.get(); | 2800 TextureStateTrackingContext* context = context_owned.get(); |
2801 | 2801 |
2802 FakeOutputSurfaceClient output_surface_client; | 2802 FakeOutputSurfaceClient output_surface_client; |
2803 scoped_ptr<OutputSurface> output_surface( | 2803 scoped_ptr<OutputSurface> output_surface( |
2804 FakeOutputSurface::Create3d(context_owned.Pass())); | 2804 FakeOutputSurface::Create3d(context_owned.Pass())); |
2805 CHECK(output_surface->BindToClient(&output_surface_client)); | 2805 CHECK(output_surface->BindToClient(&output_surface_client)); |
2806 | 2806 |
2807 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2807 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2808 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, | 2808 output_surface.get(), shared_bitmap_manager, gpu_memory_buffer_manager, |
2809 main_thread_task_runner, 0, false, 1, use_image_texture_targets_)); | 2809 main_thread_task_runner, 0, 1, use_image_texture_targets_)); |
2810 | 2810 |
2811 unsigned texture_id = 1; | 2811 unsigned texture_id = 1; |
2812 uint32 sync_point = 30; | 2812 uint32 sync_point = 30; |
2813 unsigned target = GL_TEXTURE_2D; | 2813 unsigned target = GL_TEXTURE_2D; |
2814 | 2814 |
2815 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2815 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2816 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2816 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2817 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2817 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2818 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2818 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2819 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2819 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2942 new TextureStateTrackingContext); | 2942 new TextureStateTrackingContext); |
2943 TextureStateTrackingContext* context = context_owned.get(); | 2943 TextureStateTrackingContext* context = context_owned.get(); |
2944 | 2944 |
2945 FakeOutputSurfaceClient output_surface_client; | 2945 FakeOutputSurfaceClient output_surface_client; |
2946 scoped_ptr<OutputSurface> output_surface( | 2946 scoped_ptr<OutputSurface> output_surface( |
2947 FakeOutputSurface::Create3d(context_owned.Pass())); | 2947 FakeOutputSurface::Create3d(context_owned.Pass())); |
2948 CHECK(output_surface->BindToClient(&output_surface_client)); | 2948 CHECK(output_surface->BindToClient(&output_surface_client)); |
2949 | 2949 |
2950 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 2950 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
2951 output_surface.get(), shared_bitmap_manager_.get(), | 2951 output_surface.get(), shared_bitmap_manager_.get(), |
2952 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 2952 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
2953 use_image_texture_targets_)); | 2953 use_image_texture_targets_)); |
2954 | 2954 |
2955 uint32 sync_point = 30; | 2955 uint32 sync_point = 30; |
2956 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 2956 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
2957 | 2957 |
2958 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2958 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
2959 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 2959 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
2960 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 2960 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
2961 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 2961 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
2962 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 2962 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3012 new TextureStateTrackingContext); | 3012 new TextureStateTrackingContext); |
3013 TextureStateTrackingContext* context = context_owned.get(); | 3013 TextureStateTrackingContext* context = context_owned.get(); |
3014 | 3014 |
3015 FakeOutputSurfaceClient output_surface_client; | 3015 FakeOutputSurfaceClient output_surface_client; |
3016 scoped_ptr<OutputSurface> output_surface( | 3016 scoped_ptr<OutputSurface> output_surface( |
3017 FakeOutputSurface::Create3d(context_owned.Pass())); | 3017 FakeOutputSurface::Create3d(context_owned.Pass())); |
3018 CHECK(output_surface->BindToClient(&output_surface_client)); | 3018 CHECK(output_surface->BindToClient(&output_surface_client)); |
3019 | 3019 |
3020 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3020 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3021 output_surface.get(), shared_bitmap_manager_.get(), | 3021 output_surface.get(), shared_bitmap_manager_.get(), |
3022 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3022 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3023 use_image_texture_targets_)); | 3023 use_image_texture_targets_)); |
3024 | 3024 |
3025 uint32 sync_point = 30; | 3025 uint32 sync_point = 30; |
3026 unsigned target = GL_TEXTURE_2D; | 3026 unsigned target = GL_TEXTURE_2D; |
3027 | 3027 |
3028 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3028 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
3029 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 3029 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
3030 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 3030 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
3031 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3031 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
3032 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3032 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3066 new TextureStateTrackingContext); | 3066 new TextureStateTrackingContext); |
3067 TextureStateTrackingContext* context = context_owned.get(); | 3067 TextureStateTrackingContext* context = context_owned.get(); |
3068 | 3068 |
3069 FakeOutputSurfaceClient output_surface_client; | 3069 FakeOutputSurfaceClient output_surface_client; |
3070 scoped_ptr<OutputSurface> output_surface( | 3070 scoped_ptr<OutputSurface> output_surface( |
3071 FakeOutputSurface::Create3d(context_owned.Pass())); | 3071 FakeOutputSurface::Create3d(context_owned.Pass())); |
3072 CHECK(output_surface->BindToClient(&output_surface_client)); | 3072 CHECK(output_surface->BindToClient(&output_surface_client)); |
3073 | 3073 |
3074 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3074 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3075 output_surface.get(), shared_bitmap_manager_.get(), | 3075 output_surface.get(), shared_bitmap_manager_.get(), |
3076 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3076 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3077 use_image_texture_targets_)); | 3077 use_image_texture_targets_)); |
3078 | 3078 |
3079 uint32 sync_point = 0; | 3079 uint32 sync_point = 0; |
3080 unsigned target = GL_TEXTURE_2D; | 3080 unsigned target = GL_TEXTURE_2D; |
3081 | 3081 |
3082 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3082 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
3083 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); | 3083 EXPECT_CALL(*context, waitSyncPoint(_)).Times(0); |
3084 EXPECT_CALL(*context, insertSyncPoint()).Times(0); | 3084 EXPECT_CALL(*context, insertSyncPoint()).Times(0); |
3085 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3085 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
3086 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3086 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3187 new StrictMock<AllocationTrackingContext3D>); | 3187 new StrictMock<AllocationTrackingContext3D>); |
3188 AllocationTrackingContext3D* context = context_owned.get(); | 3188 AllocationTrackingContext3D* context = context_owned.get(); |
3189 | 3189 |
3190 FakeOutputSurfaceClient output_surface_client; | 3190 FakeOutputSurfaceClient output_surface_client; |
3191 scoped_ptr<OutputSurface> output_surface( | 3191 scoped_ptr<OutputSurface> output_surface( |
3192 FakeOutputSurface::Create3d(context_owned.Pass())); | 3192 FakeOutputSurface::Create3d(context_owned.Pass())); |
3193 CHECK(output_surface->BindToClient(&output_surface_client)); | 3193 CHECK(output_surface->BindToClient(&output_surface_client)); |
3194 | 3194 |
3195 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3195 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3196 output_surface.get(), shared_bitmap_manager_.get(), | 3196 output_surface.get(), shared_bitmap_manager_.get(), |
3197 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3197 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3198 use_image_texture_targets_)); | 3198 use_image_texture_targets_)); |
3199 | 3199 |
3200 gfx::Size size(2, 2); | 3200 gfx::Size size(2, 2); |
3201 gfx::Vector2d offset(0, 0); | 3201 gfx::Vector2d offset(0, 0); |
3202 ResourceFormat format = RGBA_8888; | 3202 ResourceFormat format = RGBA_8888; |
3203 ResourceId id = 0; | 3203 ResourceId id = 0; |
3204 uint8_t pixels[16] = { 0 }; | 3204 uint8_t pixels[16] = { 0 }; |
3205 int texture_id = 123; | 3205 int texture_id = 123; |
3206 | 3206 |
3207 // Lazy allocation. Don't allocate when creating the resource. | 3207 // Lazy allocation. Don't allocate when creating the resource. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3243 context->set_support_texture_storage(true); | 3243 context->set_support_texture_storage(true); |
3244 context->set_support_texture_usage(true); | 3244 context->set_support_texture_usage(true); |
3245 | 3245 |
3246 FakeOutputSurfaceClient output_surface_client; | 3246 FakeOutputSurfaceClient output_surface_client; |
3247 scoped_ptr<OutputSurface> output_surface( | 3247 scoped_ptr<OutputSurface> output_surface( |
3248 FakeOutputSurface::Create3d(context_owned.Pass())); | 3248 FakeOutputSurface::Create3d(context_owned.Pass())); |
3249 CHECK(output_surface->BindToClient(&output_surface_client)); | 3249 CHECK(output_surface->BindToClient(&output_surface_client)); |
3250 | 3250 |
3251 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3251 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3252 output_surface.get(), shared_bitmap_manager_.get(), | 3252 output_surface.get(), shared_bitmap_manager_.get(), |
3253 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3253 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3254 use_image_texture_targets_)); | 3254 use_image_texture_targets_)); |
3255 | 3255 |
3256 gfx::Size size(2, 2); | 3256 gfx::Size size(2, 2); |
3257 | 3257 |
3258 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3258 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3259 const ResourceProvider::TextureHint hints[4] = { | 3259 const ResourceProvider::TextureHint hints[4] = { |
3260 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3260 ResourceProvider::TEXTURE_HINT_DEFAULT, |
3261 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3261 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3262 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3262 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
3263 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3263 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3299 context->set_support_texture_storage(true); | 3299 context->set_support_texture_storage(true); |
3300 context->set_support_texture_usage(true); | 3300 context->set_support_texture_usage(true); |
3301 | 3301 |
3302 FakeOutputSurfaceClient output_surface_client; | 3302 FakeOutputSurfaceClient output_surface_client; |
3303 scoped_ptr<OutputSurface> output_surface( | 3303 scoped_ptr<OutputSurface> output_surface( |
3304 FakeOutputSurface::Create3d(context_owned.Pass())); | 3304 FakeOutputSurface::Create3d(context_owned.Pass())); |
3305 CHECK(output_surface->BindToClient(&output_surface_client)); | 3305 CHECK(output_surface->BindToClient(&output_surface_client)); |
3306 | 3306 |
3307 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3307 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3308 output_surface.get(), shared_bitmap_manager_.get(), | 3308 output_surface.get(), shared_bitmap_manager_.get(), |
3309 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3309 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3310 use_image_texture_targets_)); | 3310 use_image_texture_targets_)); |
3311 | 3311 |
3312 gfx::Size size(2, 2); | 3312 gfx::Size size(2, 2); |
3313 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3313 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
3314 | 3314 |
3315 const ResourceProvider::TextureHint hints[4] = { | 3315 const ResourceProvider::TextureHint hints[4] = { |
3316 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3316 ResourceProvider::TEXTURE_HINT_DEFAULT, |
3317 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3317 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3318 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3318 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
3319 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3319 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3358 const int kWidth = 2; | 3358 const int kWidth = 2; |
3359 const int kHeight = 2; | 3359 const int kHeight = 2; |
3360 gfx::Size size(kWidth, kHeight); | 3360 gfx::Size size(kWidth, kHeight); |
3361 ResourceFormat format = RGBA_8888; | 3361 ResourceFormat format = RGBA_8888; |
3362 ResourceId id = 0; | 3362 ResourceId id = 0; |
3363 const unsigned kTextureId = 123u; | 3363 const unsigned kTextureId = 123u; |
3364 const unsigned kImageId = 234u; | 3364 const unsigned kImageId = 234u; |
3365 | 3365 |
3366 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3366 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3367 output_surface.get(), shared_bitmap_manager_.get(), | 3367 output_surface.get(), shared_bitmap_manager_.get(), |
3368 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3368 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3369 use_image_texture_targets_)); | 3369 use_image_texture_targets_)); |
3370 | 3370 |
3371 id = resource_provider->CreateResource( | 3371 id = resource_provider->CreateResource( |
3372 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); | 3372 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format); |
3373 | 3373 |
3374 EXPECT_CALL(*context, NextTextureId()) | 3374 EXPECT_CALL(*context, NextTextureId()) |
3375 .WillOnce(Return(kTextureId)) | 3375 .WillOnce(Return(kTextureId)) |
3376 .RetiresOnSaturation(); | 3376 .RetiresOnSaturation(); |
3377 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3377 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
3378 .Times(1) | 3378 .Times(1) |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3436 context_owned->set_support_compressed_texture_etc1(true); | 3436 context_owned->set_support_compressed_texture_etc1(true); |
3437 | 3437 |
3438 FakeOutputSurfaceClient output_surface_client; | 3438 FakeOutputSurfaceClient output_surface_client; |
3439 scoped_ptr<OutputSurface> output_surface( | 3439 scoped_ptr<OutputSurface> output_surface( |
3440 FakeOutputSurface::Create3d(context_owned.Pass())); | 3440 FakeOutputSurface::Create3d(context_owned.Pass())); |
3441 CHECK(output_surface->BindToClient(&output_surface_client)); | 3441 CHECK(output_surface->BindToClient(&output_surface_client)); |
3442 | 3442 |
3443 gfx::Size size(4, 4); | 3443 gfx::Size size(4, 4); |
3444 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3444 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3445 output_surface.get(), shared_bitmap_manager_.get(), | 3445 output_surface.get(), shared_bitmap_manager_.get(), |
3446 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3446 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3447 use_image_texture_targets_)); | 3447 use_image_texture_targets_)); |
3448 int texture_id = 123; | 3448 int texture_id = 123; |
3449 | 3449 |
3450 ResourceId id = resource_provider->CreateResource( | 3450 ResourceId id = resource_provider->CreateResource( |
3451 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3451 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
3452 EXPECT_NE(0u, id); | 3452 EXPECT_NE(0u, id); |
3453 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3453 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3454 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3454 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
3455 resource_provider->AllocateForTesting(id); | 3455 resource_provider->AllocateForTesting(id); |
3456 | 3456 |
(...skipping 11 matching lines...) Expand all Loading... |
3468 context_owned->set_support_compressed_texture_etc1(true); | 3468 context_owned->set_support_compressed_texture_etc1(true); |
3469 | 3469 |
3470 FakeOutputSurfaceClient output_surface_client; | 3470 FakeOutputSurfaceClient output_surface_client; |
3471 scoped_ptr<OutputSurface> output_surface( | 3471 scoped_ptr<OutputSurface> output_surface( |
3472 FakeOutputSurface::Create3d(context_owned.Pass())); | 3472 FakeOutputSurface::Create3d(context_owned.Pass())); |
3473 CHECK(output_surface->BindToClient(&output_surface_client)); | 3473 CHECK(output_surface->BindToClient(&output_surface_client)); |
3474 | 3474 |
3475 gfx::Size size(4, 4); | 3475 gfx::Size size(4, 4); |
3476 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3476 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3477 output_surface.get(), shared_bitmap_manager_.get(), | 3477 output_surface.get(), shared_bitmap_manager_.get(), |
3478 gpu_memory_buffer_manager_.get(), NULL, 0, false, 1, | 3478 gpu_memory_buffer_manager_.get(), NULL, 0, 1, |
3479 use_image_texture_targets_)); | 3479 use_image_texture_targets_)); |
3480 int texture_id = 123; | 3480 int texture_id = 123; |
3481 uint8_t pixels[8]; | 3481 uint8_t pixels[8]; |
3482 | 3482 |
3483 ResourceId id = resource_provider->CreateResource( | 3483 ResourceId id = resource_provider->CreateResource( |
3484 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); | 3484 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1); |
3485 EXPECT_NE(0u, id); | 3485 EXPECT_NE(0u, id); |
3486 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3486 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
3487 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3487 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
3488 EXPECT_CALL(*context, | 3488 EXPECT_CALL(*context, |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3524 CHECK(output_surface->BindToClient(&output_surface_client)); | 3524 CHECK(output_surface->BindToClient(&output_surface_client)); |
3525 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( | 3525 scoped_ptr<SharedBitmapManager> shared_bitmap_manager( |
3526 new TestSharedBitmapManager()); | 3526 new TestSharedBitmapManager()); |
3527 | 3527 |
3528 gfx::Size size(1, 1); | 3528 gfx::Size size(1, 1); |
3529 ResourceFormat format = RGBA_8888; | 3529 ResourceFormat format = RGBA_8888; |
3530 | 3530 |
3531 { | 3531 { |
3532 size_t kTextureAllocationChunkSize = 1; | 3532 size_t kTextureAllocationChunkSize = 1; |
3533 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3533 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3534 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, | 3534 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, |
3535 kTextureAllocationChunkSize, | 3535 kTextureAllocationChunkSize, |
3536 ResourceProviderTest::use_image_texture_targets())); | 3536 ResourceProviderTest::use_image_texture_targets())); |
3537 | 3537 |
3538 ResourceId id = resource_provider->CreateResource( | 3538 ResourceId id = resource_provider->CreateResource( |
3539 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3539 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3540 format); | 3540 format); |
3541 resource_provider->AllocateForTesting(id); | 3541 resource_provider->AllocateForTesting(id); |
3542 Mock::VerifyAndClearExpectations(context); | 3542 Mock::VerifyAndClearExpectations(context); |
3543 | 3543 |
3544 DCHECK_EQ(2u, context->PeekTextureId()); | 3544 DCHECK_EQ(2u, context->PeekTextureId()); |
3545 resource_provider->DeleteResource(id); | 3545 resource_provider->DeleteResource(id); |
3546 } | 3546 } |
3547 | 3547 |
3548 { | 3548 { |
3549 size_t kTextureAllocationChunkSize = 8; | 3549 size_t kTextureAllocationChunkSize = 8; |
3550 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( | 3550 scoped_ptr<ResourceProvider> resource_provider(ResourceProvider::Create( |
3551 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, false, | 3551 output_surface.get(), shared_bitmap_manager.get(), NULL, NULL, 0, |
3552 kTextureAllocationChunkSize, | 3552 kTextureAllocationChunkSize, |
3553 ResourceProviderTest::use_image_texture_targets())); | 3553 ResourceProviderTest::use_image_texture_targets())); |
3554 | 3554 |
3555 ResourceId id = resource_provider->CreateResource( | 3555 ResourceId id = resource_provider->CreateResource( |
3556 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3556 size, GL_CLAMP_TO_EDGE, ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
3557 format); | 3557 format); |
3558 resource_provider->AllocateForTesting(id); | 3558 resource_provider->AllocateForTesting(id); |
3559 Mock::VerifyAndClearExpectations(context); | 3559 Mock::VerifyAndClearExpectations(context); |
3560 | 3560 |
3561 DCHECK_EQ(10u, context->PeekTextureId()); | 3561 DCHECK_EQ(10u, context->PeekTextureId()); |
3562 resource_provider->DeleteResource(id); | 3562 resource_provider->DeleteResource(id); |
3563 } | 3563 } |
3564 } | 3564 } |
3565 | 3565 |
3566 } // namespace | 3566 } // namespace |
3567 } // namespace cc | 3567 } // namespace cc |
OLD | NEW |