| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 using testing::Mock; | 41 using testing::Mock; |
| 42 using testing::NiceMock; | 42 using testing::NiceMock; |
| 43 using testing::Return; | 43 using testing::Return; |
| 44 using testing::StrictMock; | 44 using testing::StrictMock; |
| 45 using testing::_; | 45 using testing::_; |
| 46 | 46 |
| 47 namespace cc { | 47 namespace cc { |
| 48 namespace { | 48 namespace { |
| 49 | 49 |
| 50 static const bool kUseGpuMemoryBufferResources = false; | 50 static const bool kUseGpuMemoryBufferResources = false; |
| 51 static const bool kEnableColorCorrectRendering = false; |
| 51 static const bool kDelegatedSyncPointsRequired = true; | 52 static const bool kDelegatedSyncPointsRequired = true; |
| 52 | 53 |
| 53 MATCHER_P(MatchesSyncToken, sync_token, "") { | 54 MATCHER_P(MatchesSyncToken, sync_token, "") { |
| 54 gpu::SyncToken other; | 55 gpu::SyncToken other; |
| 55 memcpy(&other, arg, sizeof(other)); | 56 memcpy(&other, arg, sizeof(other)); |
| 56 return other == sync_token; | 57 return other == sync_token; |
| 57 } | 58 } |
| 58 | 59 |
| 59 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, | 60 static void EmptyReleaseCallback(const gpu::SyncToken& sync_token, |
| 60 bool lost_resource, | 61 bool lost_resource, |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 460 | 461 |
| 461 shared_bitmap_manager_.reset(new TestSharedBitmapManager); | 462 shared_bitmap_manager_.reset(new TestSharedBitmapManager); |
| 462 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); | 463 gpu_memory_buffer_manager_.reset(new TestGpuMemoryBufferManager); |
| 463 child_gpu_memory_buffer_manager_ = | 464 child_gpu_memory_buffer_manager_ = |
| 464 gpu_memory_buffer_manager_->CreateClientGpuMemoryBufferManager(); | 465 gpu_memory_buffer_manager_->CreateClientGpuMemoryBufferManager(); |
| 465 | 466 |
| 466 resource_provider_ = base::MakeUnique<ResourceProvider>( | 467 resource_provider_ = base::MakeUnique<ResourceProvider>( |
| 467 output_surface_->context_provider(), shared_bitmap_manager_.get(), | 468 output_surface_->context_provider(), shared_bitmap_manager_.get(), |
| 468 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, | 469 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, 1, |
| 469 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 470 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 471 kEnableColorCorrectRendering, |
| 470 DefaultBufferToTextureTargetMapForTesting()); | 472 DefaultBufferToTextureTargetMapForTesting()); |
| 471 child_resource_provider_ = base::MakeUnique<ResourceProvider>( | 473 child_resource_provider_ = base::MakeUnique<ResourceProvider>( |
| 472 child_output_surface_->context_provider(), shared_bitmap_manager_.get(), | 474 child_output_surface_->context_provider(), shared_bitmap_manager_.get(), |
| 473 child_gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), | 475 child_gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), |
| 474 0, 1, | 476 0, 1, |
| 475 child_output_surface_->capabilities().delegated_sync_points_required, | 477 child_output_surface_->capabilities().delegated_sync_points_required, |
| 476 kUseGpuMemoryBufferResources, | 478 kUseGpuMemoryBufferResources, kEnableColorCorrectRendering, |
| 477 DefaultBufferToTextureTargetMapForTesting()); | 479 DefaultBufferToTextureTargetMapForTesting()); |
| 478 } | 480 } |
| 479 | 481 |
| 480 ResourceProviderTest() : ResourceProviderTest(true) {} | 482 ResourceProviderTest() : ResourceProviderTest(true) {} |
| 481 | 483 |
| 482 static void CollectResources(ReturnedResourceArray* array, | 484 static void CollectResources(ReturnedResourceArray* array, |
| 483 const ReturnedResourceArray& returned, | 485 const ReturnedResourceArray& returned, |
| 484 BlockingTaskRunner* main_thread_task_runner) { | 486 BlockingTaskRunner* main_thread_task_runner) { |
| 485 array->insert(array->end(), returned.begin(), returned.end()); | 487 array->insert(array->end(), returned.begin(), returned.end()); |
| 486 } | 488 } |
| (...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1484 FakeOutputSurfaceClient child_output_surface_client; | 1486 FakeOutputSurfaceClient child_output_surface_client; |
| 1485 std::unique_ptr<OutputSurface> child_output_surface( | 1487 std::unique_ptr<OutputSurface> child_output_surface( |
| 1486 FakeOutputSurface::Create3d(std::move(child_context_owned))); | 1488 FakeOutputSurface::Create3d(std::move(child_context_owned))); |
| 1487 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 1489 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 1488 | 1490 |
| 1489 std::unique_ptr<ResourceProvider> child_resource_provider( | 1491 std::unique_ptr<ResourceProvider> child_resource_provider( |
| 1490 base::MakeUnique<ResourceProvider>( | 1492 base::MakeUnique<ResourceProvider>( |
| 1491 child_output_surface->context_provider(), | 1493 child_output_surface->context_provider(), |
| 1492 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), | 1494 shared_bitmap_manager_.get(), gpu_memory_buffer_manager_.get(), |
| 1493 nullptr, 0, 1, kDelegatedSyncPointsRequired, | 1495 nullptr, 0, 1, kDelegatedSyncPointsRequired, |
| 1494 kUseGpuMemoryBufferResources, | 1496 kUseGpuMemoryBufferResources, kEnableColorCorrectRendering, |
| 1495 DefaultBufferToTextureTargetMapForTesting())); | 1497 DefaultBufferToTextureTargetMapForTesting())); |
| 1496 | 1498 |
| 1497 gfx::Size size(1, 1); | 1499 gfx::Size size(1, 1); |
| 1498 ResourceFormat format = RGBA_8888; | 1500 ResourceFormat format = RGBA_8888; |
| 1499 size_t pixel_size = TextureSizeBytes(size, format); | 1501 size_t pixel_size = TextureSizeBytes(size, format); |
| 1500 ASSERT_EQ(4U, pixel_size); | 1502 ASSERT_EQ(4U, pixel_size); |
| 1501 | 1503 |
| 1502 ResourceId id1 = child_resource_provider->CreateResource( | 1504 ResourceId id1 = child_resource_provider->CreateResource( |
| 1503 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 1505 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 1504 gfx::ColorSpace()); | 1506 gfx::ColorSpace()); |
| (...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2009 FakeOutputSurface::Create3d(std::move(child_context_owned))); | 2011 FakeOutputSurface::Create3d(std::move(child_context_owned))); |
| 2010 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); | 2012 CHECK(child_output_surface->BindToClient(&child_output_surface_client)); |
| 2011 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager( | 2013 std::unique_ptr<SharedBitmapManager> shared_bitmap_manager( |
| 2012 new TestSharedBitmapManager()); | 2014 new TestSharedBitmapManager()); |
| 2013 | 2015 |
| 2014 std::unique_ptr<ResourceProvider> child_resource_provider( | 2016 std::unique_ptr<ResourceProvider> child_resource_provider( |
| 2015 base::MakeUnique<ResourceProvider>( | 2017 base::MakeUnique<ResourceProvider>( |
| 2016 child_output_surface->context_provider(), | 2018 child_output_surface->context_provider(), |
| 2017 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, | 2019 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, |
| 2018 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2020 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2021 kEnableColorCorrectRendering, |
| 2019 DefaultBufferToTextureTargetMapForTesting())); | 2022 DefaultBufferToTextureTargetMapForTesting())); |
| 2020 | 2023 |
| 2021 std::unique_ptr<TextureStateTrackingContext> parent_context_owned( | 2024 std::unique_ptr<TextureStateTrackingContext> parent_context_owned( |
| 2022 new TextureStateTrackingContext); | 2025 new TextureStateTrackingContext); |
| 2023 TextureStateTrackingContext* parent_context = parent_context_owned.get(); | 2026 TextureStateTrackingContext* parent_context = parent_context_owned.get(); |
| 2024 | 2027 |
| 2025 FakeOutputSurfaceClient parent_output_surface_client; | 2028 FakeOutputSurfaceClient parent_output_surface_client; |
| 2026 std::unique_ptr<OutputSurface> parent_output_surface( | 2029 std::unique_ptr<OutputSurface> parent_output_surface( |
| 2027 FakeOutputSurface::Create3d(std::move(parent_context_owned))); | 2030 FakeOutputSurface::Create3d(std::move(parent_context_owned))); |
| 2028 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); | 2031 CHECK(parent_output_surface->BindToClient(&parent_output_surface_client)); |
| 2029 | 2032 |
| 2030 std::unique_ptr<ResourceProvider> parent_resource_provider( | 2033 std::unique_ptr<ResourceProvider> parent_resource_provider( |
| 2031 base::MakeUnique<ResourceProvider>( | 2034 base::MakeUnique<ResourceProvider>( |
| 2032 parent_output_surface->context_provider(), | 2035 parent_output_surface->context_provider(), |
| 2033 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, | 2036 shared_bitmap_manager.get(), nullptr, nullptr, 0, 1, |
| 2034 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2037 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2038 kEnableColorCorrectRendering, |
| 2035 DefaultBufferToTextureTargetMapForTesting())); | 2039 DefaultBufferToTextureTargetMapForTesting())); |
| 2036 | 2040 |
| 2037 gfx::Size size(1, 1); | 2041 gfx::Size size(1, 1); |
| 2038 ResourceFormat format = RGBA_8888; | 2042 ResourceFormat format = RGBA_8888; |
| 2039 int child_texture_id = 1; | 2043 int child_texture_id = 1; |
| 2040 int parent_texture_id = 2; | 2044 int parent_texture_id = 2; |
| 2041 | 2045 |
| 2042 size_t pixel_size = TextureSizeBytes(size, format); | 2046 size_t pixel_size = TextureSizeBytes(size, format); |
| 2043 ASSERT_EQ(4U, pixel_size); | 2047 ASSERT_EQ(4U, pixel_size); |
| 2044 | 2048 |
| (...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2665 FakeOutputSurfaceClient output_surface_client; | 2669 FakeOutputSurfaceClient output_surface_client; |
| 2666 std::unique_ptr<OutputSurface> output_surface( | 2670 std::unique_ptr<OutputSurface> output_surface( |
| 2667 FakeOutputSurface::Create3d(std::move(context_owned))); | 2671 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2668 CHECK(output_surface->BindToClient(&output_surface_client)); | 2672 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2669 | 2673 |
| 2670 std::unique_ptr<ResourceProvider> resource_provider( | 2674 std::unique_ptr<ResourceProvider> resource_provider( |
| 2671 base::MakeUnique<ResourceProvider>( | 2675 base::MakeUnique<ResourceProvider>( |
| 2672 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2676 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2673 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2677 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2674 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2678 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2679 kEnableColorCorrectRendering, |
| 2675 DefaultBufferToTextureTargetMapForTesting())); | 2680 DefaultBufferToTextureTargetMapForTesting())); |
| 2676 | 2681 |
| 2677 gfx::Size size(1, 1); | 2682 gfx::Size size(1, 1); |
| 2678 ResourceFormat format = RGBA_8888; | 2683 ResourceFormat format = RGBA_8888; |
| 2679 int texture_id = 1; | 2684 int texture_id = 1; |
| 2680 | 2685 |
| 2681 ResourceId id = resource_provider->CreateResource( | 2686 ResourceId id = resource_provider->CreateResource( |
| 2682 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 2687 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 2683 gfx::ColorSpace()); | 2688 gfx::ColorSpace()); |
| 2684 | 2689 |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2747 FakeOutputSurfaceClient output_surface_client; | 2752 FakeOutputSurfaceClient output_surface_client; |
| 2748 std::unique_ptr<OutputSurface> output_surface( | 2753 std::unique_ptr<OutputSurface> output_surface( |
| 2749 FakeOutputSurface::Create3d(std::move(context_owned))); | 2754 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2750 CHECK(output_surface->BindToClient(&output_surface_client)); | 2755 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2751 | 2756 |
| 2752 std::unique_ptr<ResourceProvider> resource_provider( | 2757 std::unique_ptr<ResourceProvider> resource_provider( |
| 2753 base::MakeUnique<ResourceProvider>( | 2758 base::MakeUnique<ResourceProvider>( |
| 2754 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2759 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2755 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2760 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2756 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2761 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2762 kEnableColorCorrectRendering, |
| 2757 DefaultBufferToTextureTargetMapForTesting())); | 2763 DefaultBufferToTextureTargetMapForTesting())); |
| 2758 | 2764 |
| 2759 gfx::Size size(1, 1); | 2765 gfx::Size size(1, 1); |
| 2760 ResourceFormat format = RGBA_8888; | 2766 ResourceFormat format = RGBA_8888; |
| 2761 int texture_id = 1; | 2767 int texture_id = 1; |
| 2762 | 2768 |
| 2763 // Check that the texture gets created with the right sampler settings. | 2769 // Check that the texture gets created with the right sampler settings. |
| 2764 ResourceId id = resource_provider->CreateResource( | 2770 ResourceId id = resource_provider->CreateResource( |
| 2765 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 2771 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 2766 gfx::ColorSpace()); | 2772 gfx::ColorSpace()); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 2793 FakeOutputSurfaceClient output_surface_client; | 2799 FakeOutputSurfaceClient output_surface_client; |
| 2794 std::unique_ptr<OutputSurface> output_surface( | 2800 std::unique_ptr<OutputSurface> output_surface( |
| 2795 FakeOutputSurface::Create3d(std::move(context_owned))); | 2801 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2796 CHECK(output_surface->BindToClient(&output_surface_client)); | 2802 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2797 | 2803 |
| 2798 std::unique_ptr<ResourceProvider> resource_provider( | 2804 std::unique_ptr<ResourceProvider> resource_provider( |
| 2799 base::MakeUnique<ResourceProvider>( | 2805 base::MakeUnique<ResourceProvider>( |
| 2800 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2806 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2801 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2807 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2802 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2808 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2809 kEnableColorCorrectRendering, |
| 2803 DefaultBufferToTextureTargetMapForTesting())); | 2810 DefaultBufferToTextureTargetMapForTesting())); |
| 2804 | 2811 |
| 2805 gfx::Size size(1, 1); | 2812 gfx::Size size(1, 1); |
| 2806 ResourceFormat format = RGBA_8888; | 2813 ResourceFormat format = RGBA_8888; |
| 2807 | 2814 |
| 2808 for (int texture_id = 1; texture_id <= 2; ++texture_id) { | 2815 for (int texture_id = 1; texture_id <= 2; ++texture_id) { |
| 2809 // Check that the texture gets created with the right sampler settings. | 2816 // Check that the texture gets created with the right sampler settings. |
| 2810 ResourceId id = resource_provider->CreateResource( | 2817 ResourceId id = resource_provider->CreateResource( |
| 2811 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 2818 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 2812 gfx::ColorSpace()); | 2819 gfx::ColorSpace()); |
| (...skipping 27 matching lines...) Expand all Loading... |
| 2840 FakeOutputSurfaceClient output_surface_client; | 2847 FakeOutputSurfaceClient output_surface_client; |
| 2841 std::unique_ptr<OutputSurface> output_surface( | 2848 std::unique_ptr<OutputSurface> output_surface( |
| 2842 FakeOutputSurface::Create3d(std::move(context_owned))); | 2849 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2843 CHECK(output_surface->BindToClient(&output_surface_client)); | 2850 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2844 | 2851 |
| 2845 std::unique_ptr<ResourceProvider> resource_provider( | 2852 std::unique_ptr<ResourceProvider> resource_provider( |
| 2846 base::MakeUnique<ResourceProvider>( | 2853 base::MakeUnique<ResourceProvider>( |
| 2847 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2854 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2848 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 2855 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 2849 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2856 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2857 kEnableColorCorrectRendering, |
| 2850 DefaultBufferToTextureTargetMapForTesting())); | 2858 DefaultBufferToTextureTargetMapForTesting())); |
| 2851 | 2859 |
| 2852 gfx::Size size(1, 1); | 2860 gfx::Size size(1, 1); |
| 2853 ResourceFormat format = RGBA_8888; | 2861 ResourceFormat format = RGBA_8888; |
| 2854 | 2862 |
| 2855 const ResourceProvider::TextureHint hints[4] = { | 2863 const ResourceProvider::TextureHint hints[4] = { |
| 2856 ResourceProvider::TEXTURE_HINT_DEFAULT, | 2864 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 2857 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 2865 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 2858 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 2866 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 2859 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 2867 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2901 std::unique_ptr<OutputSurface> output_surface( | 2909 std::unique_ptr<OutputSurface> output_surface( |
| 2902 FakeOutputSurface::CreateSoftware( | 2910 FakeOutputSurface::CreateSoftware( |
| 2903 base::WrapUnique(new SoftwareOutputDevice))); | 2911 base::WrapUnique(new SoftwareOutputDevice))); |
| 2904 CHECK(output_surface->BindToClient(&output_surface_client)); | 2912 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2905 | 2913 |
| 2906 std::unique_ptr<ResourceProvider> resource_provider( | 2914 std::unique_ptr<ResourceProvider> resource_provider( |
| 2907 base::MakeUnique<ResourceProvider>( | 2915 base::MakeUnique<ResourceProvider>( |
| 2908 output_surface->context_provider(), shared_bitmap_manager_.get(), | 2916 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 2909 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, | 2917 gpu_memory_buffer_manager_.get(), main_thread_task_runner_.get(), 0, |
| 2910 1, kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2918 1, kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2919 kEnableColorCorrectRendering, |
| 2911 DefaultBufferToTextureTargetMapForTesting())); | 2920 DefaultBufferToTextureTargetMapForTesting())); |
| 2912 | 2921 |
| 2913 gpu::SyncToken release_sync_token; | 2922 gpu::SyncToken release_sync_token; |
| 2914 bool lost_resource = false; | 2923 bool lost_resource = false; |
| 2915 BlockingTaskRunner* main_thread_task_runner = nullptr; | 2924 BlockingTaskRunner* main_thread_task_runner = nullptr; |
| 2916 std::unique_ptr<SingleReleaseCallbackImpl> callback = | 2925 std::unique_ptr<SingleReleaseCallbackImpl> callback = |
| 2917 SingleReleaseCallbackImpl::Create( | 2926 SingleReleaseCallbackImpl::Create( |
| 2918 base::Bind(&ReleaseCallback, &release_sync_token, &lost_resource, | 2927 base::Bind(&ReleaseCallback, &release_sync_token, &lost_resource, |
| 2919 &main_thread_task_runner)); | 2928 &main_thread_task_runner)); |
| 2920 TextureMailbox mailbox(shared_bitmap.get(), size); | 2929 TextureMailbox mailbox(shared_bitmap.get(), size); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2952 FakeOutputSurfaceClient output_surface_client; | 2961 FakeOutputSurfaceClient output_surface_client; |
| 2953 std::unique_ptr<OutputSurface> output_surface( | 2962 std::unique_ptr<OutputSurface> output_surface( |
| 2954 FakeOutputSurface::Create3d(std::move(context_owned))); | 2963 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 2955 CHECK(output_surface->BindToClient(&output_surface_client)); | 2964 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 2956 | 2965 |
| 2957 std::unique_ptr<ResourceProvider> resource_provider( | 2966 std::unique_ptr<ResourceProvider> resource_provider( |
| 2958 base::MakeUnique<ResourceProvider>( | 2967 base::MakeUnique<ResourceProvider>( |
| 2959 output_surface->context_provider(), shared_bitmap_manager, | 2968 output_surface->context_provider(), shared_bitmap_manager, |
| 2960 gpu_memory_buffer_manager, main_thread_task_runner, 0, 1, | 2969 gpu_memory_buffer_manager, main_thread_task_runner, 0, 1, |
| 2961 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 2970 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 2971 kEnableColorCorrectRendering, |
| 2962 DefaultBufferToTextureTargetMapForTesting())); | 2972 DefaultBufferToTextureTargetMapForTesting())); |
| 2963 | 2973 |
| 2964 unsigned texture_id = 1; | 2974 unsigned texture_id = 1; |
| 2965 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | 2975 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 2966 gpu::CommandBufferId::FromUnsafeValue(0x12), | 2976 gpu::CommandBufferId::FromUnsafeValue(0x12), |
| 2967 0x34); | 2977 0x34); |
| 2968 unsigned target = GL_TEXTURE_2D; | 2978 unsigned target = GL_TEXTURE_2D; |
| 2969 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 2979 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 2970 | 2980 |
| 2971 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 2981 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3099 FakeOutputSurfaceClient output_surface_client; | 3109 FakeOutputSurfaceClient output_surface_client; |
| 3100 std::unique_ptr<OutputSurface> output_surface( | 3110 std::unique_ptr<OutputSurface> output_surface( |
| 3101 FakeOutputSurface::Create3d(std::move(context_owned))); | 3111 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3102 CHECK(output_surface->BindToClient(&output_surface_client)); | 3112 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3103 | 3113 |
| 3104 std::unique_ptr<ResourceProvider> resource_provider( | 3114 std::unique_ptr<ResourceProvider> resource_provider( |
| 3105 base::MakeUnique<ResourceProvider>( | 3115 base::MakeUnique<ResourceProvider>( |
| 3106 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3116 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3107 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3117 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3108 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3118 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3119 kEnableColorCorrectRendering, |
| 3109 DefaultBufferToTextureTargetMapForTesting())); | 3120 DefaultBufferToTextureTargetMapForTesting())); |
| 3110 | 3121 |
| 3111 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | 3122 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 3112 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); | 3123 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); |
| 3113 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 3124 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 3114 unsigned target = GL_TEXTURE_EXTERNAL_OES; | 3125 unsigned target = GL_TEXTURE_EXTERNAL_OES; |
| 3115 | 3126 |
| 3116 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3127 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3117 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 3128 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| 3118 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3129 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3171 FakeOutputSurfaceClient output_surface_client; | 3182 FakeOutputSurfaceClient output_surface_client; |
| 3172 std::unique_ptr<OutputSurface> output_surface( | 3183 std::unique_ptr<OutputSurface> output_surface( |
| 3173 FakeOutputSurface::Create3d(std::move(context_owned))); | 3184 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3174 CHECK(output_surface->BindToClient(&output_surface_client)); | 3185 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3175 | 3186 |
| 3176 std::unique_ptr<ResourceProvider> resource_provider( | 3187 std::unique_ptr<ResourceProvider> resource_provider( |
| 3177 base::MakeUnique<ResourceProvider>( | 3188 base::MakeUnique<ResourceProvider>( |
| 3178 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3189 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3179 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3190 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3180 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3191 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3192 kEnableColorCorrectRendering, |
| 3181 DefaultBufferToTextureTargetMapForTesting())); | 3193 DefaultBufferToTextureTargetMapForTesting())); |
| 3182 | 3194 |
| 3183 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, | 3195 gpu::SyncToken sync_token(gpu::CommandBufferNamespace::GPU_IO, 0, |
| 3184 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); | 3196 gpu::CommandBufferId::FromUnsafeValue(0x12), 0x34); |
| 3185 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 3197 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 3186 unsigned target = GL_TEXTURE_2D; | 3198 unsigned target = GL_TEXTURE_2D; |
| 3187 | 3199 |
| 3188 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3200 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3189 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 3201 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| 3190 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3202 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3229 FakeOutputSurfaceClient output_surface_client; | 3241 FakeOutputSurfaceClient output_surface_client; |
| 3230 std::unique_ptr<OutputSurface> output_surface( | 3242 std::unique_ptr<OutputSurface> output_surface( |
| 3231 FakeOutputSurface::Create3d(std::move(context_owned))); | 3243 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3232 CHECK(output_surface->BindToClient(&output_surface_client)); | 3244 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3233 | 3245 |
| 3234 std::unique_ptr<ResourceProvider> resource_provider( | 3246 std::unique_ptr<ResourceProvider> resource_provider( |
| 3235 base::MakeUnique<ResourceProvider>( | 3247 base::MakeUnique<ResourceProvider>( |
| 3236 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3248 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3237 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3249 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3238 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3250 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3251 kEnableColorCorrectRendering, |
| 3239 DefaultBufferToTextureTargetMapForTesting())); | 3252 DefaultBufferToTextureTargetMapForTesting())); |
| 3240 | 3253 |
| 3241 gpu::SyncToken sync_token; | 3254 gpu::SyncToken sync_token; |
| 3242 const GLuint64 current_fence_sync = context->GetNextFenceSync(); | 3255 const GLuint64 current_fence_sync = context->GetNextFenceSync(); |
| 3243 unsigned target = GL_TEXTURE_2D; | 3256 unsigned target = GL_TEXTURE_2D; |
| 3244 | 3257 |
| 3245 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); | 3258 EXPECT_CALL(*context, bindTexture(_, _)).Times(0); |
| 3246 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); | 3259 EXPECT_CALL(*context, waitSyncToken(_)).Times(0); |
| 3247 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); | 3260 EXPECT_CALL(*context, produceTextureDirectCHROMIUM(_, _, _)).Times(0); |
| 3248 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); | 3261 EXPECT_CALL(*context, createAndConsumeTextureCHROMIUM(_, _)).Times(0); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3353 FakeOutputSurfaceClient output_surface_client; | 3366 FakeOutputSurfaceClient output_surface_client; |
| 3354 std::unique_ptr<OutputSurface> output_surface( | 3367 std::unique_ptr<OutputSurface> output_surface( |
| 3355 FakeOutputSurface::Create3d(std::move(context_owned))); | 3368 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3356 CHECK(output_surface->BindToClient(&output_surface_client)); | 3369 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3357 | 3370 |
| 3358 std::unique_ptr<ResourceProvider> resource_provider( | 3371 std::unique_ptr<ResourceProvider> resource_provider( |
| 3359 base::MakeUnique<ResourceProvider>( | 3372 base::MakeUnique<ResourceProvider>( |
| 3360 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3373 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3361 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3374 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3362 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3375 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3376 kEnableColorCorrectRendering, |
| 3363 DefaultBufferToTextureTargetMapForTesting())); | 3377 DefaultBufferToTextureTargetMapForTesting())); |
| 3364 | 3378 |
| 3365 gfx::Size size(2, 2); | 3379 gfx::Size size(2, 2); |
| 3366 gfx::Vector2d offset(0, 0); | 3380 gfx::Vector2d offset(0, 0); |
| 3367 ResourceFormat format = RGBA_8888; | 3381 ResourceFormat format = RGBA_8888; |
| 3368 ResourceId id = 0; | 3382 ResourceId id = 0; |
| 3369 uint8_t pixels[16] = { 0 }; | 3383 uint8_t pixels[16] = { 0 }; |
| 3370 int texture_id = 123; | 3384 int texture_id = 123; |
| 3371 | 3385 |
| 3372 // Lazy allocation. Don't allocate when creating the resource. | 3386 // Lazy allocation. Don't allocate when creating the resource. |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3413 FakeOutputSurfaceClient output_surface_client; | 3427 FakeOutputSurfaceClient output_surface_client; |
| 3414 std::unique_ptr<OutputSurface> output_surface( | 3428 std::unique_ptr<OutputSurface> output_surface( |
| 3415 FakeOutputSurface::Create3d(std::move(context_owned))); | 3429 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3416 CHECK(output_surface->BindToClient(&output_surface_client)); | 3430 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3417 | 3431 |
| 3418 std::unique_ptr<ResourceProvider> resource_provider( | 3432 std::unique_ptr<ResourceProvider> resource_provider( |
| 3419 base::MakeUnique<ResourceProvider>( | 3433 base::MakeUnique<ResourceProvider>( |
| 3420 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3434 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3421 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3435 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3422 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3436 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3437 kEnableColorCorrectRendering, |
| 3423 DefaultBufferToTextureTargetMapForTesting())); | 3438 DefaultBufferToTextureTargetMapForTesting())); |
| 3424 | 3439 |
| 3425 gfx::Size size(2, 2); | 3440 gfx::Size size(2, 2); |
| 3426 | 3441 |
| 3427 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3442 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3428 const ResourceProvider::TextureHint hints[4] = { | 3443 const ResourceProvider::TextureHint hints[4] = { |
| 3429 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3444 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 3430 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3445 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3431 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3446 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 3432 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3447 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3471 FakeOutputSurfaceClient output_surface_client; | 3486 FakeOutputSurfaceClient output_surface_client; |
| 3472 std::unique_ptr<OutputSurface> output_surface( | 3487 std::unique_ptr<OutputSurface> output_surface( |
| 3473 FakeOutputSurface::Create3d(std::move(context_owned))); | 3488 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3474 CHECK(output_surface->BindToClient(&output_surface_client)); | 3489 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3475 | 3490 |
| 3476 std::unique_ptr<ResourceProvider> resource_provider( | 3491 std::unique_ptr<ResourceProvider> resource_provider( |
| 3477 base::MakeUnique<ResourceProvider>( | 3492 base::MakeUnique<ResourceProvider>( |
| 3478 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3493 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3479 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3494 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3480 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3495 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3496 kEnableColorCorrectRendering, |
| 3481 DefaultBufferToTextureTargetMapForTesting())); | 3497 DefaultBufferToTextureTargetMapForTesting())); |
| 3482 | 3498 |
| 3483 gfx::Size size(2, 2); | 3499 gfx::Size size(2, 2); |
| 3484 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; | 3500 const ResourceFormat formats[2] = {RGBA_8888, BGRA_8888}; |
| 3485 | 3501 |
| 3486 const ResourceProvider::TextureHint hints[4] = { | 3502 const ResourceProvider::TextureHint hints[4] = { |
| 3487 ResourceProvider::TEXTURE_HINT_DEFAULT, | 3503 ResourceProvider::TEXTURE_HINT_DEFAULT, |
| 3488 ResourceProvider::TEXTURE_HINT_IMMUTABLE, | 3504 ResourceProvider::TEXTURE_HINT_IMMUTABLE, |
| 3489 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, | 3505 ResourceProvider::TEXTURE_HINT_FRAMEBUFFER, |
| 3490 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, | 3506 ResourceProvider::TEXTURE_HINT_IMMUTABLE_FRAMEBUFFER, |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3532 ResourceFormat format = RGBA_8888; | 3548 ResourceFormat format = RGBA_8888; |
| 3533 ResourceId id = 0; | 3549 ResourceId id = 0; |
| 3534 const unsigned kTextureId = 123u; | 3550 const unsigned kTextureId = 123u; |
| 3535 const unsigned kImageId = 234u; | 3551 const unsigned kImageId = 234u; |
| 3536 | 3552 |
| 3537 std::unique_ptr<ResourceProvider> resource_provider( | 3553 std::unique_ptr<ResourceProvider> resource_provider( |
| 3538 base::MakeUnique<ResourceProvider>( | 3554 base::MakeUnique<ResourceProvider>( |
| 3539 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3555 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3540 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3556 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3541 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3557 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3558 kEnableColorCorrectRendering, |
| 3542 DefaultBufferToTextureTargetMapForTesting())); | 3559 DefaultBufferToTextureTargetMapForTesting())); |
| 3543 | 3560 |
| 3544 id = resource_provider->CreateResource( | 3561 id = resource_provider->CreateResource( |
| 3545 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3562 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3546 gfx::ColorSpace()); | 3563 gfx::ColorSpace()); |
| 3547 | 3564 |
| 3548 EXPECT_CALL(*context, NextTextureId()) | 3565 EXPECT_CALL(*context, NextTextureId()) |
| 3549 .WillOnce(Return(kTextureId)) | 3566 .WillOnce(Return(kTextureId)) |
| 3550 .RetiresOnSaturation(); | 3567 .RetiresOnSaturation(); |
| 3551 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) | 3568 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, kTextureId)) |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3613 std::unique_ptr<OutputSurface> output_surface( | 3630 std::unique_ptr<OutputSurface> output_surface( |
| 3614 FakeOutputSurface::Create3d(std::move(context_owned))); | 3631 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3615 CHECK(output_surface->BindToClient(&output_surface_client)); | 3632 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3616 | 3633 |
| 3617 gfx::Size size(4, 4); | 3634 gfx::Size size(4, 4); |
| 3618 std::unique_ptr<ResourceProvider> resource_provider( | 3635 std::unique_ptr<ResourceProvider> resource_provider( |
| 3619 base::MakeUnique<ResourceProvider>( | 3636 base::MakeUnique<ResourceProvider>( |
| 3620 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3637 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3621 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3638 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3622 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3639 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3640 kEnableColorCorrectRendering, |
| 3623 DefaultBufferToTextureTargetMapForTesting())); | 3641 DefaultBufferToTextureTargetMapForTesting())); |
| 3624 int texture_id = 123; | 3642 int texture_id = 123; |
| 3625 | 3643 |
| 3626 ResourceId id = resource_provider->CreateResource( | 3644 ResourceId id = resource_provider->CreateResource( |
| 3627 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1, gfx::ColorSpace()); | 3645 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1, gfx::ColorSpace()); |
| 3628 EXPECT_NE(0u, id); | 3646 EXPECT_NE(0u, id); |
| 3629 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3647 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3630 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); | 3648 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(2); |
| 3631 resource_provider->AllocateForTesting(id); | 3649 resource_provider->AllocateForTesting(id); |
| 3632 | 3650 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 3647 std::unique_ptr<OutputSurface> output_surface( | 3665 std::unique_ptr<OutputSurface> output_surface( |
| 3648 FakeOutputSurface::Create3d(std::move(context_owned))); | 3666 FakeOutputSurface::Create3d(std::move(context_owned))); |
| 3649 CHECK(output_surface->BindToClient(&output_surface_client)); | 3667 CHECK(output_surface->BindToClient(&output_surface_client)); |
| 3650 | 3668 |
| 3651 gfx::Size size(4, 4); | 3669 gfx::Size size(4, 4); |
| 3652 std::unique_ptr<ResourceProvider> resource_provider( | 3670 std::unique_ptr<ResourceProvider> resource_provider( |
| 3653 base::MakeUnique<ResourceProvider>( | 3671 base::MakeUnique<ResourceProvider>( |
| 3654 output_surface->context_provider(), shared_bitmap_manager_.get(), | 3672 output_surface->context_provider(), shared_bitmap_manager_.get(), |
| 3655 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, | 3673 gpu_memory_buffer_manager_.get(), nullptr, 0, 1, |
| 3656 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3674 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3675 kEnableColorCorrectRendering, |
| 3657 DefaultBufferToTextureTargetMapForTesting())); | 3676 DefaultBufferToTextureTargetMapForTesting())); |
| 3658 int texture_id = 123; | 3677 int texture_id = 123; |
| 3659 uint8_t pixels[8]; | 3678 uint8_t pixels[8]; |
| 3660 | 3679 |
| 3661 ResourceId id = resource_provider->CreateResource( | 3680 ResourceId id = resource_provider->CreateResource( |
| 3662 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1, gfx::ColorSpace()); | 3681 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, ETC1, gfx::ColorSpace()); |
| 3663 EXPECT_NE(0u, id); | 3682 EXPECT_NE(0u, id); |
| 3664 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); | 3683 EXPECT_CALL(*context, NextTextureId()).WillOnce(Return(texture_id)); |
| 3665 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); | 3684 EXPECT_CALL(*context, bindTexture(GL_TEXTURE_2D, texture_id)).Times(3); |
| 3666 EXPECT_CALL(*context, | 3685 EXPECT_CALL(*context, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3706 gfx::Size size(1, 1); | 3725 gfx::Size size(1, 1); |
| 3707 ResourceFormat format = RGBA_8888; | 3726 ResourceFormat format = RGBA_8888; |
| 3708 | 3727 |
| 3709 { | 3728 { |
| 3710 size_t kTextureAllocationChunkSize = 1; | 3729 size_t kTextureAllocationChunkSize = 1; |
| 3711 std::unique_ptr<ResourceProvider> resource_provider( | 3730 std::unique_ptr<ResourceProvider> resource_provider( |
| 3712 base::MakeUnique<ResourceProvider>( | 3731 base::MakeUnique<ResourceProvider>( |
| 3713 output_surface->context_provider(), shared_bitmap_manager.get(), | 3732 output_surface->context_provider(), shared_bitmap_manager.get(), |
| 3714 nullptr, nullptr, 0, kTextureAllocationChunkSize, | 3733 nullptr, nullptr, 0, kTextureAllocationChunkSize, |
| 3715 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3734 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3735 kEnableColorCorrectRendering, |
| 3716 DefaultBufferToTextureTargetMapForTesting())); | 3736 DefaultBufferToTextureTargetMapForTesting())); |
| 3717 | 3737 |
| 3718 ResourceId id = resource_provider->CreateResource( | 3738 ResourceId id = resource_provider->CreateResource( |
| 3719 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3739 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3720 gfx::ColorSpace()); | 3740 gfx::ColorSpace()); |
| 3721 resource_provider->AllocateForTesting(id); | 3741 resource_provider->AllocateForTesting(id); |
| 3722 Mock::VerifyAndClearExpectations(context); | 3742 Mock::VerifyAndClearExpectations(context); |
| 3723 | 3743 |
| 3724 DCHECK_EQ(2u, context->PeekTextureId()); | 3744 DCHECK_EQ(2u, context->PeekTextureId()); |
| 3725 resource_provider->DeleteResource(id); | 3745 resource_provider->DeleteResource(id); |
| 3726 } | 3746 } |
| 3727 | 3747 |
| 3728 { | 3748 { |
| 3729 size_t kTextureAllocationChunkSize = 8; | 3749 size_t kTextureAllocationChunkSize = 8; |
| 3730 std::unique_ptr<ResourceProvider> resource_provider( | 3750 std::unique_ptr<ResourceProvider> resource_provider( |
| 3731 base::MakeUnique<ResourceProvider>( | 3751 base::MakeUnique<ResourceProvider>( |
| 3732 output_surface->context_provider(), shared_bitmap_manager.get(), | 3752 output_surface->context_provider(), shared_bitmap_manager.get(), |
| 3733 nullptr, nullptr, 0, kTextureAllocationChunkSize, | 3753 nullptr, nullptr, 0, kTextureAllocationChunkSize, |
| 3734 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, | 3754 kDelegatedSyncPointsRequired, kUseGpuMemoryBufferResources, |
| 3755 kEnableColorCorrectRendering, |
| 3735 DefaultBufferToTextureTargetMapForTesting())); | 3756 DefaultBufferToTextureTargetMapForTesting())); |
| 3736 | 3757 |
| 3737 ResourceId id = resource_provider->CreateResource( | 3758 ResourceId id = resource_provider->CreateResource( |
| 3738 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, | 3759 size, ResourceProvider::TEXTURE_HINT_IMMUTABLE, format, |
| 3739 gfx::ColorSpace()); | 3760 gfx::ColorSpace()); |
| 3740 resource_provider->AllocateForTesting(id); | 3761 resource_provider->AllocateForTesting(id); |
| 3741 Mock::VerifyAndClearExpectations(context); | 3762 Mock::VerifyAndClearExpectations(context); |
| 3742 | 3763 |
| 3743 DCHECK_EQ(10u, context->PeekTextureId()); | 3764 DCHECK_EQ(10u, context->PeekTextureId()); |
| 3744 resource_provider->DeleteResource(id); | 3765 resource_provider->DeleteResource(id); |
| 3745 } | 3766 } |
| 3746 } | 3767 } |
| 3747 | 3768 |
| 3748 } // namespace | 3769 } // namespace |
| 3749 } // namespace cc | 3770 } // namespace cc |
| OLD | NEW |