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

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

Issue 363383002: Forward input tasks to the Blink scheduler (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Cleanup. DefaultMainThreadTaskRunner now dispatches properly. Created 6 years, 5 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 | Annotate | Revision Log
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/layer_tree_host.h" 5 #include "cc/trees/layer_tree_host.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <stack> 8 #include <stack>
9 #include <string> 9 #include <string>
10 10
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 allow_partial_texture_updates(false), 61 allow_partial_texture_updates(false),
62 max_texture_size(0), 62 max_texture_size(0),
63 using_shared_memory_resources(false) {} 63 using_shared_memory_resources(false) {}
64 64
65 RendererCapabilities::~RendererCapabilities() {} 65 RendererCapabilities::~RendererCapabilities() {}
66 66
67 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded( 67 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateThreaded(
68 LayerTreeHostClient* client, 68 LayerTreeHostClient* client,
69 SharedBitmapManager* manager, 69 SharedBitmapManager* manager,
70 const LayerTreeSettings& settings, 70 const LayerTreeSettings& settings,
71 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner,
71 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 72 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
73 DCHECK(main_task_runner);
72 DCHECK(impl_task_runner); 74 DCHECK(impl_task_runner);
73 scoped_ptr<LayerTreeHost> layer_tree_host( 75 scoped_ptr<LayerTreeHost> layer_tree_host(
74 new LayerTreeHost(client, manager, settings)); 76 new LayerTreeHost(client, manager, settings));
75 layer_tree_host->InitializeThreaded(impl_task_runner); 77 layer_tree_host->InitializeThreaded(main_task_runner, impl_task_runner);
76 return layer_tree_host.Pass(); 78 return layer_tree_host.Pass();
77 } 79 }
78 80
79 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded( 81 scoped_ptr<LayerTreeHost> LayerTreeHost::CreateSingleThreaded(
80 LayerTreeHostClient* client, 82 LayerTreeHostClient* client,
81 LayerTreeHostSingleThreadClient* single_thread_client, 83 LayerTreeHostSingleThreadClient* single_thread_client,
82 SharedBitmapManager* manager, 84 SharedBitmapManager* manager,
83 const LayerTreeSettings& settings) { 85 const LayerTreeSettings& settings,
86 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner) {
87 DCHECK(main_task_runner);
84 scoped_ptr<LayerTreeHost> layer_tree_host( 88 scoped_ptr<LayerTreeHost> layer_tree_host(
85 new LayerTreeHost(client, manager, settings)); 89 new LayerTreeHost(client, manager, settings));
86 layer_tree_host->InitializeSingleThreaded(single_thread_client); 90 layer_tree_host->InitializeSingleThreaded(single_thread_client,
91 main_task_runner);
87 return layer_tree_host.Pass(); 92 return layer_tree_host.Pass();
88 } 93 }
89 94
90 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, 95 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
91 SharedBitmapManager* manager, 96 SharedBitmapManager* manager,
92 const LayerTreeSettings& settings) 97 const LayerTreeSettings& settings)
93 : micro_benchmark_controller_(this), 98 : micro_benchmark_controller_(this),
94 next_ui_resource_id_(1), 99 next_ui_resource_id_(1),
95 animating_(false), 100 animating_(false),
96 needs_full_tree_sync_(true), 101 needs_full_tree_sync_(true),
(...skipping 21 matching lines...) Expand all
118 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 123 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
119 next_commit_forces_redraw_(false), 124 next_commit_forces_redraw_(false),
120 shared_bitmap_manager_(manager) { 125 shared_bitmap_manager_(manager) {
121 if (settings_.accelerated_animation_enabled) 126 if (settings_.accelerated_animation_enabled)
122 animation_registrar_ = AnimationRegistrar::Create(); 127 animation_registrar_ = AnimationRegistrar::Create();
123 rendering_stats_instrumentation_->set_record_rendering_stats( 128 rendering_stats_instrumentation_->set_record_rendering_stats(
124 debug_state_.RecordRenderingStats()); 129 debug_state_.RecordRenderingStats());
125 } 130 }
126 131
127 void LayerTreeHost::InitializeThreaded( 132 void LayerTreeHost::InitializeThreaded(
133 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner,
128 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 134 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
129 InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); 135 InitializeProxy(ThreadProxy::Create(this,
136 main_task_runner,
137 impl_task_runner));
130 } 138 }
131 139
132 void LayerTreeHost::InitializeSingleThreaded( 140 void LayerTreeHost::InitializeSingleThreaded(
133 LayerTreeHostSingleThreadClient* single_thread_client) { 141 LayerTreeHostSingleThreadClient* single_thread_client,
134 InitializeProxy(SingleThreadProxy::Create(this, single_thread_client)); 142 scoped_refptr<cc::MainThreadTaskRunner> main_task_runner) {
143 InitializeProxy(SingleThreadProxy::Create(this,
144 single_thread_client,
145 main_task_runner));
135 } 146 }
136 147
137 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { 148 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
138 InitializeProxy(proxy_for_testing.Pass()); 149 InitializeProxy(proxy_for_testing.Pass());
139 } 150 }
140 151
141 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { 152 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) {
142 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); 153 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal");
143 154
144 proxy_ = proxy.Pass(); 155 proxy_ = proxy.Pass();
(...skipping 1127 matching lines...) Expand 10 before | Expand all | Expand 10 after
1272 swap_promise_list_.push_back(swap_promise.Pass()); 1283 swap_promise_list_.push_back(swap_promise.Pass());
1273 } 1284 }
1274 1285
1275 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1286 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1276 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1287 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1277 swap_promise_list_[i]->DidNotSwap(reason); 1288 swap_promise_list_[i]->DidNotSwap(reason);
1278 swap_promise_list_.clear(); 1289 swap_promise_list_.clear();
1279 } 1290 }
1280 1291
1281 } // namespace cc 1292 } // namespace cc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698