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_delegating_output_surface.h" | 5 #include "cc/test/test_delegating_output_surface.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 15 matching lines...) Expand all Loading... |
26 base::SingleThreadTaskRunner* task_runner, | 26 base::SingleThreadTaskRunner* task_runner, |
27 bool synchronous_composite, | 27 bool synchronous_composite, |
28 bool force_disable_reclaim_resources) | 28 bool force_disable_reclaim_resources) |
29 : OutputSurface(std::move(compositor_context_provider), | 29 : OutputSurface(std::move(compositor_context_provider), |
30 std::move(worker_context_provider), | 30 std::move(worker_context_provider), |
31 nullptr), | 31 nullptr), |
32 surface_manager_(new SurfaceManager), | 32 surface_manager_(new SurfaceManager), |
33 surface_id_allocator_(new SurfaceIdAllocator(kCompositorClientId)), | 33 surface_id_allocator_(new SurfaceIdAllocator(kCompositorClientId)), |
34 surface_factory_(new SurfaceFactory(surface_manager_.get(), this)), | 34 surface_factory_(new SurfaceFactory(surface_manager_.get(), this)), |
35 weak_ptrs_(this) { | 35 weak_ptrs_(this) { |
| 36 std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source; |
36 std::unique_ptr<DisplayScheduler> scheduler; | 37 std::unique_ptr<DisplayScheduler> scheduler; |
37 if (!synchronous_composite) { | 38 if (!synchronous_composite) { |
38 if (renderer_settings.disable_display_vsync) { | 39 if (renderer_settings.disable_display_vsync) { |
39 begin_frame_source_.reset(new BackToBackBeginFrameSource( | 40 begin_frame_source.reset(new BackToBackBeginFrameSource( |
40 base::MakeUnique<DelayBasedTimeSource>(task_runner))); | 41 base::MakeUnique<DelayBasedTimeSource>(task_runner))); |
41 } else { | 42 } else { |
42 begin_frame_source_.reset(new DelayBasedBeginFrameSource( | 43 begin_frame_source.reset(new DelayBasedBeginFrameSource( |
43 base::MakeUnique<DelayBasedTimeSource>(task_runner))); | 44 base::MakeUnique<DelayBasedTimeSource>(task_runner))); |
44 begin_frame_source_->SetAuthoritativeVSyncInterval( | 45 begin_frame_source->SetAuthoritativeVSyncInterval( |
45 base::TimeDelta::FromMilliseconds(1000.f / | 46 base::TimeDelta::FromMilliseconds(1000.f / |
46 renderer_settings.refresh_rate)); | 47 renderer_settings.refresh_rate)); |
47 } | 48 } |
48 scheduler.reset(new DisplayScheduler( | 49 scheduler.reset(new DisplayScheduler( |
49 begin_frame_source_.get(), task_runner, | 50 begin_frame_source.get(), task_runner, |
50 display_output_surface->capabilities().max_frames_pending)); | 51 display_output_surface->capabilities().max_frames_pending)); |
51 } | 52 } |
52 const bool context_shared_with_compositor = | 53 const bool context_shared_with_compositor = |
53 display_output_surface->context_provider() == context_provider(); | 54 display_output_surface->context_provider() == context_provider(); |
54 display_.reset( | 55 display_.reset( |
55 new Display(shared_bitmap_manager, gpu_memory_buffer_manager, | 56 new Display(shared_bitmap_manager, gpu_memory_buffer_manager, |
56 renderer_settings, begin_frame_source_.get(), | 57 renderer_settings, std::move(begin_frame_source), |
57 std::move(display_output_surface), std::move(scheduler), | 58 std::move(display_output_surface), std::move(scheduler), |
58 base::MakeUnique<TextureMailboxDeleter>(task_runner))); | 59 base::MakeUnique<TextureMailboxDeleter>(task_runner))); |
59 | 60 |
60 capabilities_.delegated_rendering = true; | 61 capabilities_.delegated_rendering = true; |
61 // Since this OutputSurface and the Display are tightly coupled and in the | 62 // Since this OutputSurface and the Display are tightly coupled and in the |
62 // same process/thread, the LayerTreeHostImpl can reclaim resources from | 63 // same process/thread, the LayerTreeHostImpl can reclaim resources from |
63 // the Display. But we allow tests to disable this to mimic an out-of-process | 64 // the Display. But we allow tests to disable this to mimic an out-of-process |
64 // Display. | 65 // Display. |
65 capabilities_.can_force_reclaim_resources = !force_disable_reclaim_resources; | 66 capabilities_.can_force_reclaim_resources = !force_disable_reclaim_resources; |
66 capabilities_.delegated_sync_points_required = | 67 capabilities_.delegated_sync_points_required = |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 if (test_client_) | 208 if (test_client_) |
208 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); | 209 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); |
209 } | 210 } |
210 | 211 |
211 void TestDelegatingOutputSurface::DisplayDidDrawAndSwap() { | 212 void TestDelegatingOutputSurface::DisplayDidDrawAndSwap() { |
212 if (test_client_) | 213 if (test_client_) |
213 test_client_->DisplayDidDrawAndSwap(); | 214 test_client_->DisplayDidDrawAndSwap(); |
214 } | 215 } |
215 | 216 |
216 } // namespace cc | 217 } // namespace cc |
OLD | NEW |