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/test_compositor_frame_sink.h" | 5 #include "cc/test/test_compositor_frame_sink.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "cc/output/begin_frame_args.h" | 10 #include "cc/output/begin_frame_args.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 TestCompositorFrameSink::TestCompositorFrameSink( | 21 TestCompositorFrameSink::TestCompositorFrameSink( |
22 scoped_refptr<ContextProvider> compositor_context_provider, | 22 scoped_refptr<ContextProvider> compositor_context_provider, |
23 scoped_refptr<ContextProvider> worker_context_provider, | 23 scoped_refptr<ContextProvider> worker_context_provider, |
24 SharedBitmapManager* shared_bitmap_manager, | 24 SharedBitmapManager* shared_bitmap_manager, |
25 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 25 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
26 const RendererSettings& renderer_settings, | 26 const RendererSettings& renderer_settings, |
27 scoped_refptr<base::SingleThreadTaskRunner> task_runner, | 27 scoped_refptr<base::SingleThreadTaskRunner> task_runner, |
28 bool synchronous_composite, | 28 bool synchronous_composite, |
29 bool force_disable_reclaim_resources) | 29 bool force_disable_reclaim_resources) |
30 : CompositorFrameSink(std::move(compositor_context_provider), | 30 : CompositorFrameSink(std::move(compositor_context_provider), |
31 std::move(worker_context_provider)), | 31 std::move(worker_context_provider), |
| 32 gpu_memory_buffer_manager, |
| 33 shared_bitmap_manager), |
32 synchronous_composite_(synchronous_composite), | 34 synchronous_composite_(synchronous_composite), |
33 renderer_settings_(renderer_settings), | 35 renderer_settings_(renderer_settings), |
34 shared_bitmap_manager_(shared_bitmap_manager), | |
35 gpu_memory_buffer_manager_(gpu_memory_buffer_manager), | |
36 task_runner_(std::move(task_runner)), | 36 task_runner_(std::move(task_runner)), |
37 frame_sink_id_(kCompositorFrameSinkId), | 37 frame_sink_id_(kCompositorFrameSinkId), |
38 surface_manager_(new SurfaceManager), | 38 surface_manager_(new SurfaceManager), |
39 surface_id_allocator_(new SurfaceIdAllocator()), | 39 surface_id_allocator_(new SurfaceIdAllocator()), |
40 surface_factory_( | 40 surface_factory_( |
41 new SurfaceFactory(frame_sink_id_, surface_manager_.get(), this)), | 41 new SurfaceFactory(frame_sink_id_, surface_manager_.get(), this)), |
42 weak_ptr_factory_(this) { | 42 weak_ptr_factory_(this) { |
43 // Since this CompositorFrameSink and the Display are tightly coupled and in | 43 // Since this CompositorFrameSink and the Display are tightly coupled and in |
44 // the same process/thread, the LayerTreeHostImpl can reclaim resources from | 44 // the same process/thread, the LayerTreeHostImpl can reclaim resources from |
45 // the Display. But we allow tests to disable this to mimic an out-of-process | 45 // the Display. But we allow tests to disable this to mimic an out-of-process |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 begin_frame_source->SetAuthoritativeVSyncInterval( | 80 begin_frame_source->SetAuthoritativeVSyncInterval( |
81 base::TimeDelta::FromMilliseconds(1000.f / | 81 base::TimeDelta::FromMilliseconds(1000.f / |
82 renderer_settings_.refresh_rate)); | 82 renderer_settings_.refresh_rate)); |
83 } | 83 } |
84 scheduler.reset(new DisplayScheduler( | 84 scheduler.reset(new DisplayScheduler( |
85 begin_frame_source.get(), task_runner_.get(), | 85 begin_frame_source.get(), task_runner_.get(), |
86 display_output_surface->capabilities().max_frames_pending)); | 86 display_output_surface->capabilities().max_frames_pending)); |
87 } | 87 } |
88 | 88 |
89 display_.reset( | 89 display_.reset( |
90 new Display(shared_bitmap_manager_, gpu_memory_buffer_manager_, | 90 new Display(shared_bitmap_manager(), gpu_memory_buffer_manager(), |
91 renderer_settings_, std::move(begin_frame_source), | 91 renderer_settings_, std::move(begin_frame_source), |
92 std::move(display_output_surface), std::move(scheduler), | 92 std::move(display_output_surface), std::move(scheduler), |
93 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get()))); | 93 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get()))); |
94 | 94 |
95 // We want the Display's OutputSurface to hear about lost context, and when | 95 // We want the Display's OutputSurface to hear about lost context, and when |
96 // this shares a context with it we should not be listening for lost context | 96 // this shares a context with it we should not be listening for lost context |
97 // callbacks on the context here. | 97 // callbacks on the context here. |
98 if (display_context_shared_with_compositor && context_provider()) | 98 if (display_context_shared_with_compositor && context_provider()) |
99 context_provider()->SetLostContextCallback(base::Closure()); | 99 context_provider()->SetLostContextCallback(base::Closure()); |
100 | 100 |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
203 bool will_draw_and_swap, | 203 bool will_draw_and_swap, |
204 const RenderPassList& render_passes) { | 204 const RenderPassList& render_passes) { |
205 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); | 205 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); |
206 } | 206 } |
207 | 207 |
208 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { | 208 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { |
209 test_client_->DisplayDidDrawAndSwap(); | 209 test_client_->DisplayDidDrawAndSwap(); |
210 } | 210 } |
211 | 211 |
212 } // namespace cc | 212 } // namespace cc |
OLD | NEW |