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

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

Issue 400773002: cc: Parameterize the main thread task runner (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: WebView fix. 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
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl_unittest.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 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<base::SingleThreadTaskRunner> 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<base::SingleThreadTaskRunner> main_task_runner) {
84 scoped_ptr<LayerTreeHost> layer_tree_host( 87 scoped_ptr<LayerTreeHost> layer_tree_host(
85 new LayerTreeHost(client, manager, settings)); 88 new LayerTreeHost(client, manager, settings));
86 layer_tree_host->InitializeSingleThreaded(single_thread_client); 89 layer_tree_host->InitializeSingleThreaded(single_thread_client,
90 main_task_runner);
87 return layer_tree_host.Pass(); 91 return layer_tree_host.Pass();
88 } 92 }
89 93
90 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client, 94 LayerTreeHost::LayerTreeHost(LayerTreeHostClient* client,
91 SharedBitmapManager* manager, 95 SharedBitmapManager* manager,
92 const LayerTreeSettings& settings) 96 const LayerTreeSettings& settings)
93 : micro_benchmark_controller_(this), 97 : micro_benchmark_controller_(this),
94 next_ui_resource_id_(1), 98 next_ui_resource_id_(1),
95 animating_(false), 99 animating_(false),
96 needs_full_tree_sync_(true), 100 needs_full_tree_sync_(true),
(...skipping 21 matching lines...) Expand all
118 id_(s_layer_tree_host_sequence_number.GetNext() + 1), 122 id_(s_layer_tree_host_sequence_number.GetNext() + 1),
119 next_commit_forces_redraw_(false), 123 next_commit_forces_redraw_(false),
120 shared_bitmap_manager_(manager) { 124 shared_bitmap_manager_(manager) {
121 if (settings_.accelerated_animation_enabled) 125 if (settings_.accelerated_animation_enabled)
122 animation_registrar_ = AnimationRegistrar::Create(); 126 animation_registrar_ = AnimationRegistrar::Create();
123 rendering_stats_instrumentation_->set_record_rendering_stats( 127 rendering_stats_instrumentation_->set_record_rendering_stats(
124 debug_state_.RecordRenderingStats()); 128 debug_state_.RecordRenderingStats());
125 } 129 }
126 130
127 void LayerTreeHost::InitializeThreaded( 131 void LayerTreeHost::InitializeThreaded(
132 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
128 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) { 133 scoped_refptr<base::SingleThreadTaskRunner> impl_task_runner) {
129 InitializeProxy(ThreadProxy::Create(this, impl_task_runner)); 134 InitializeProxy(
135 ThreadProxy::Create(this, main_task_runner, impl_task_runner));
130 } 136 }
131 137
132 void LayerTreeHost::InitializeSingleThreaded( 138 void LayerTreeHost::InitializeSingleThreaded(
133 LayerTreeHostSingleThreadClient* single_thread_client) { 139 LayerTreeHostSingleThreadClient* single_thread_client,
134 InitializeProxy(SingleThreadProxy::Create(this, single_thread_client)); 140 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) {
141 InitializeProxy(
142 SingleThreadProxy::Create(this, single_thread_client, main_task_runner));
135 } 143 }
136 144
137 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) { 145 void LayerTreeHost::InitializeForTesting(scoped_ptr<Proxy> proxy_for_testing) {
138 InitializeProxy(proxy_for_testing.Pass()); 146 InitializeProxy(proxy_for_testing.Pass());
139 } 147 }
140 148
141 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { 149 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) {
142 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); 150 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal");
143 151
144 proxy_ = proxy.Pass(); 152 proxy_ = proxy.Pass();
(...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after
1274 swap_promise_list_.push_back(swap_promise.Pass()); 1282 swap_promise_list_.push_back(swap_promise.Pass());
1275 } 1283 }
1276 1284
1277 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { 1285 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) {
1278 for (size_t i = 0; i < swap_promise_list_.size(); i++) 1286 for (size_t i = 0; i < swap_promise_list_.size(); i++)
1279 swap_promise_list_[i]->DidNotSwap(reason); 1287 swap_promise_list_[i]->DidNotSwap(reason);
1280 swap_promise_list_.clear(); 1288 swap_promise_list_.clear();
1281 } 1289 }
1282 1290
1283 } // namespace cc 1291 } // namespace cc
OLDNEW
« no previous file with comments | « cc/trees/layer_tree_host.h ('k') | cc/trees/layer_tree_host_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698