[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 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 |
| 3 | // found in the LICENSE file. |
| 4 | |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 5 | #include "cc/trees/single_thread_proxy.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 6 | |
[email protected] | 74d9063c | 2013-01-18 03:14:47 | [diff] [blame] | 7 | #include "base/auto_reset.h" |
primiano | c06e238 | 2015-01-28 04:21:49 | [diff] [blame] | 8 | #include "base/trace_event/trace_event.h" |
[email protected] | adbe30f | 2013-10-11 21:12:33 | [diff] [blame] | 9 | #include "cc/debug/benchmark_instrumentation.h" |
caseq | 7d2f4c9 | 2015-02-04 16:43:27 | [diff] [blame^] | 10 | #include "cc/debug/devtools_instrumentation.h" |
[email protected] | 7f0d825f | 2013-03-18 07:24:30 | [diff] [blame] | 11 | #include "cc/output/context_provider.h" |
| 12 | #include "cc/output/output_surface.h" |
[email protected] | 89e8267 | 2013-03-18 07:50:56 | [diff] [blame] | 13 | #include "cc/quads/draw_quad.h" |
[email protected] | e12dd0e | 2013-03-18 08:24:40 | [diff] [blame] | 14 | #include "cc/resources/prioritized_resource_manager.h" |
| 15 | #include "cc/resources/resource_update_controller.h" |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 16 | #include "cc/scheduler/commit_earlyout_reason.h" |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 17 | #include "cc/trees/layer_tree_host.h" |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 18 | #include "cc/trees/layer_tree_host_single_thread_client.h" |
[email protected] | 556fd29 | 2013-03-18 08:03:04 | [diff] [blame] | 19 | #include "cc/trees/layer_tree_impl.h" |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 20 | #include "cc/trees/scoped_abort_remaining_swap_promises.h" |
[email protected] | de2cf8c | 2013-10-25 19:46:46 | [diff] [blame] | 21 | #include "ui/gfx/frame_time.h" |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 22 | |
[email protected] | 9c88e56 | 2012-09-14 22:21:30 | [diff] [blame] | 23 | namespace cc { |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 24 | |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 25 | scoped_ptr<Proxy> SingleThreadProxy::Create( |
| 26 | LayerTreeHost* layer_tree_host, |
[email protected] | 27e6a21 | 2014-07-18 15:51:27 | [diff] [blame] | 27 | LayerTreeHostSingleThreadClient* client, |
simonhong | a7e3ac4 | 2014-11-11 20:50:22 | [diff] [blame] | 28 | scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 29 | scoped_ptr<BeginFrameSource> external_begin_frame_source) { |
| 30 | return make_scoped_ptr(new SingleThreadProxy( |
| 31 | layer_tree_host, |
| 32 | client, |
| 33 | main_task_runner, |
| 34 | external_begin_frame_source.Pass())); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 35 | } |
| 36 | |
[email protected] | 27e6a21 | 2014-07-18 15:51:27 | [diff] [blame] | 37 | SingleThreadProxy::SingleThreadProxy( |
| 38 | LayerTreeHost* layer_tree_host, |
| 39 | LayerTreeHostSingleThreadClient* client, |
simonhong | a7e3ac4 | 2014-11-11 20:50:22 | [diff] [blame] | 40 | scoped_refptr<base::SingleThreadTaskRunner> main_task_runner, |
| 41 | scoped_ptr<BeginFrameSource> external_begin_frame_source) |
[email protected] | 27e6a21 | 2014-07-18 15:51:27 | [diff] [blame] | 42 | : Proxy(main_task_runner, NULL), |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 43 | layer_tree_host_(layer_tree_host), |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 44 | client_(client), |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 45 | timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 46 | next_frame_is_newly_committed_frame_(false), |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 47 | inside_draw_(false), |
| 48 | defer_commits_(false), |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 49 | commit_requested_(false), |
jbauman | 399aec1a | 2014-10-25 02:33:32 | [diff] [blame] | 50 | inside_synchronous_composite_(false), |
jbauman | 8ab0f9e | 2014-10-15 02:30:34 | [diff] [blame] | 51 | output_surface_creation_requested_(false), |
simonhong | a7e3ac4 | 2014-11-11 20:50:22 | [diff] [blame] | 52 | external_begin_frame_source_(external_begin_frame_source.Pass()), |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 53 | weak_factory_(this) { |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 54 | TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
| 55 | DCHECK(Proxy::IsMainThread()); |
| 56 | DCHECK(layer_tree_host); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 57 | } |
| 58 | |
[email protected] | e96e343 | 2013-12-19 18:56:07 | [diff] [blame] | 59 | void SingleThreadProxy::Start() { |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 60 | DebugScopedSetImplThread impl(this); |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 61 | layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 62 | } |
| 63 | |
| 64 | SingleThreadProxy::~SingleThreadProxy() { |
| 65 | TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); |
| 66 | DCHECK(Proxy::IsMainThread()); |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 67 | // Make sure Stop() got called or never Started. |
| 68 | DCHECK(!layer_tree_host_impl_); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 69 | } |
| 70 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 71 | void SingleThreadProxy::FinishAllRendering() { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 72 | TRACE_EVENT0("cc", "SingleThreadProxy::FinishAllRendering"); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 73 | DCHECK(Proxy::IsMainThread()); |
| 74 | { |
[email protected] | 61de581 | 2012-11-08 07:03:44 | [diff] [blame] | 75 | DebugScopedSetImplThread impl(this); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 76 | layer_tree_host_impl_->FinishAllRendering(); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 77 | } |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 78 | } |
| 79 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 80 | bool SingleThreadProxy::IsStarted() const { |
| 81 | DCHECK(Proxy::IsMainThread()); |
[email protected] | 3209161d | 2013-03-29 19:17:34 | [diff] [blame] | 82 | return layer_tree_host_impl_; |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 83 | } |
| 84 | |
[email protected] | 14bd554 | 2013-05-08 21:51:30 | [diff] [blame] | 85 | void SingleThreadProxy::SetLayerTreeHostClientReady() { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 86 | TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady"); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 87 | // Scheduling is controlled by the embedder in the single thread case, so |
| 88 | // nothing to do. |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 89 | DCHECK(Proxy::IsMainThread()); |
| 90 | DebugScopedSetImplThread impl(this); |
| 91 | if (layer_tree_host_->settings().single_thread_proxy_scheduler && |
| 92 | !scheduler_on_impl_thread_) { |
| 93 | SchedulerSettings scheduler_settings(layer_tree_host_->settings()); |
weiliangc | 5efa0a1 | 2015-01-29 19:56:46 | [diff] [blame] | 94 | // SingleThreadProxy should run in main thread low latency mode. |
weiliangc | 57b14e4a | 2014-12-04 22:59:09 | [diff] [blame] | 95 | scheduler_settings.main_thread_should_always_be_low_latency = true; |
simonhong | a7e3ac4 | 2014-11-11 20:50:22 | [diff] [blame] | 96 | scheduler_on_impl_thread_ = |
| 97 | Scheduler::Create(this, |
| 98 | scheduler_settings, |
| 99 | layer_tree_host_->id(), |
| 100 | MainThreadTaskRunner(), |
| 101 | base::PowerMonitor::Get(), |
| 102 | external_begin_frame_source_.Pass()); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 103 | scheduler_on_impl_thread_->SetCanStart(); |
| 104 | scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
| 105 | } |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 106 | } |
| 107 | |
| 108 | void SingleThreadProxy::SetVisible(bool visible) { |
mithro | 46adf5a | 2014-11-19 14:52:40 | [diff] [blame] | 109 | TRACE_EVENT1("cc", "SingleThreadProxy::SetVisible", "visible", visible); |
[email protected] | f7c01c8 | 2013-07-02 22:58:46 | [diff] [blame] | 110 | DebugScopedSetImplThread impl(this); |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 111 | layer_tree_host_impl_->SetVisible(visible); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 112 | if (scheduler_on_impl_thread_) |
| 113 | scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
[email protected] | 8ea875b | 2013-08-07 00:32:12 | [diff] [blame] | 114 | // Changing visibility could change ShouldComposite(). |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 115 | } |
| 116 | |
bajones | 27411061 | 2015-01-06 20:53:59 | [diff] [blame] | 117 | void SingleThreadProxy::SetThrottleFrameProduction(bool throttle) { |
| 118 | TRACE_EVENT1("cc", "SingleThreadProxy::SetThrottleFrameProduction", |
| 119 | "throttle", throttle); |
| 120 | DebugScopedSetImplThread impl(this); |
| 121 | if (scheduler_on_impl_thread_) |
| 122 | scheduler_on_impl_thread_->SetThrottleFrameProduction(throttle); |
| 123 | } |
| 124 | |
enne | 2097cab | 2014-09-25 20:16:31 | [diff] [blame] | 125 | void SingleThreadProxy::RequestNewOutputSurface() { |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 126 | DCHECK(Proxy::IsMainThread()); |
[email protected] | 497edf8 | 2014-05-20 21:53:15 | [diff] [blame] | 127 | DCHECK(layer_tree_host_->output_surface_lost()); |
jbauman | 8ab0f9e | 2014-10-15 02:30:34 | [diff] [blame] | 128 | output_surface_creation_callback_.Cancel(); |
| 129 | if (output_surface_creation_requested_) |
| 130 | return; |
| 131 | output_surface_creation_requested_ = true; |
enne | 2097cab | 2014-09-25 20:16:31 | [diff] [blame] | 132 | layer_tree_host_->RequestNewOutputSurface(); |
| 133 | } |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 134 | |
enne | 2097cab | 2014-09-25 20:16:31 | [diff] [blame] | 135 | void SingleThreadProxy::SetOutputSurface( |
| 136 | scoped_ptr<OutputSurface> output_surface) { |
| 137 | DCHECK(Proxy::IsMainThread()); |
| 138 | DCHECK(layer_tree_host_->output_surface_lost()); |
enne | 5232fbb | 2015-01-27 21:22:41 | [diff] [blame] | 139 | DCHECK(output_surface_creation_requested_); |
[email protected] | da8e3b72b | 2014-04-25 02:33:45 | [diff] [blame] | 140 | renderer_capabilities_for_main_thread_ = RendererCapabilities(); |
| 141 | |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 142 | bool success; |
| 143 | { |
[email protected] | 819b9f5 | 2013-09-22 23:29:51 | [diff] [blame] | 144 | DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 145 | DebugScopedSetImplThread impl(this); |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 146 | layer_tree_host_->DeleteContentsTexturesOnImplThread( |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 147 | layer_tree_host_impl_->resource_provider()); |
[email protected] | da8e3b72b | 2014-04-25 02:33:45 | [diff] [blame] | 148 | success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 149 | } |
| 150 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 151 | if (success) { |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 152 | layer_tree_host_->DidInitializeOutputSurface(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 153 | if (scheduler_on_impl_thread_) |
| 154 | scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
jbauman | 399aec1a | 2014-10-25 02:33:32 | [diff] [blame] | 155 | else if (!inside_synchronous_composite_) |
| 156 | SetNeedsCommit(); |
enne | 5232fbb | 2015-01-27 21:22:41 | [diff] [blame] | 157 | output_surface_creation_requested_ = false; |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 158 | } else { |
enne | 5232fbb | 2015-01-27 21:22:41 | [diff] [blame] | 159 | // DidFailToInitializeOutputSurface is treated as a RequestNewOutputSurface, |
| 160 | // and so output_surface_creation_requested remains true. |
enne | 7f8fdde | 2014-12-10 21:32:09 | [diff] [blame] | 161 | layer_tree_host_->DidFailToInitializeOutputSurface(); |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 162 | } |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 163 | } |
| 164 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 165 | const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 166 | DCHECK(Proxy::IsMainThread()); |
| 167 | DCHECK(!layer_tree_host_->output_surface_lost()); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 168 | return renderer_capabilities_for_main_thread_; |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 169 | } |
| 170 | |
[email protected] | 8b9e52b | 2014-01-17 16:35:31 | [diff] [blame] | 171 | void SingleThreadProxy::SetNeedsAnimate() { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 172 | TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate"); |
[email protected] | c513417 | 2013-12-11 06:19:48 | [diff] [blame] | 173 | DCHECK(Proxy::IsMainThread()); |
[email protected] | 06cbc31b | 2014-01-17 06:43:20 | [diff] [blame] | 174 | client_->ScheduleAnimation(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 175 | SetNeedsCommit(); |
[email protected] | c513417 | 2013-12-11 06:19:48 | [diff] [blame] | 176 | } |
| 177 | |
[email protected] | 8b9e52b | 2014-01-17 16:35:31 | [diff] [blame] | 178 | void SingleThreadProxy::SetNeedsUpdateLayers() { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 179 | TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers"); |
[email protected] | 8b9e52b | 2014-01-17 16:35:31 | [diff] [blame] | 180 | DCHECK(Proxy::IsMainThread()); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 181 | SetNeedsCommit(); |
[email protected] | 8b9e52b | 2014-01-17 16:35:31 | [diff] [blame] | 182 | } |
| 183 | |
mithro | 719bf679 | 2014-11-10 15:36:47 | [diff] [blame] | 184 | void SingleThreadProxy::DoAnimate() { |
| 185 | // Don't animate if there is no root layer. |
| 186 | // TODO(mithro): Both Animate and UpdateAnimationState already have a |
| 187 | // "!active_tree_->root_layer()" check? |
| 188 | if (!layer_tree_host_impl_->active_tree()->root_layer()) { |
| 189 | return; |
| 190 | } |
| 191 | |
| 192 | layer_tree_host_impl_->Animate( |
| 193 | layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); |
| 194 | |
| 195 | // If animations are not visible, update the animation state now as it |
| 196 | // won't happen in DoComposite. |
| 197 | if (!layer_tree_host_impl_->AnimationsAreVisible()) { |
| 198 | layer_tree_host_impl_->UpdateAnimationState(true); |
| 199 | } |
| 200 | } |
| 201 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 202 | void SingleThreadProxy::DoCommit() { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 203 | TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit"); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 204 | DCHECK(Proxy::IsMainThread()); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 205 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 206 | commit_requested_ = false; |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 207 | layer_tree_host_->WillCommit(); |
caseq | 7d2f4c9 | 2015-02-04 16:43:27 | [diff] [blame^] | 208 | devtools_instrumentation::ScopedCommitTrace commit_task( |
| 209 | layer_tree_host_->id()); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 210 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 211 | // Commit immediately. |
| 212 | { |
[email protected] | 819b9f5 | 2013-09-22 23:29:51 | [diff] [blame] | 213 | DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
[email protected] | f7c01c8 | 2013-07-02 22:58:46 | [diff] [blame] | 214 | DebugScopedSetImplThread impl(this); |
| 215 | |
[email protected] | 9794fb3 | 2013-08-29 09:49:59 | [diff] [blame] | 216 | // This CapturePostTasks should be destroyed before CommitComplete() is |
| 217 | // called since that goes out to the embedder, and we want the embedder |
| 218 | // to receive its callbacks before that. |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 219 | commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks( |
| 220 | blocking_main_thread_task_runner())); |
[email protected] | 9794fb3 | 2013-08-29 09:49:59 | [diff] [blame] | 221 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 222 | layer_tree_host_impl_->BeginCommit(); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 223 | |
[email protected] | 5d2fec0 | 2013-11-28 20:08:33 | [diff] [blame] | 224 | if (PrioritizedResourceManager* contents_texture_manager = |
| 225 | layer_tree_host_->contents_texture_manager()) { |
| 226 | contents_texture_manager->PushTexturePrioritiesToBackings(); |
[email protected] | 6e8c5492 | 2013-06-02 19:17:35 | [diff] [blame] | 227 | } |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 228 | layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 229 | |
[email protected] | ed511b8d | 2013-03-25 03:29:29 | [diff] [blame] | 230 | scoped_ptr<ResourceUpdateController> update_controller = |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 231 | ResourceUpdateController::Create( |
| 232 | NULL, |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 233 | MainThreadTaskRunner(), |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 234 | queue_for_commit_.Pass(), |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 235 | layer_tree_host_impl_->resource_provider()); |
[email protected] | ed511b8d | 2013-03-25 03:29:29 | [diff] [blame] | 236 | update_controller->Finalize(); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 237 | |
[email protected] | 127bdc1a | 2013-09-11 01:44:48 | [diff] [blame] | 238 | if (layer_tree_host_impl_->EvictedUIResourcesExist()) |
| 239 | layer_tree_host_->RecreateUIResources(); |
| 240 | |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 241 | layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get()); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 242 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 243 | layer_tree_host_impl_->CommitComplete(); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 244 | |
danakj | e649f57 | 2015-01-08 23:35:58 | [diff] [blame] | 245 | #if DCHECK_IS_ON() |
[email protected] | 3519b87 | 2013-07-30 07:17:50 | [diff] [blame] | 246 | // In the single-threaded case, the scale and scroll deltas should never be |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 247 | // touched on the impl layer tree. |
[email protected] | ed511b8d | 2013-03-25 03:29:29 | [diff] [blame] | 248 | scoped_ptr<ScrollAndScaleSet> scroll_info = |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 249 | layer_tree_host_impl_->ProcessScrollDeltas(); |
[email protected] | ed511b8d | 2013-03-25 03:29:29 | [diff] [blame] | 250 | DCHECK(!scroll_info->scrolls.size()); |
[email protected] | 3519b87 | 2013-07-30 07:17:50 | [diff] [blame] | 251 | DCHECK_EQ(1.f, scroll_info->page_scale_delta); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 252 | #endif |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 253 | } |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 254 | |
| 255 | if (layer_tree_host_->settings().impl_side_painting) { |
| 256 | // TODO(enne): just commit directly to the active tree. |
| 257 | // |
| 258 | // Synchronously activate during commit to satisfy any potential |
| 259 | // SetNextCommitWaitsForActivation calls. Unfortunately, the tree |
| 260 | // might not be ready to draw, so DidActivateSyncTree must set |
| 261 | // the flag to force the tree to not draw until textures are ready. |
| 262 | NotifyReadyToActivate(); |
| 263 | } else { |
| 264 | CommitComplete(); |
| 265 | } |
| 266 | } |
| 267 | |
| 268 | void SingleThreadProxy::CommitComplete() { |
| 269 | DCHECK(!layer_tree_host_impl_->pending_tree()) |
| 270 | << "Activation is expected to have synchronously occurred by now."; |
| 271 | DCHECK(commit_blocking_task_runner_); |
| 272 | |
| 273 | DebugScopedSetMainThread main(this); |
| 274 | commit_blocking_task_runner_.reset(); |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 275 | layer_tree_host_->CommitComplete(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 276 | layer_tree_host_->DidBeginMainFrame(); |
| 277 | timing_history_.DidCommit(); |
| 278 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 279 | next_frame_is_newly_committed_frame_ = true; |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 280 | } |
| 281 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 282 | void SingleThreadProxy::SetNeedsCommit() { |
| 283 | DCHECK(Proxy::IsMainThread()); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 284 | DebugScopedSetImplThread impl(this); |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 285 | client_->ScheduleComposite(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 286 | if (scheduler_on_impl_thread_) |
| 287 | scheduler_on_impl_thread_->SetNeedsCommit(); |
| 288 | commit_requested_ = true; |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 289 | } |
| 290 | |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 291 | void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 292 | TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 293 | DCHECK(Proxy::IsMainThread()); |
| 294 | DebugScopedSetImplThread impl(this); |
[email protected] | 2decdd78 | 2014-08-13 22:36:06 | [diff] [blame] | 295 | client_->ScheduleComposite(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 296 | SetNeedsRedrawRectOnImplThread(damage_rect); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 297 | } |
| 298 | |
[email protected] | 74b43cc | 2013-08-30 06:29:27 | [diff] [blame] | 299 | void SingleThreadProxy::SetNextCommitWaitsForActivation() { |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 300 | // Activation always forced in commit, so nothing to do. |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 301 | DCHECK(Proxy::IsMainThread()); |
[email protected] | 74b43cc | 2013-08-30 06:29:27 | [diff] [blame] | 302 | } |
| 303 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 304 | void SingleThreadProxy::SetDeferCommits(bool defer_commits) { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 305 | DCHECK(Proxy::IsMainThread()); |
| 306 | // Deferring commits only makes sense if there's a scheduler. |
| 307 | if (!scheduler_on_impl_thread_) |
| 308 | return; |
| 309 | if (defer_commits_ == defer_commits) |
| 310 | return; |
| 311 | |
| 312 | if (defer_commits) |
| 313 | TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::SetDeferCommits", this); |
| 314 | else |
| 315 | TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::SetDeferCommits", this); |
| 316 | |
| 317 | defer_commits_ = defer_commits; |
simonhong | c6309f79 | 2015-01-31 15:47:15 | [diff] [blame] | 318 | scheduler_on_impl_thread_->SetDeferCommits(defer_commits); |
[email protected] | 6b16679e | 2012-10-27 00:44:28 | [diff] [blame] | 319 | } |
| 320 | |
[email protected] | 174c6d4 | 2014-08-12 01:43:06 | [diff] [blame] | 321 | bool SingleThreadProxy::CommitRequested() const { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 322 | DCHECK(Proxy::IsMainThread()); |
| 323 | return commit_requested_; |
[email protected] | 174c6d4 | 2014-08-12 01:43:06 | [diff] [blame] | 324 | } |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 325 | |
[email protected] | 174c6d4 | 2014-08-12 01:43:06 | [diff] [blame] | 326 | bool SingleThreadProxy::BeginMainFrameRequested() const { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 327 | DCHECK(Proxy::IsMainThread()); |
| 328 | // If there is no scheduler, then there can be no pending begin frame, |
| 329 | // as all frames are all manually initiated by the embedder of cc. |
| 330 | if (!scheduler_on_impl_thread_) |
| 331 | return false; |
| 332 | return commit_requested_; |
[email protected] | 174c6d4 | 2014-08-12 01:43:06 | [diff] [blame] | 333 | } |
[email protected] | 971728d | 2013-10-26 10:39:31 | [diff] [blame] | 334 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 335 | size_t SingleThreadProxy::MaxPartialTextureUpdates() const { |
| 336 | return std::numeric_limits<size_t>::max(); |
| 337 | } |
| 338 | |
| 339 | void SingleThreadProxy::Stop() { |
| 340 | TRACE_EVENT0("cc", "SingleThreadProxy::stop"); |
| 341 | DCHECK(Proxy::IsMainThread()); |
| 342 | { |
[email protected] | 819b9f5 | 2013-09-22 23:29:51 | [diff] [blame] | 343 | DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 344 | DebugScopedSetImplThread impl(this); |
| 345 | |
skyostil | 3976a3f | 2014-09-04 22:07:23 | [diff] [blame] | 346 | BlockingTaskRunner::CapturePostTasks blocked( |
| 347 | blocking_main_thread_task_runner()); |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 348 | layer_tree_host_->DeleteContentsTexturesOnImplThread( |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 349 | layer_tree_host_impl_->resource_provider()); |
danakj | f446a07 | 2014-09-27 21:55:48 | [diff] [blame] | 350 | scheduler_on_impl_thread_ = nullptr; |
| 351 | layer_tree_host_impl_ = nullptr; |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 352 | } |
[email protected] | 7aba666 | 2013-03-12 10:17:34 | [diff] [blame] | 353 | layer_tree_host_ = NULL; |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 354 | } |
| 355 | |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 356 | void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 357 | TRACE_EVENT1( |
| 358 | "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 359 | DCHECK(Proxy::IsImplThread()); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 360 | if (scheduler_on_impl_thread_) |
| 361 | scheduler_on_impl_thread_->SetCanDraw(can_draw); |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 362 | } |
| 363 | |
[email protected] | 4f48f6e | 2013-08-27 06:33:38 | [diff] [blame] | 364 | void SingleThreadProxy::NotifyReadyToActivate() { |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 365 | TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToActivate"); |
| 366 | DebugScopedSetImplThread impl(this); |
| 367 | if (scheduler_on_impl_thread_) |
| 368 | scheduler_on_impl_thread_->NotifyReadyToActivate(); |
[email protected] | 4f48f6e | 2013-08-27 06:33:38 | [diff] [blame] | 369 | } |
| 370 | |
ernstm | dfac03e | 2014-11-11 20:18:05 | [diff] [blame] | 371 | void SingleThreadProxy::NotifyReadyToDraw() { |
| 372 | } |
| 373 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 374 | void SingleThreadProxy::SetNeedsRedrawOnImplThread() { |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 375 | client_->ScheduleComposite(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 376 | if (scheduler_on_impl_thread_) |
| 377 | scheduler_on_impl_thread_->SetNeedsRedraw(); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 378 | } |
| 379 | |
[email protected] | 43b8f98 | 2014-04-30 21:24:33 | [diff] [blame] | 380 | void SingleThreadProxy::SetNeedsAnimateOnImplThread() { |
mithro | 719bf679 | 2014-11-10 15:36:47 | [diff] [blame] | 381 | client_->ScheduleComposite(); |
| 382 | if (scheduler_on_impl_thread_) |
| 383 | scheduler_on_impl_thread_->SetNeedsAnimate(); |
[email protected] | 43b8f98 | 2014-04-30 21:24:33 | [diff] [blame] | 384 | } |
| 385 | |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 386 | void SingleThreadProxy::SetNeedsPrepareTilesOnImplThread() { |
| 387 | TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsPrepareTilesOnImplThread"); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 388 | if (scheduler_on_impl_thread_) |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 389 | scheduler_on_impl_thread_->SetNeedsPrepareTiles(); |
[email protected] | c48536a5 | 2013-09-14 00:02:08 | [diff] [blame] | 390 | } |
| 391 | |
[email protected] | 0023fc7 | 2014-01-10 20:05:06 | [diff] [blame] | 392 | void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( |
| 393 | const gfx::Rect& damage_rect) { |
[email protected] | 1cd9f555 | 2013-04-26 04:22:03 | [diff] [blame] | 394 | layer_tree_host_impl_->SetViewportDamage(damage_rect); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 395 | SetNeedsRedrawOnImplThread(); |
[email protected] | 1cd9f555 | 2013-04-26 04:22:03 | [diff] [blame] | 396 | } |
| 397 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 398 | void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
[email protected] | 943528e | 2013-11-07 05:01:32 | [diff] [blame] | 399 | client_->ScheduleComposite(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 400 | if (scheduler_on_impl_thread_) |
| 401 | scheduler_on_impl_thread_->SetNeedsCommit(); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 402 | } |
| 403 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 404 | void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
[email protected] | 85b5750 | 2014-03-11 15:37:48 | [diff] [blame] | 405 | scoped_ptr<AnimationEventsVector> events) { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 406 | TRACE_EVENT0( |
| 407 | "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread"); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 408 | DCHECK(Proxy::IsImplThread()); |
| 409 | DebugScopedSetMainThread main(this); |
[email protected] | 85b5750 | 2014-03-11 15:37:48 | [diff] [blame] | 410 | layer_tree_host_->SetAnimationEvents(events.Pass()); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 411 | } |
| 412 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 413 | bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread( |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 414 | size_t limit_bytes, |
| 415 | int priority_cutoff) { |
| 416 | DCHECK(IsImplThread()); |
[email protected] | 5d2fec0 | 2013-11-28 20:08:33 | [diff] [blame] | 417 | PrioritizedResourceManager* contents_texture_manager = |
| 418 | layer_tree_host_->contents_texture_manager(); |
| 419 | |
| 420 | ResourceProvider* resource_provider = |
| 421 | layer_tree_host_impl_->resource_provider(); |
| 422 | |
| 423 | if (!contents_texture_manager || !resource_provider) |
[email protected] | e7595ead | 2013-10-10 10:10:07 | [diff] [blame] | 424 | return false; |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 425 | |
[email protected] | 5d2fec0 | 2013-11-28 20:08:33 | [diff] [blame] | 426 | return contents_texture_manager->ReduceMemoryOnImplThread( |
| 427 | limit_bytes, priority_cutoff, resource_provider); |
[email protected] | 94f206c1 | 2012-08-25 00:09:14 | [diff] [blame] | 428 | } |
| 429 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 430 | bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 431 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 432 | void SingleThreadProxy::DidActivateSyncTree() { |
| 433 | // Non-impl-side painting finishes commit in DoCommit. Impl-side painting |
| 434 | // defers until here to simulate SetNextCommitWaitsForActivation. |
| 435 | if (layer_tree_host_impl_->settings().impl_side_painting) { |
| 436 | // This is required because NotifyReadyToActivate gets called when |
| 437 | // the pending tree is not actually ready in the SingleThreadProxy. |
| 438 | layer_tree_host_impl_->SetRequiresHighResToDraw(); |
| 439 | |
weiliangc | 5efa0a1 | 2015-01-29 19:56:46 | [diff] [blame] | 440 | // Synchronously call to CommitComplete. Resetting |
| 441 | // |commit_blocking_task_runner| would make sure all tasks posted during |
| 442 | // commit/activation before CommitComplete. |
enne | 5bea30e7 | 2014-12-18 00:36:17 | [diff] [blame] | 443 | CommitComplete(); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 444 | } |
| 445 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 446 | timing_history_.DidActivateSyncTree(); |
| 447 | } |
| 448 | |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 449 | void SingleThreadProxy::DidPrepareTiles() { |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 450 | DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 451 | DCHECK(Proxy::IsImplThread()); |
| 452 | if (scheduler_on_impl_thread_) |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 453 | scheduler_on_impl_thread_->DidPrepareTiles(); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 454 | } |
| 455 | |
rouslan | f7ebd883 | 2015-01-22 01:54:14 | [diff] [blame] | 456 | void SingleThreadProxy::DidCompletePageScaleAnimationOnImplThread() { |
| 457 | layer_tree_host_->DidCompletePageScaleAnimation(); |
| 458 | } |
| 459 | |
[email protected] | fa33903 | 2014-02-18 22:11:59 | [diff] [blame] | 460 | void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
| 461 | DCHECK(IsImplThread()); |
| 462 | renderer_capabilities_for_main_thread_ = |
| 463 | layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); |
| 464 | } |
| 465 | |
[email protected] | c1bb5af | 2013-03-13 19:06:27 | [diff] [blame] | 466 | void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 467 | TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 468 | { |
| 469 | DebugScopedSetMainThread main(this); |
| 470 | // This must happen before we notify the scheduler as it may try to recreate |
| 471 | // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. |
| 472 | layer_tree_host_->DidLoseOutputSurface(); |
| 473 | } |
[email protected] | 4d7e46a | 2013-11-08 05:33:40 | [diff] [blame] | 474 | client_->DidAbortSwapBuffers(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 475 | if (scheduler_on_impl_thread_) |
| 476 | scheduler_on_impl_thread_->DidLoseOutputSurface(); |
[email protected] | 4d7e46a | 2013-11-08 05:33:40 | [diff] [blame] | 477 | } |
| 478 | |
weiliangc | af17af4 | 2014-12-15 22:17:02 | [diff] [blame] | 479 | void SingleThreadProxy::CommitVSyncParameters(base::TimeTicks timebase, |
| 480 | base::TimeDelta interval) { |
| 481 | if (scheduler_on_impl_thread_) |
| 482 | scheduler_on_impl_thread_->CommitVSyncParameters(timebase, interval); |
| 483 | } |
| 484 | |
[email protected] | 4d7e46a | 2013-11-08 05:33:40 | [diff] [blame] | 485 | void SingleThreadProxy::DidSwapBuffersOnImplThread() { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 486 | TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread"); |
| 487 | if (scheduler_on_impl_thread_) |
| 488 | scheduler_on_impl_thread_->DidSwapBuffers(); |
[email protected] | 4d7e46a | 2013-11-08 05:33:40 | [diff] [blame] | 489 | client_->DidPostSwapBuffers(); |
| 490 | } |
| 491 | |
[email protected] | c1490266 | 2014-04-18 05:06:11 | [diff] [blame] | 492 | void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
miletus | fed8c43b | 2015-01-26 20:04:52 | [diff] [blame] | 493 | TRACE_EVENT0("cc,benchmark", |
| 494 | "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 495 | if (scheduler_on_impl_thread_) |
| 496 | scheduler_on_impl_thread_->DidSwapBuffersComplete(); |
| 497 | layer_tree_host_->DidCompleteSwapBuffers(); |
[email protected] | 49306751 | 2012-09-19 23:34:10 | [diff] [blame] | 498 | } |
| 499 | |
[email protected] | f0c2a24 | 2013-03-15 19:34:52 | [diff] [blame] | 500 | void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
miletus | fed8c43b | 2015-01-26 20:04:52 | [diff] [blame] | 501 | TRACE_EVENT0("cc,benchmark", "SingleThreadProxy::CompositeImmediately"); |
[email protected] | 51f81da | 2014-05-16 21:29:26 | [diff] [blame] | 502 | DCHECK(Proxy::IsMainThread()); |
jbauman | 399aec1a | 2014-10-25 02:33:32 | [diff] [blame] | 503 | base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true); |
| 504 | |
| 505 | if (layer_tree_host_->output_surface_lost()) { |
| 506 | RequestNewOutputSurface(); |
| 507 | // RequestNewOutputSurface could have synchronously created an output |
| 508 | // surface, so check again before returning. |
| 509 | if (layer_tree_host_->output_surface_lost()) |
| 510 | return; |
| 511 | } |
[email protected] | 51f81da | 2014-05-16 21:29:26 | [diff] [blame] | 512 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 513 | { |
mithro | bfa0ec0 | 2014-11-21 15:13:49 | [diff] [blame] | 514 | BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
mithro | 06d1f3bf | 2014-12-02 02:19:15 | [diff] [blame] | 515 | BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), |
| 516 | BeginFrameArgs::DefaultInterval(), BeginFrameArgs::SYNCHRONOUS)); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 517 | DoBeginMainFrame(begin_frame_args); |
| 518 | DoCommit(); |
[email protected] | e034135 | 2013-04-06 05:01:20 | [diff] [blame] | 519 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 520 | DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) |
| 521 | << "Commit should always succeed and transfer promises."; |
| 522 | } |
| 523 | |
| 524 | { |
| 525 | DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
enne | 69277cb | 2014-10-29 23:03:40 | [diff] [blame] | 526 | if (layer_tree_host_impl_->settings().impl_side_painting) { |
| 527 | layer_tree_host_impl_->ActivateSyncTree(); |
| 528 | layer_tree_host_impl_->active_tree()->UpdateDrawProperties(); |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 529 | layer_tree_host_impl_->PrepareTiles(); |
enne | 69277cb | 2014-10-29 23:03:40 | [diff] [blame] | 530 | layer_tree_host_impl_->SynchronouslyInitializeAllTiles(); |
| 531 | } |
| 532 | |
mithro | 719bf679 | 2014-11-10 15:36:47 | [diff] [blame] | 533 | DoAnimate(); |
| 534 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 535 | LayerTreeHostImpl::FrameData frame; |
| 536 | DoComposite(frame_begin_time, &frame); |
| 537 | |
| 538 | // DoComposite could abort, but because this is a synchronous composite |
| 539 | // another draw will never be scheduled, so break remaining promises. |
| 540 | layer_tree_host_impl_->active_tree()->BreakSwapPromises( |
| 541 | SwapPromise::SWAP_FAILS); |
| 542 | } |
[email protected] | 74d9063c | 2013-01-18 03:14:47 | [diff] [blame] | 543 | } |
| 544 | |
[email protected] | d12aa93 | 2014-08-01 13:10:38 | [diff] [blame] | 545 | void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { |
| 546 | // The following line casts away const modifiers because it is just |
| 547 | // setting debug state. We still want the AsValue() function and its |
| 548 | // call chain to be const throughout. |
| 549 | DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 550 | |
[email protected] | d12aa93 | 2014-08-01 13:10:38 | [diff] [blame] | 551 | state->BeginDictionary("layer_tree_host_impl"); |
| 552 | layer_tree_host_impl_->AsValueInto(state); |
| 553 | state->EndDictionary(); |
[email protected] | 49306751 | 2012-09-19 23:34:10 | [diff] [blame] | 554 | } |
| 555 | |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 556 | void SingleThreadProxy::ForceSerializeOnSwapBuffers() { |
| 557 | { |
| 558 | DebugScopedSetImplThread impl(this); |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 559 | if (layer_tree_host_impl_->renderer()) { |
| 560 | DCHECK(!layer_tree_host_->output_surface_lost()); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 561 | layer_tree_host_impl_->renderer()->DoNoOp(); |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 562 | } |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 563 | } |
[email protected] | 8947cbe | 2012-11-28 05:27:43 | [diff] [blame] | 564 | } |
| 565 | |
[email protected] | 5d8bec7 | 2014-07-03 03:03:11 | [diff] [blame] | 566 | bool SingleThreadProxy::SupportsImplScrolling() const { |
| 567 | return false; |
| 568 | } |
| 569 | |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 570 | bool SingleThreadProxy::ShouldComposite() const { |
| 571 | DCHECK(Proxy::IsImplThread()); |
| 572 | return layer_tree_host_impl_->visible() && |
| 573 | layer_tree_host_impl_->CanDraw(); |
| 574 | } |
| 575 | |
jbauman | 8ab0f9e | 2014-10-15 02:30:34 | [diff] [blame] | 576 | void SingleThreadProxy::ScheduleRequestNewOutputSurface() { |
| 577 | if (output_surface_creation_callback_.IsCancelled() && |
| 578 | !output_surface_creation_requested_) { |
| 579 | output_surface_creation_callback_.Reset( |
| 580 | base::Bind(&SingleThreadProxy::RequestNewOutputSurface, |
| 581 | weak_factory_.GetWeakPtr())); |
| 582 | MainThreadTaskRunner()->PostTask( |
| 583 | FROM_HERE, output_surface_creation_callback_.callback()); |
| 584 | } |
| 585 | } |
| 586 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 587 | DrawResult SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time, |
| 588 | LayerTreeHostImpl::FrameData* frame) { |
[email protected] | ccc08dc | 2014-01-30 07:33:20 | [diff] [blame] | 589 | TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite"); |
[email protected] | 04049fc | 2013-05-01 03:13:20 | [diff] [blame] | 590 | DCHECK(!layer_tree_host_->output_surface_lost()); |
| 591 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 592 | DrawResult draw_result; |
| 593 | bool draw_frame; |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 594 | { |
| 595 | DebugScopedSetImplThread impl(this); |
| 596 | base::AutoReset<bool> mark_inside(&inside_draw_, true); |
| 597 | |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 598 | // We guard PrepareToDraw() with CanDraw() because it always returns a valid |
| 599 | // frame, so can only be used when such a frame is possible. Since |
| 600 | // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on |
| 601 | // CanDraw() as well. |
[email protected] | 2aae9679 | 2014-05-15 23:10:50 | [diff] [blame] | 602 | if (!ShouldComposite()) { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 603 | return DRAW_ABORTED_CANT_DRAW; |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 604 | } |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 605 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 606 | timing_history_.DidStartDrawing(); |
| 607 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 608 | draw_result = layer_tree_host_impl_->PrepareToDraw(frame); |
| 609 | draw_frame = draw_result == DRAW_SUCCESS; |
| 610 | if (draw_frame) |
| 611 | layer_tree_host_impl_->DrawLayers(frame, frame_begin_time); |
dneto | b71e30c | 2014-08-25 23:27:20 | [diff] [blame] | 612 | layer_tree_host_impl_->DidDrawAllLayers(*frame); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 613 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 614 | bool start_ready_animations = draw_frame; |
[email protected] | 3d9f743 | 2013-04-06 00:35:18 | [diff] [blame] | 615 | layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); |
[email protected] | 04c5900d | 2014-08-18 13:38:36 | [diff] [blame] | 616 | layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 617 | |
| 618 | timing_history_.DidFinishDrawing(); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 619 | } |
| 620 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 621 | if (draw_frame) { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 622 | DebugScopedSetImplThread impl(this); |
[email protected] | 174c6d4 | 2014-08-12 01:43:06 | [diff] [blame] | 623 | |
dneto | b71e30c | 2014-08-25 23:27:20 | [diff] [blame] | 624 | // This CapturePostTasks should be destroyed before |
| 625 | // DidCommitAndDrawFrame() is called since that goes out to the |
| 626 | // embedder, |
| 627 | // and we want the embedder to receive its callbacks before that. |
| 628 | // NOTE: This maintains consistent ordering with the ThreadProxy since |
| 629 | // the DidCommitAndDrawFrame() must be post-tasked from the impl thread |
| 630 | // there as the main thread is not blocked, so any posted tasks inside |
| 631 | // the swap buffers will execute first. |
| 632 | DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 633 | |
skyostil | 3976a3f | 2014-09-04 22:07:23 | [diff] [blame] | 634 | BlockingTaskRunner::CapturePostTasks blocked( |
| 635 | blocking_main_thread_task_runner()); |
dneto | b71e30c | 2014-08-25 23:27:20 | [diff] [blame] | 636 | layer_tree_host_impl_->SwapBuffers(*frame); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 637 | } |
| 638 | DidCommitAndDrawFrame(); |
| 639 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 640 | return draw_result; |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 641 | } |
| 642 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 643 | void SingleThreadProxy::DidCommitAndDrawFrame() { |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 644 | if (next_frame_is_newly_committed_frame_) { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 645 | DebugScopedSetMainThread main(this); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 646 | next_frame_is_newly_committed_frame_ = false; |
[email protected] | 804c898 | 2013-03-13 16:32:21 | [diff] [blame] | 647 | layer_tree_host_->DidCommitAndDrawFrame(); |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 648 | } |
| 649 | } |
| 650 | |
[email protected] | 4ea293f7 | 2014-08-13 03:03:17 | [diff] [blame] | 651 | bool SingleThreadProxy::MainFrameWillHappenForTesting() { |
| 652 | return false; |
| 653 | } |
[email protected] | a8a049c | 2013-03-11 23:27:06 | [diff] [blame] | 654 | |
simonhong | d3d5f7f | 2014-11-21 16:38:03 | [diff] [blame] | 655 | void SingleThreadProxy::SetChildrenNeedBeginFrames( |
| 656 | bool children_need_begin_frames) { |
| 657 | scheduler_on_impl_thread_->SetChildrenNeedBeginFrames( |
| 658 | children_need_begin_frames); |
| 659 | } |
| 660 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 661 | void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) { |
| 662 | layer_tree_host_impl_->WillBeginImplFrame(args); |
| 663 | } |
| 664 | |
| 665 | void SingleThreadProxy::ScheduledActionSendBeginMainFrame() { |
| 666 | TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame"); |
| 667 | // Although this proxy is single-threaded, it's problematic to synchronously |
| 668 | // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This |
| 669 | // could cause a commit to occur in between a series of SetNeedsCommit calls |
| 670 | // (i.e. property modifications) causing some to fall on one frame and some to |
| 671 | // fall on the next. Doing it asynchronously instead matches the semantics of |
| 672 | // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a |
| 673 | // synchronous commit. |
| 674 | MainThreadTaskRunner()->PostTask( |
| 675 | FROM_HERE, |
| 676 | base::Bind(&SingleThreadProxy::BeginMainFrame, |
| 677 | weak_factory_.GetWeakPtr())); |
| 678 | } |
| 679 | |
| 680 | void SingleThreadProxy::BeginMainFrame() { |
| 681 | if (defer_commits_) { |
simonhong | c6309f79 | 2015-01-31 15:47:15 | [diff] [blame] | 682 | TRACE_EVENT_INSTANT0("cc", "EarlyOut_DeferCommit", |
| 683 | TRACE_EVENT_SCOPE_THREAD); |
| 684 | BeginMainFrameAbortedOnImplThread( |
| 685 | CommitEarlyOutReason::ABORTED_DEFERRED_COMMIT); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 686 | return; |
| 687 | } |
| 688 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 689 | // This checker assumes NotifyReadyToCommit in this stack causes a synchronous |
| 690 | // commit. |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 691 | ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_); |
| 692 | |
| 693 | if (!layer_tree_host_->visible()) { |
| 694 | TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD); |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 695 | BeginMainFrameAbortedOnImplThread( |
| 696 | CommitEarlyOutReason::ABORTED_NOT_VISIBLE); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 697 | return; |
| 698 | } |
| 699 | |
| 700 | if (layer_tree_host_->output_surface_lost()) { |
| 701 | TRACE_EVENT_INSTANT0( |
| 702 | "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD); |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 703 | BeginMainFrameAbortedOnImplThread( |
| 704 | CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 705 | return; |
| 706 | } |
| 707 | |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 708 | const BeginFrameArgs& begin_frame_args = |
| 709 | layer_tree_host_impl_->CurrentBeginFrameArgs(); |
| 710 | DoBeginMainFrame(begin_frame_args); |
| 711 | } |
| 712 | |
| 713 | void SingleThreadProxy::DoBeginMainFrame( |
| 714 | const BeginFrameArgs& begin_frame_args) { |
| 715 | layer_tree_host_->WillBeginMainFrame(); |
| 716 | layer_tree_host_->BeginMainFrame(begin_frame_args); |
| 717 | layer_tree_host_->AnimateLayers(begin_frame_args.frame_time); |
| 718 | layer_tree_host_->Layout(); |
| 719 | |
| 720 | if (PrioritizedResourceManager* contents_texture_manager = |
| 721 | layer_tree_host_->contents_texture_manager()) { |
| 722 | contents_texture_manager->UnlinkAndClearEvictedBackings(); |
| 723 | contents_texture_manager->SetMaxMemoryLimitBytes( |
| 724 | layer_tree_host_impl_->memory_allocation_limit_bytes()); |
| 725 | contents_texture_manager->SetExternalPriorityCutoff( |
| 726 | layer_tree_host_impl_->memory_allocation_priority_cutoff()); |
| 727 | } |
| 728 | |
| 729 | DCHECK(!queue_for_commit_); |
| 730 | queue_for_commit_ = make_scoped_ptr(new ResourceUpdateQueue); |
| 731 | |
| 732 | layer_tree_host_->UpdateLayers(queue_for_commit_.get()); |
| 733 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 734 | timing_history_.DidBeginMainFrame(); |
| 735 | |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 736 | // TODO(enne): SingleThreadProxy does not support cancelling commits yet, |
| 737 | // search for CommitEarlyOutReason::FINISHED_NO_UPDATES inside |
| 738 | // thread_proxy.cc |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 739 | if (scheduler_on_impl_thread_) { |
| 740 | scheduler_on_impl_thread_->NotifyBeginMainFrameStarted(); |
| 741 | scheduler_on_impl_thread_->NotifyReadyToCommit(); |
| 742 | } |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 743 | } |
| 744 | |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 745 | void SingleThreadProxy::BeginMainFrameAbortedOnImplThread( |
| 746 | CommitEarlyOutReason reason) { |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 747 | DebugScopedSetImplThread impl(this); |
| 748 | DCHECK(scheduler_on_impl_thread_->CommitPending()); |
| 749 | DCHECK(!layer_tree_host_impl_->pending_tree()); |
| 750 | |
mithro | f7a2150 | 2014-12-17 03:24:48 | [diff] [blame] | 751 | layer_tree_host_impl_->BeginMainFrameAborted(reason); |
| 752 | scheduler_on_impl_thread_->BeginMainFrameAborted(reason); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 753 | } |
| 754 | |
| 755 | DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() { |
| 756 | DebugScopedSetImplThread impl(this); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 757 | LayerTreeHostImpl::FrameData frame; |
| 758 | return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time, |
| 759 | &frame); |
| 760 | } |
| 761 | |
| 762 | DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() { |
| 763 | NOTREACHED(); |
| 764 | return INVALID_RESULT; |
| 765 | } |
| 766 | |
| 767 | void SingleThreadProxy::ScheduledActionCommit() { |
| 768 | DebugScopedSetMainThread main(this); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 769 | DoCommit(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 770 | } |
| 771 | |
| 772 | void SingleThreadProxy::ScheduledActionAnimate() { |
| 773 | TRACE_EVENT0("cc", "ScheduledActionAnimate"); |
mithro | 719bf679 | 2014-11-10 15:36:47 | [diff] [blame] | 774 | DebugScopedSetImplThread impl(this); |
| 775 | DoAnimate(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 776 | } |
| 777 | |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 778 | void SingleThreadProxy::ScheduledActionActivateSyncTree() { |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 779 | DebugScopedSetImplThread impl(this); |
| 780 | layer_tree_host_impl_->ActivateSyncTree(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 781 | } |
| 782 | |
| 783 | void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
| 784 | DebugScopedSetMainThread main(this); |
| 785 | DCHECK(scheduler_on_impl_thread_); |
| 786 | // If possible, create the output surface in a post task. Synchronously |
| 787 | // creating the output surface makes tests more awkward since this differs |
| 788 | // from the ThreadProxy behavior. However, sometimes there is no |
| 789 | // task runner. |
| 790 | if (Proxy::MainThreadTaskRunner()) { |
jbauman | 8ab0f9e | 2014-10-15 02:30:34 | [diff] [blame] | 791 | ScheduleRequestNewOutputSurface(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 792 | } else { |
enne | 2097cab | 2014-09-25 20:16:31 | [diff] [blame] | 793 | RequestNewOutputSurface(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 794 | } |
| 795 | } |
| 796 | |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 797 | void SingleThreadProxy::ScheduledActionPrepareTiles() { |
| 798 | TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionPrepareTiles"); |
enne | 98f3a6c | 2014-10-09 20:09:44 | [diff] [blame] | 799 | DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
| 800 | DebugScopedSetImplThread impl(this); |
vmiura | 59ea9b404 | 2014-12-09 20:50:39 | [diff] [blame] | 801 | layer_tree_host_impl_->PrepareTiles(); |
[email protected] | aeeedad | 2014-08-22 18:16:22 | [diff] [blame] | 802 | } |
| 803 | |
| 804 | void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
| 805 | } |
| 806 | |
| 807 | base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { |
| 808 | return timing_history_.DrawDurationEstimate(); |
| 809 | } |
| 810 | |
| 811 | base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
| 812 | return timing_history_.BeginMainFrameToCommitDurationEstimate(); |
| 813 | } |
| 814 | |
| 815 | base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
| 816 | return timing_history_.CommitToActivateDurationEstimate(); |
| 817 | } |
| 818 | |
| 819 | void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 820 | layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 821 | } |
| 822 | |
simonhong | d3d5f7f | 2014-11-21 16:38:03 | [diff] [blame] | 823 | void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 824 | layer_tree_host_->SendBeginFramesToChildren(args); |
| 825 | } |
| 826 | |
[email protected] | bc5e77c | 2012-11-05 20:00:49 | [diff] [blame] | 827 | } // namespace cc |