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

Side by Side Diff: cc/trees/proxy_main.cc

Issue 2337913003: Fork cc::OutputSurface into cc::CompositorFrameSink. (Closed)
Patch Set: cfsfork: rebase 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/trees/proxy_main.h" 5 #include "cc/trees/proxy_main.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
11 #include "base/trace_event/trace_event_argument.h" 11 #include "base/trace_event/trace_event_argument.h"
12 #include "base/trace_event/trace_event_synthetic_delay.h" 12 #include "base/trace_event/trace_event_synthetic_delay.h"
13 #include "cc/animation/animation_events.h" 13 #include "cc/animation/animation_events.h"
14 #include "cc/debug/benchmark_instrumentation.h" 14 #include "cc/debug/benchmark_instrumentation.h"
15 #include "cc/debug/devtools_instrumentation.h" 15 #include "cc/debug/devtools_instrumentation.h"
16 #include "cc/output/output_surface.h" 16 #include "cc/output/compositor_frame_sink.h"
17 #include "cc/output/swap_promise.h" 17 #include "cc/output/swap_promise.h"
18 #include "cc/resources/ui_resource_manager.h" 18 #include "cc/resources/ui_resource_manager.h"
19 #include "cc/trees/blocking_task_runner.h" 19 #include "cc/trees/blocking_task_runner.h"
20 #include "cc/trees/layer_tree_host.h" 20 #include "cc/trees/layer_tree_host.h"
21 #include "cc/trees/remote_channel_main.h" 21 #include "cc/trees/remote_channel_main.h"
22 #include "cc/trees/scoped_abort_remaining_swap_promises.h" 22 #include "cc/trees/scoped_abort_remaining_swap_promises.h"
23 #include "cc/trees/threaded_channel.h" 23 #include "cc/trees/threaded_channel.h"
24 24
25 namespace cc { 25 namespace cc {
26 26
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 DCHECK(IsMainThread()); 87 DCHECK(IsMainThread());
88 layer_tree_host_->DidCommitAndDrawFrame(); 88 layer_tree_host_->DidCommitAndDrawFrame();
89 } 89 }
90 90
91 void ProxyMain::SetAnimationEvents(std::unique_ptr<AnimationEvents> events) { 91 void ProxyMain::SetAnimationEvents(std::unique_ptr<AnimationEvents> events) {
92 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents"); 92 TRACE_EVENT0("cc", "ProxyMain::SetAnimationEvents");
93 DCHECK(IsMainThread()); 93 DCHECK(IsMainThread());
94 layer_tree_host_->SetAnimationEvents(std::move(events)); 94 layer_tree_host_->SetAnimationEvents(std::move(events));
95 } 95 }
96 96
97 void ProxyMain::DidLoseOutputSurface() { 97 void ProxyMain::DidLoseCompositorFrameSink() {
98 TRACE_EVENT0("cc", "ProxyMain::DidLoseOutputSurface"); 98 TRACE_EVENT0("cc", "ProxyMain::DidLoseCompositorFrameSink");
99 DCHECK(IsMainThread()); 99 DCHECK(IsMainThread());
100 layer_tree_host_->DidLoseOutputSurface(); 100 layer_tree_host_->DidLoseCompositorFrameSink();
101 } 101 }
102 102
103 void ProxyMain::RequestNewOutputSurface() { 103 void ProxyMain::RequestNewCompositorFrameSink() {
104 TRACE_EVENT0("cc", "ProxyMain::RequestNewOutputSurface"); 104 TRACE_EVENT0("cc", "ProxyMain::RequestNewCompositorFrameSink");
105 DCHECK(IsMainThread()); 105 DCHECK(IsMainThread());
106 layer_tree_host_->RequestNewOutputSurface(); 106 layer_tree_host_->RequestNewCompositorFrameSink();
107 } 107 }
108 108
109 void ProxyMain::DidInitializeOutputSurface(bool success) { 109 void ProxyMain::DidInitializeCompositorFrameSink(bool success) {
110 TRACE_EVENT0("cc", "ProxyMain::DidInitializeOutputSurface"); 110 TRACE_EVENT0("cc", "ProxyMain::DidInitializeCompositorFrameSink");
111 DCHECK(IsMainThread()); 111 DCHECK(IsMainThread());
112 112
113 if (!success) 113 if (!success)
114 layer_tree_host_->DidFailToInitializeOutputSurface(); 114 layer_tree_host_->DidFailToInitializeCompositorFrameSink();
115 else 115 else
116 layer_tree_host_->DidInitializeOutputSurface(); 116 layer_tree_host_->DidInitializeCompositorFrameSink();
117 } 117 }
118 118
119 void ProxyMain::DidCompletePageScaleAnimation() { 119 void ProxyMain::DidCompletePageScaleAnimation() {
120 DCHECK(IsMainThread()); 120 DCHECK(IsMainThread());
121 layer_tree_host_->DidCompletePageScaleAnimation(); 121 layer_tree_host_->DidCompletePageScaleAnimation();
122 } 122 }
123 123
124 void ProxyMain::BeginMainFrame( 124 void ProxyMain::BeginMainFrame(
125 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) { 125 std::unique_ptr<BeginMainFrameAndCommitState> begin_main_frame_state) {
126 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task( 126 benchmark_instrumentation::ScopedBeginFrameTask begin_frame_task(
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 DCHECK(IsMainThread()); 245 DCHECK(IsMainThread());
246 return started_; 246 return started_;
247 } 247 }
248 248
249 bool ProxyMain::CommitToActiveTree() const { 249 bool ProxyMain::CommitToActiveTree() const {
250 // With ProxyMain, we use a pending tree and activate it once it's ready to 250 // With ProxyMain, we use a pending tree and activate it once it's ready to
251 // draw to allow input to modify the active tree and draw during raster. 251 // draw to allow input to modify the active tree and draw during raster.
252 return false; 252 return false;
253 } 253 }
254 254
255 void ProxyMain::SetOutputSurface(OutputSurface* output_surface) { 255 void ProxyMain::SetCompositorFrameSink(
256 channel_main_->InitializeOutputSurfaceOnImpl(output_surface); 256 CompositorFrameSink* compositor_frame_sink) {
257 channel_main_->InitializeCompositorFrameSinkOnImpl(compositor_frame_sink);
257 } 258 }
258 259
259 void ProxyMain::SetVisible(bool visible) { 260 void ProxyMain::SetVisible(bool visible) {
260 TRACE_EVENT1("cc", "ProxyMain::SetVisible", "visible", visible); 261 TRACE_EVENT1("cc", "ProxyMain::SetVisible", "visible", visible);
261 channel_main_->SetVisibleOnImpl(visible); 262 channel_main_->SetVisibleOnImpl(visible);
262 } 263 }
263 264
264 void ProxyMain::SetNeedsAnimate() { 265 void ProxyMain::SetNeedsAnimate() {
265 DCHECK(IsMainThread()); 266 DCHECK(IsMainThread());
266 if (SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE)) { 267 if (SendCommitRequestToImplThreadIfNeeded(ANIMATE_PIPELINE_STAGE)) {
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 { 389 {
389 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); 390 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
390 CompletionEvent completion; 391 CompletionEvent completion;
391 channel_main_->MainFrameWillHappenOnImplForTesting(&completion, 392 channel_main_->MainFrameWillHappenOnImplForTesting(&completion,
392 &main_frame_will_happen); 393 &main_frame_will_happen);
393 completion.Wait(); 394 completion.Wait();
394 } 395 }
395 return main_frame_will_happen; 396 return main_frame_will_happen;
396 } 397 }
397 398
398 void ProxyMain::ReleaseOutputSurface() { 399 void ProxyMain::ReleaseCompositorFrameSink() {
399 DCHECK(IsMainThread()); 400 DCHECK(IsMainThread());
400 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); 401 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_);
401 CompletionEvent completion; 402 CompletionEvent completion;
402 channel_main_->ReleaseOutputSurfaceOnImpl(&completion); 403 channel_main_->ReleaseCompositorFrameSinkOnImpl(&completion);
403 completion.Wait(); 404 completion.Wait();
404 } 405 }
405 406
406 void ProxyMain::UpdateTopControlsState(TopControlsState constraints, 407 void ProxyMain::UpdateTopControlsState(TopControlsState constraints,
407 TopControlsState current, 408 TopControlsState current,
408 bool animate) { 409 bool animate) {
409 DCHECK(IsMainThread()); 410 DCHECK(IsMainThread());
410 channel_main_->UpdateTopControlsStateOnImpl(constraints, current, animate); 411 channel_main_->UpdateTopControlsStateOnImpl(constraints, current, animate);
411 } 412 }
412 413
413 bool ProxyMain::SendCommitRequestToImplThreadIfNeeded( 414 bool ProxyMain::SendCommitRequestToImplThreadIfNeeded(
414 CommitPipelineStage required_stage) { 415 CommitPipelineStage required_stage) {
415 DCHECK(IsMainThread()); 416 DCHECK(IsMainThread());
416 DCHECK_NE(NO_PIPELINE_STAGE, required_stage); 417 DCHECK_NE(NO_PIPELINE_STAGE, required_stage);
417 bool already_posted = max_requested_pipeline_stage_ != NO_PIPELINE_STAGE; 418 bool already_posted = max_requested_pipeline_stage_ != NO_PIPELINE_STAGE;
418 max_requested_pipeline_stage_ = 419 max_requested_pipeline_stage_ =
419 std::max(max_requested_pipeline_stage_, required_stage); 420 std::max(max_requested_pipeline_stage_, required_stage);
420 if (already_posted) 421 if (already_posted)
421 return false; 422 return false;
422 channel_main_->SetNeedsCommitOnImpl(); 423 channel_main_->SetNeedsCommitOnImpl();
423 return true; 424 return true;
424 } 425 }
425 426
426 bool ProxyMain::IsMainThread() const { 427 bool ProxyMain::IsMainThread() const {
427 return task_runner_provider_->IsMainThread(); 428 return task_runner_provider_->IsMainThread();
428 } 429 }
429 430
430 } // namespace cc 431 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698