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

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

Issue 2565783002: Moves ownership of the cc::Display's BeginFrameSource out of Display. (Closed)
Patch Set: rebase. Created 4 years 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
« no previous file with comments | « cc/test/test_compositor_frame_sink.h ('k') | components/exo/compositor_frame_sink.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 61
62 bool TestCompositorFrameSink::BindToClient(CompositorFrameSinkClient* client) { 62 bool TestCompositorFrameSink::BindToClient(CompositorFrameSinkClient* client) {
63 if (!CompositorFrameSink::BindToClient(client)) 63 if (!CompositorFrameSink::BindToClient(client))
64 return false; 64 return false;
65 65
66 std::unique_ptr<OutputSurface> display_output_surface = 66 std::unique_ptr<OutputSurface> display_output_surface =
67 test_client_->CreateDisplayOutputSurface(context_provider()); 67 test_client_->CreateDisplayOutputSurface(context_provider());
68 bool display_context_shared_with_compositor = 68 bool display_context_shared_with_compositor =
69 display_output_surface->context_provider() == context_provider(); 69 display_output_surface->context_provider() == context_provider();
70 70
71 std::unique_ptr<SyntheticBeginFrameSource> begin_frame_source;
72 std::unique_ptr<DisplayScheduler> scheduler; 71 std::unique_ptr<DisplayScheduler> scheduler;
73 if (!synchronous_composite_) { 72 if (!synchronous_composite_) {
74 if (renderer_settings_.disable_display_vsync) { 73 if (renderer_settings_.disable_display_vsync) {
75 begin_frame_source.reset(new BackToBackBeginFrameSource( 74 begin_frame_source_.reset(new BackToBackBeginFrameSource(
76 base::MakeUnique<DelayBasedTimeSource>(task_runner_.get()))); 75 base::MakeUnique<DelayBasedTimeSource>(task_runner_.get())));
77 } else { 76 } else {
78 begin_frame_source.reset(new DelayBasedBeginFrameSource( 77 begin_frame_source_.reset(new DelayBasedBeginFrameSource(
79 base::MakeUnique<DelayBasedTimeSource>(task_runner_.get()))); 78 base::MakeUnique<DelayBasedTimeSource>(task_runner_.get())));
80 begin_frame_source->SetAuthoritativeVSyncInterval( 79 begin_frame_source_->SetAuthoritativeVSyncInterval(
81 base::TimeDelta::FromMilliseconds(1000.f / 80 base::TimeDelta::FromMilliseconds(1000.f /
82 renderer_settings_.refresh_rate)); 81 renderer_settings_.refresh_rate));
83 } 82 }
84 scheduler.reset(new DisplayScheduler( 83 scheduler.reset(new DisplayScheduler(
85 begin_frame_source.get(), task_runner_.get(), 84 task_runner_.get(),
86 display_output_surface->capabilities().max_frames_pending)); 85 display_output_surface->capabilities().max_frames_pending));
87 } 86 }
88 87
89 display_.reset(new Display( 88 display_.reset(
90 shared_bitmap_manager(), gpu_memory_buffer_manager(), renderer_settings_, 89 new Display(shared_bitmap_manager(), gpu_memory_buffer_manager(),
91 frame_sink_id_, std::move(begin_frame_source), 90 renderer_settings_, frame_sink_id_, begin_frame_source_.get(),
92 std::move(display_output_surface), std::move(scheduler), 91 std::move(display_output_surface), std::move(scheduler),
93 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get()))); 92 base::MakeUnique<TextureMailboxDeleter>(task_runner_.get())));
94 93
95 // We want the Display's OutputSurface to hear about lost context, and when 94 // 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 95 // this shares a context with it we should not be listening for lost context
97 // callbacks on the context here. 96 // callbacks on the context here.
98 if (display_context_shared_with_compositor && context_provider()) 97 if (display_context_shared_with_compositor && context_provider())
99 context_provider()->SetLostContextCallback(base::Closure()); 98 context_provider()->SetLostContextCallback(base::Closure());
100 99
101 surface_manager_->RegisterFrameSinkId(frame_sink_id_); 100 surface_manager_->RegisterFrameSinkId(frame_sink_id_);
102 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this); 101 surface_manager_->RegisterSurfaceFactoryClient(frame_sink_id_, this);
103 display_->Initialize(this, surface_manager_.get()); 102 display_->Initialize(this, surface_manager_.get());
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 bool will_draw_and_swap, 196 bool will_draw_and_swap,
198 const RenderPassList& render_passes) { 197 const RenderPassList& render_passes) {
199 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes); 198 test_client_->DisplayWillDrawAndSwap(will_draw_and_swap, render_passes);
200 } 199 }
201 200
202 void TestCompositorFrameSink::DisplayDidDrawAndSwap() { 201 void TestCompositorFrameSink::DisplayDidDrawAndSwap() {
203 test_client_->DisplayDidDrawAndSwap(); 202 test_client_->DisplayDidDrawAndSwap();
204 } 203 }
205 204
206 } // namespace cc 205 } // namespace cc
OLDNEW
« no previous file with comments | « cc/test/test_compositor_frame_sink.h ('k') | components/exo/compositor_frame_sink.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698