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

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

Issue 619843002: cc: Make separate interface for BeginFrame ipc from OutputSurface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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') | cc/trees/thread_proxy.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/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "cc/debug/benchmark_instrumentation.h" 9 #include "cc/debug/benchmark_instrumentation.h"
10 #include "cc/output/context_provider.h" 10 #include "cc/output/context_provider.h"
11 #include "cc/output/output_surface.h" 11 #include "cc/output/output_surface.h"
12 #include "cc/quads/draw_quad.h" 12 #include "cc/quads/draw_quad.h"
13 #include "cc/resources/prioritized_resource_manager.h" 13 #include "cc/resources/prioritized_resource_manager.h"
14 #include "cc/resources/resource_update_controller.h" 14 #include "cc/resources/resource_update_controller.h"
15 #include "cc/trees/layer_tree_host.h" 15 #include "cc/trees/layer_tree_host.h"
16 #include "cc/trees/layer_tree_host_single_thread_client.h" 16 #include "cc/trees/layer_tree_host_single_thread_client.h"
17 #include "cc/trees/layer_tree_impl.h" 17 #include "cc/trees/layer_tree_impl.h"
18 #include "cc/trees/scoped_abort_remaining_swap_promises.h" 18 #include "cc/trees/scoped_abort_remaining_swap_promises.h"
19 #include "ui/gfx/frame_time.h" 19 #include "ui/gfx/frame_time.h"
20 20
21 namespace cc { 21 namespace cc {
22 22
23 scoped_ptr<Proxy> SingleThreadProxy::Create( 23 scoped_ptr<Proxy> SingleThreadProxy::Create(
24 LayerTreeHost* layer_tree_host, 24 LayerTreeHost* layer_tree_host,
25 LayerTreeHostSingleThreadClient* client, 25 LayerTreeHostSingleThreadClient* client,
26 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) { 26 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
27 return make_scoped_ptr( 27 scoped_ptr<BeginFrameSource> external_begin_frame_source) {
28 new SingleThreadProxy(layer_tree_host, client, main_task_runner)); 28 return make_scoped_ptr(new SingleThreadProxy(
29 layer_tree_host,
30 client,
31 main_task_runner,
32 external_begin_frame_source.Pass()));
29 } 33 }
30 34
31 SingleThreadProxy::SingleThreadProxy( 35 SingleThreadProxy::SingleThreadProxy(
32 LayerTreeHost* layer_tree_host, 36 LayerTreeHost* layer_tree_host,
33 LayerTreeHostSingleThreadClient* client, 37 LayerTreeHostSingleThreadClient* client,
34 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) 38 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
39 scoped_ptr<BeginFrameSource> external_begin_frame_source)
35 : Proxy(main_task_runner, NULL), 40 : Proxy(main_task_runner, NULL),
36 layer_tree_host_(layer_tree_host), 41 layer_tree_host_(layer_tree_host),
37 client_(client), 42 client_(client),
38 timing_history_(layer_tree_host->rendering_stats_instrumentation()), 43 timing_history_(layer_tree_host->rendering_stats_instrumentation()),
39 next_frame_is_newly_committed_frame_(false), 44 next_frame_is_newly_committed_frame_(false),
40 inside_draw_(false), 45 inside_draw_(false),
41 defer_commits_(false), 46 defer_commits_(false),
42 commit_was_deferred_(false), 47 commit_was_deferred_(false),
43 commit_requested_(false), 48 commit_requested_(false),
44 inside_synchronous_composite_(false), 49 inside_synchronous_composite_(false),
45 output_surface_creation_requested_(false), 50 output_surface_creation_requested_(false),
51 external_begin_frame_source_(external_begin_frame_source.Pass()),
46 weak_factory_(this) { 52 weak_factory_(this) {
47 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); 53 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
48 DCHECK(Proxy::IsMainThread()); 54 DCHECK(Proxy::IsMainThread());
49 DCHECK(layer_tree_host); 55 DCHECK(layer_tree_host);
50 } 56 }
51 57
52 void SingleThreadProxy::Start() { 58 void SingleThreadProxy::Start() {
53 DebugScopedSetImplThread impl(this); 59 DebugScopedSetImplThread impl(this);
54 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); 60 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
55 } 61 }
(...skipping 21 matching lines...) Expand all
77 83
78 void SingleThreadProxy::SetLayerTreeHostClientReady() { 84 void SingleThreadProxy::SetLayerTreeHostClientReady() {
79 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); 85 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady");
80 // Scheduling is controlled by the embedder in the single thread case, so 86 // Scheduling is controlled by the embedder in the single thread case, so
81 // nothing to do. 87 // nothing to do.
82 DCHECK(Proxy::IsMainThread()); 88 DCHECK(Proxy::IsMainThread());
83 DebugScopedSetImplThread impl(this); 89 DebugScopedSetImplThread impl(this);
84 if (layer_tree_host_->settings().single_thread_proxy_scheduler && 90 if (layer_tree_host_->settings().single_thread_proxy_scheduler &&
85 !scheduler_on_impl_thread_) { 91 !scheduler_on_impl_thread_) {
86 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); 92 SchedulerSettings scheduler_settings(layer_tree_host_->settings());
87 scheduler_on_impl_thread_ = Scheduler::Create(this, 93 scheduler_on_impl_thread_ =
88 scheduler_settings, 94 Scheduler::Create(this,
89 layer_tree_host_->id(), 95 scheduler_settings,
90 MainThreadTaskRunner(), 96 layer_tree_host_->id(),
91 base::PowerMonitor::Get()); 97 MainThreadTaskRunner(),
98 base::PowerMonitor::Get(),
99 external_begin_frame_source_.Pass());
92 scheduler_on_impl_thread_->SetCanStart(); 100 scheduler_on_impl_thread_->SetCanStart();
93 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); 101 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
94 } 102 }
95 } 103 }
96 104
97 void SingleThreadProxy::SetVisible(bool visible) { 105 void SingleThreadProxy::SetVisible(bool visible) {
98 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible"); 106 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible");
99 DebugScopedSetImplThread impl(this); 107 DebugScopedSetImplThread impl(this);
100 layer_tree_host_impl_->SetVisible(visible); 108 layer_tree_host_impl_->SetVisible(visible);
101 if (scheduler_on_impl_thread_) 109 if (scheduler_on_impl_thread_)
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 DebugScopedSetMainThread main(this); 630 DebugScopedSetMainThread main(this);
623 next_frame_is_newly_committed_frame_ = false; 631 next_frame_is_newly_committed_frame_ = false;
624 layer_tree_host_->DidCommitAndDrawFrame(); 632 layer_tree_host_->DidCommitAndDrawFrame();
625 } 633 }
626 } 634 }
627 635
628 bool SingleThreadProxy::MainFrameWillHappenForTesting() { 636 bool SingleThreadProxy::MainFrameWillHappenForTesting() {
629 return false; 637 return false;
630 } 638 }
631 639
632 BeginFrameSource* SingleThreadProxy::ExternalBeginFrameSource() {
633 return layer_tree_host_impl_.get();
634 }
635
636 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { 640 void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
637 layer_tree_host_impl_->WillBeginImplFrame(args); 641 layer_tree_host_impl_->WillBeginImplFrame(args);
638 } 642 }
639 643
640 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { 644 void SingleThreadProxy::ScheduledActionSendBeginMainFrame() {
641 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); 645 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame");
642 // Although this proxy is single-threaded, it's problematic to synchronously 646 // Although this proxy is single-threaded, it's problematic to synchronously
643 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This 647 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This
644 // could cause a commit to occur in between a series of SetNeedsCommit calls 648 // could cause a commit to occur in between a series of SetNeedsCommit calls
645 // (i.e. property modifications) causing some to fall on one frame and some to 649 // (i.e. property modifications) causing some to fall on one frame and some to
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 794
791 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { 795 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
792 return timing_history_.CommitToActivateDurationEstimate(); 796 return timing_history_.CommitToActivateDurationEstimate();
793 } 797 }
794 798
795 void SingleThreadProxy::DidBeginImplFrameDeadline() { 799 void SingleThreadProxy::DidBeginImplFrameDeadline() {
796 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); 800 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
797 } 801 }
798 802
799 } // namespace cc 803 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/single_thread_proxy.h ('k') | cc/trees/thread_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698