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

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

Issue 2083423006: Remove default begin frame sources from the renderer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | content/renderer/gpu/compositor_output_surface.h » ('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 2011 The Chromium Authors. All rights reserved. 1 // Copyright 2011 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/single_thread_proxy.h" 5 #include "cc/trees/single_thread_proxy.h"
6 6
7 #include "base/auto_reset.h" 7 #include "base/auto_reset.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "base/profiler/scoped_tracker.h" 9 #include "base/profiler/scoped_tracker.h"
10 #include "base/trace_event/trace_event.h" 10 #include "base/trace_event/trace_event.h"
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
68 SchedulerSettings scheduler_settings( 68 SchedulerSettings scheduler_settings(
69 layer_tree_host_->settings().ToSchedulerSettings()); 69 layer_tree_host_->settings().ToSchedulerSettings());
70 scheduler_settings.commit_to_active_tree = CommitToActiveTree(); 70 scheduler_settings.commit_to_active_tree = CommitToActiveTree();
71 71
72 std::unique_ptr<CompositorTimingHistory> compositor_timing_history( 72 std::unique_ptr<CompositorTimingHistory> compositor_timing_history(
73 new CompositorTimingHistory( 73 new CompositorTimingHistory(
74 scheduler_settings.using_synchronous_renderer_compositor, 74 scheduler_settings.using_synchronous_renderer_compositor,
75 CompositorTimingHistory::BROWSER_UMA, 75 CompositorTimingHistory::BROWSER_UMA,
76 layer_tree_host_->rendering_stats_instrumentation())); 76 layer_tree_host_->rendering_stats_instrumentation()));
77 77
78 BeginFrameSource* frame_source = nullptr; 78 // BFS must either be external or come from the output surface. If
79 if (!layer_tree_host_->settings().use_output_surface_begin_frame_source) { 79 // external, it must be provided. If from the output surface, it must
80 frame_source = external_begin_frame_source_.get(); 80 // not be provided.
81 if (!scheduler_settings.throttle_frame_production) { 81 // TODO(enne): Make all BFS come from the output surface.
82 // Unthrottled source takes precedence over external sources. 82 DCHECK(layer_tree_host_->settings().use_external_begin_frame_source ^
83 unthrottled_begin_frame_source_.reset(new BackToBackBeginFrameSource( 83 layer_tree_host_->settings().use_output_surface_begin_frame_source);
84 base::MakeUnique<DelayBasedTimeSource>( 84 DCHECK(!layer_tree_host_->settings().use_external_begin_frame_source ||
85 task_runner_provider_->MainThreadTaskRunner()))); 85 external_begin_frame_source_);
86 frame_source = unthrottled_begin_frame_source_.get(); 86 DCHECK(
87 } 87 !layer_tree_host_->settings().use_output_surface_begin_frame_source ||
88 if (!frame_source) { 88 !external_begin_frame_source_);
89 synthetic_begin_frame_source_.reset(new DelayBasedBeginFrameSource(
90 base::MakeUnique<DelayBasedTimeSource>(
91 task_runner_provider_->MainThreadTaskRunner())));
92 frame_source = synthetic_begin_frame_source_.get();
93 }
94 }
95
96 scheduler_on_impl_thread_ = 89 scheduler_on_impl_thread_ =
97 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(), 90 Scheduler::Create(this, scheduler_settings, layer_tree_host_->id(),
98 task_runner_provider_->MainThreadTaskRunner(), 91 task_runner_provider_->MainThreadTaskRunner(),
99 frame_source, std::move(compositor_timing_history)); 92 external_begin_frame_source_.get(),
93 std::move(compositor_timing_history));
100 } 94 }
101 95
102 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 96 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
103 } 97 }
104 98
105 SingleThreadProxy::~SingleThreadProxy() { 99 SingleThreadProxy::~SingleThreadProxy() {
106 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); 100 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
107 DCHECK(task_runner_provider_->IsMainThread()); 101 DCHECK(task_runner_provider_->IsMainThread());
108 // Make sure Stop() got called or never Started. 102 // Make sure Stop() got called or never Started.
109 DCHECK(!layer_tree_host_impl_); 103 DCHECK(!layer_tree_host_impl_);
(...skipping 345 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 // This must happen before we notify the scheduler as it may try to recreate 449 // This must happen before we notify the scheduler as it may try to recreate
456 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. 450 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE.
457 layer_tree_host_->DidLoseOutputSurface(); 451 layer_tree_host_->DidLoseOutputSurface();
458 } 452 }
459 client_->DidAbortSwapBuffers(); 453 client_->DidAbortSwapBuffers();
460 if (scheduler_on_impl_thread_) 454 if (scheduler_on_impl_thread_)
461 scheduler_on_impl_thread_->DidLoseOutputSurface(); 455 scheduler_on_impl_thread_->DidLoseOutputSurface();
462 output_surface_lost_ = true; 456 output_surface_lost_ = true;
463 } 457 }
464 458
465 void SingleThreadProxy::CommitVSyncParameters(base::TimeTicks timebase,
466 base::TimeDelta interval) {
467 if (synthetic_begin_frame_source_)
468 synthetic_begin_frame_source_->OnUpdateVSyncParameters(timebase, interval);
469 }
470
471 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) { 459 void SingleThreadProxy::SetBeginFrameSource(BeginFrameSource* source) {
472 DCHECK(layer_tree_host_->settings().single_thread_proxy_scheduler); 460 DCHECK(layer_tree_host_->settings().single_thread_proxy_scheduler);
473 // TODO(enne): this overrides any preexisting begin frame source. Those 461 // TODO(enne): this overrides any preexisting begin frame source. Those
474 // other sources will eventually be removed and this will be the only path. 462 // other sources will eventually be removed and this will be the only path.
475 if (!layer_tree_host_->settings().use_output_surface_begin_frame_source) 463 if (!layer_tree_host_->settings().use_output_surface_begin_frame_source)
476 return; 464 return;
477 if (scheduler_on_impl_thread_) 465 if (scheduler_on_impl_thread_)
478 scheduler_on_impl_thread_->SetBeginFrameSource(source); 466 scheduler_on_impl_thread_->SetBeginFrameSource(source);
479 } 467 }
480 468
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
851 void SingleThreadProxy::DidFinishImplFrame() { 839 void SingleThreadProxy::DidFinishImplFrame() {
852 layer_tree_host_impl_->DidFinishImplFrame(); 840 layer_tree_host_impl_->DidFinishImplFrame();
853 #if DCHECK_IS_ON() 841 #if DCHECK_IS_ON()
854 DCHECK(inside_impl_frame_) 842 DCHECK(inside_impl_frame_)
855 << "DidFinishImplFrame called while not inside an impl frame!"; 843 << "DidFinishImplFrame called while not inside an impl frame!";
856 inside_impl_frame_ = false; 844 inside_impl_frame_ = false;
857 #endif 845 #endif
858 } 846 }
859 847
860 } // namespace cc 848 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | content/renderer/gpu/compositor_output_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698