OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/test/pixel_test_delegating_output_surface.h" | 5 #include "cc/test/pixel_test_delegating_output_surface.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "cc/test/pixel_test_software_output_device.h" | 21 #include "cc/test/pixel_test_software_output_device.h" |
22 #include "cc/test/test_in_process_context_provider.h" | 22 #include "cc/test/test_in_process_context_provider.h" |
23 | 23 |
24 static constexpr uint32_t kCompositorSurfaceNamespace = 1; | 24 static constexpr uint32_t kCompositorSurfaceNamespace = 1; |
25 | 25 |
26 namespace cc { | 26 namespace cc { |
27 | 27 |
28 PixelTestDelegatingOutputSurface::PixelTestDelegatingOutputSurface( | 28 PixelTestDelegatingOutputSurface::PixelTestDelegatingOutputSurface( |
29 scoped_refptr<ContextProvider> compositor_context_provider, | 29 scoped_refptr<ContextProvider> compositor_context_provider, |
30 scoped_refptr<ContextProvider> worker_context_provider, | 30 scoped_refptr<ContextProvider> worker_context_provider, |
| 31 scoped_refptr<ContextProvider> display_context_provider, |
31 SharedBitmapManager* shared_bitmap_manager, | 32 SharedBitmapManager* shared_bitmap_manager, |
32 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 33 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
33 bool allow_force_reclaim_resources, | 34 bool allow_force_reclaim_resources, |
34 bool synchronous_composite) | 35 bool synchronous_composite) |
35 : OutputSurface(std::move(compositor_context_provider), | 36 : OutputSurface(std::move(compositor_context_provider), |
36 std::move(worker_context_provider), | 37 std::move(worker_context_provider), |
37 nullptr), | 38 nullptr), |
38 shared_bitmap_manager_(shared_bitmap_manager), | 39 shared_bitmap_manager_(shared_bitmap_manager), |
39 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | 40 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), |
40 allow_force_reclaim_resources_(allow_force_reclaim_resources), | 41 allow_force_reclaim_resources_(allow_force_reclaim_resources), |
41 synchronous_composite_(synchronous_composite), | 42 synchronous_composite_(synchronous_composite), |
| 43 display_context_provider_(std::move(display_context_provider)), |
42 surface_manager_(new SurfaceManager), | 44 surface_manager_(new SurfaceManager), |
43 surface_id_allocator_( | 45 surface_id_allocator_( |
44 new SurfaceIdAllocator(kCompositorSurfaceNamespace)), | 46 new SurfaceIdAllocator(kCompositorSurfaceNamespace)), |
45 surface_factory_(new SurfaceFactory(surface_manager_.get(), this)), | 47 surface_factory_(new SurfaceFactory(surface_manager_.get(), this)), |
46 weak_ptrs_(this) { | 48 weak_ptrs_(this) { |
47 capabilities_.delegated_rendering = true; | 49 capabilities_.delegated_rendering = true; |
48 capabilities_.can_force_reclaim_resources = allow_force_reclaim_resources_; | 50 capabilities_.can_force_reclaim_resources = allow_force_reclaim_resources_; |
49 | 51 |
50 surface_id_allocator_->RegisterSurfaceIdNamespace(surface_manager_.get()); | 52 surface_id_allocator_->RegisterSurfaceIdNamespace(surface_manager_.get()); |
51 } | 53 } |
(...skipping 14 matching lines...) Expand all Loading... |
66 // The PixelTestOutputSurface is owned by the Display. | 68 // The PixelTestOutputSurface is owned by the Display. |
67 std::unique_ptr<PixelTestOutputSurface> output_surface; | 69 std::unique_ptr<PixelTestOutputSurface> output_surface; |
68 | 70 |
69 if (!context_provider()) { | 71 if (!context_provider()) { |
70 std::unique_ptr<PixelTestSoftwareOutputDevice> software_output_device( | 72 std::unique_ptr<PixelTestSoftwareOutputDevice> software_output_device( |
71 new PixelTestSoftwareOutputDevice); | 73 new PixelTestSoftwareOutputDevice); |
72 software_output_device->set_surface_expansion_size(surface_expansion_size); | 74 software_output_device->set_surface_expansion_size(surface_expansion_size); |
73 output_surface = base::MakeUnique<PixelTestOutputSurface>( | 75 output_surface = base::MakeUnique<PixelTestOutputSurface>( |
74 std::move(software_output_device)); | 76 std::move(software_output_device)); |
75 } else { | 77 } else { |
76 scoped_refptr<TestInProcessContextProvider> context( | |
77 new TestInProcessContextProvider(nullptr)); | |
78 bool flipped_output_surface = false; | 78 bool flipped_output_surface = false; |
79 output_surface = base::MakeUnique<PixelTestOutputSurface>( | 79 output_surface = base::MakeUnique<PixelTestOutputSurface>( |
80 std::move(context), nullptr, flipped_output_surface); | 80 std::move(display_context_provider_), nullptr, flipped_output_surface); |
81 } | 81 } |
82 output_surface->set_surface_expansion_size(surface_expansion_size); | 82 output_surface->set_surface_expansion_size(surface_expansion_size); |
83 | 83 |
84 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); | 84 auto* task_runner = base::ThreadTaskRunnerHandle::Get().get(); |
85 CHECK(task_runner); | 85 CHECK(task_runner); |
86 | 86 |
87 std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source; | 87 std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source; |
88 std::unique_ptr<DisplayScheduler> scheduler; | 88 std::unique_ptr<DisplayScheduler> scheduler; |
89 if (!synchronous_composite_) { | 89 if (!synchronous_composite_) { |
90 begin_frame_source.reset(new BackToBackBeginFrameSource( | 90 begin_frame_source.reset(new BackToBackBeginFrameSource( |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 ack.resources = resources; | 168 ack.resources = resources; |
169 client_->ReclaimResources(&ack); | 169 client_->ReclaimResources(&ack); |
170 } | 170 } |
171 | 171 |
172 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( | 172 void PixelTestDelegatingOutputSurface::SetBeginFrameSource( |
173 BeginFrameSource* begin_frame_source) { | 173 BeginFrameSource* begin_frame_source) { |
174 client_->SetBeginFrameSource(begin_frame_source); | 174 client_->SetBeginFrameSource(begin_frame_source); |
175 } | 175 } |
176 | 176 |
177 } // namespace cc | 177 } // namespace cc |
OLD | NEW |