Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(364)

Side by Side Diff: cc/test/test_delegating_output_surface.cc

Issue 2286273003: Make cc::Display not own its BeginFrameSource (Closed)
Patch Set: Fix webview Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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;
37 std::unique_ptr<DisplayScheduler> scheduler; 36 std::unique_ptr<DisplayScheduler> scheduler;
38 if (!synchronous_composite) { 37 if (!synchronous_composite) {
39 if (renderer_settings.disable_display_vsync) { 38 if (renderer_settings.disable_display_vsync) {
40 begin_frame_source.reset(new BackToBackBeginFrameSource( 39 begin_frame_source_.reset(new BackToBackBeginFrameSource(
41 base::MakeUnique<DelayBasedTimeSource>(task_runner))); 40 base::MakeUnique<DelayBasedTimeSource>(task_runner)));
42 } else { 41 } else {
43 begin_frame_source.reset(new DelayBasedBeginFrameSource( 42 begin_frame_source_.reset(new DelayBasedBeginFrameSource(
44 base::MakeUnique<DelayBasedTimeSource>(task_runner))); 43 base::MakeUnique<DelayBasedTimeSource>(task_runner)));
45 begin_frame_source->SetAuthoritativeVSyncInterval( 44 begin_frame_source_->SetAuthoritativeVSyncInterval(
46 base::TimeDelta::FromMilliseconds(1000.f / 45 base::TimeDelta::FromMilliseconds(1000.f /
47 renderer_settings.refresh_rate)); 46 renderer_settings.refresh_rate));
48 } 47 }
49 scheduler.reset(new DisplayScheduler( 48 scheduler.reset(new DisplayScheduler(
50 begin_frame_source.get(), task_runner, 49 begin_frame_source_.get(), task_runner,
51 display_output_surface->capabilities().max_frames_pending)); 50 display_output_surface->capabilities().max_frames_pending));
52 } 51 }
53 const bool context_shared_with_compositor = 52 const bool context_shared_with_compositor =
54 display_output_surface->context_provider() == context_provider(); 53 display_output_surface->context_provider() == context_provider();
55 display_.reset( 54 display_.reset(
56 new Display(shared_bitmap_manager, gpu_memory_buffer_manager, 55 new Display(shared_bitmap_manager, gpu_memory_buffer_manager,
57 renderer_settings, std::move(begin_frame_source), 56 renderer_settings, begin_frame_source_.get(),
58 std::move(display_output_surface), std::move(scheduler), 57 std::move(display_output_surface), std::move(scheduler),
59 base::MakeUnique<TextureMailboxDeleter>(task_runner))); 58 base::MakeUnique<TextureMailboxDeleter>(task_runner)));
60 59
61 capabilities_.delegated_rendering = true; 60 capabilities_.delegated_rendering = true;
62 // Since this OutputSurface and the Display are tightly coupled and in the 61 // Since this OutputSurface and the Display are tightly coupled and in the
63 // same process/thread, the LayerTreeHostImpl can reclaim resources from 62 // same process/thread, the LayerTreeHostImpl can reclaim resources from
64 // the Display. But we allow tests to disable this to mimic an out-of-process 63 // the Display. But we allow tests to disable this to mimic an out-of-process
65 // Display. 64 // Display.
66 capabilities_.can_force_reclaim_resources = !force_disable_reclaim_resources; 65 capabilities_.can_force_reclaim_resources = !force_disable_reclaim_resources;
67 capabilities_.delegated_sync_points_required = 66 capabilities_.delegated_sync_points_required =
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 if (test_client_) 207 if (test_client_)
209 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); 208 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes);
210 } 209 }
211 210
212 void TestDelegatingOutputSurface::DisplayDidDrawAndSwap() { 211 void TestDelegatingOutputSurface::DisplayDidDrawAndSwap() {
213 if (test_client_) 212 if (test_client_)
214 test_client_->DisplayDidDrawAndSwap(); 213 test_client_->DisplayDidDrawAndSwap();
215 } 214 }
216 215
217 } // namespace cc 216 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_delegating_output_surface.h ('k') | content/browser/compositor/gpu_process_transport_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698