blob: 562d7c98f31e87235e1b408d315843976e8abd7e [file] [log] [blame]
[email protected]94f206c12012-08-25 00:09:141// 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]556fd292013-03-18 08:03:045#include "cc/trees/single_thread_proxy.h"
[email protected]94f206c12012-08-25 00:09:146
[email protected]74d9063c2013-01-18 03:14:477#include "base/auto_reset.h"
[email protected]6331a1172012-10-18 11:35:138#include "base/debug/trace_event.h"
[email protected]adbe30f2013-10-11 21:12:339#include "cc/debug/benchmark_instrumentation.h"
[email protected]7f0d825f2013-03-18 07:24:3010#include "cc/output/context_provider.h"
11#include "cc/output/output_surface.h"
[email protected]89e82672013-03-18 07:50:5612#include "cc/quads/draw_quad.h"
[email protected]e12dd0e2013-03-18 08:24:4013#include "cc/resources/prioritized_resource_manager.h"
14#include "cc/resources/resource_update_controller.h"
[email protected]556fd292013-03-18 08:03:0415#include "cc/trees/layer_tree_host.h"
[email protected]943528e2013-11-07 05:01:3216#include "cc/trees/layer_tree_host_single_thread_client.h"
[email protected]556fd292013-03-18 08:03:0417#include "cc/trees/layer_tree_impl.h"
[email protected]aeeedad2014-08-22 18:16:2218#include "cc/trees/scoped_abort_remaining_swap_promises.h"
[email protected]de2cf8c2013-10-25 19:46:4619#include "ui/gfx/frame_time.h"
[email protected]94f206c12012-08-25 00:09:1420
[email protected]9c88e562012-09-14 22:21:3021namespace cc {
[email protected]94f206c12012-08-25 00:09:1422
[email protected]943528e2013-11-07 05:01:3223scoped_ptr<Proxy> SingleThreadProxy::Create(
24 LayerTreeHost* layer_tree_host,
[email protected]27e6a212014-07-18 15:51:2725 LayerTreeHostSingleThreadClient* client,
26 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner) {
[email protected]a8a049c2013-03-11 23:27:0627 return make_scoped_ptr(
danakjf446a072014-09-27 21:55:4828 new SingleThreadProxy(layer_tree_host, client, main_task_runner));
[email protected]94f206c12012-08-25 00:09:1429}
30
[email protected]27e6a212014-07-18 15:51:2731SingleThreadProxy::SingleThreadProxy(
32 LayerTreeHost* layer_tree_host,
33 LayerTreeHostSingleThreadClient* client,
34 scoped_refptr<base::SingleThreadTaskRunner> main_task_runner)
35 : Proxy(main_task_runner, NULL),
[email protected]a8a049c2013-03-11 23:27:0636 layer_tree_host_(layer_tree_host),
[email protected]943528e2013-11-07 05:01:3237 client_(client),
[email protected]aeeedad2014-08-22 18:16:2238 timing_history_(layer_tree_host->rendering_stats_instrumentation()),
[email protected]a8a049c2013-03-11 23:27:0639 next_frame_is_newly_committed_frame_(false),
[email protected]aeeedad2014-08-22 18:16:2240 inside_draw_(false),
41 defer_commits_(false),
42 commit_was_deferred_(false),
43 commit_requested_(false),
jbauman399aec1a2014-10-25 02:33:3244 inside_synchronous_composite_(false),
jbauman8ab0f9e2014-10-15 02:30:3445 output_surface_creation_requested_(false),
[email protected]aeeedad2014-08-22 18:16:2246 weak_factory_(this) {
[email protected]a8a049c2013-03-11 23:27:0647 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy");
48 DCHECK(Proxy::IsMainThread());
49 DCHECK(layer_tree_host);
[email protected]94f206c12012-08-25 00:09:1450}
51
[email protected]e96e3432013-12-19 18:56:0752void SingleThreadProxy::Start() {
[email protected]a8a049c2013-03-11 23:27:0653 DebugScopedSetImplThread impl(this);
[email protected]804c8982013-03-13 16:32:2154 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this);
[email protected]a8a049c2013-03-11 23:27:0655}
56
57SingleThreadProxy::~SingleThreadProxy() {
58 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy");
59 DCHECK(Proxy::IsMainThread());
[email protected]04049fc2013-05-01 03:13:2060 // Make sure Stop() got called or never Started.
61 DCHECK(!layer_tree_host_impl_);
[email protected]a8a049c2013-03-11 23:27:0662}
63
[email protected]a8a049c2013-03-11 23:27:0664void SingleThreadProxy::FinishAllRendering() {
[email protected]ccc08dc2014-01-30 07:33:2065 TRACE_EVENT0("cc", "SingleThreadProxy::FinishAllRendering");
[email protected]a8a049c2013-03-11 23:27:0666 DCHECK(Proxy::IsMainThread());
67 {
[email protected]61de5812012-11-08 07:03:4468 DebugScopedSetImplThread impl(this);
[email protected]c1bb5af2013-03-13 19:06:2769 layer_tree_host_impl_->FinishAllRendering();
[email protected]a8a049c2013-03-11 23:27:0670 }
[email protected]94f206c12012-08-25 00:09:1471}
72
[email protected]a8a049c2013-03-11 23:27:0673bool SingleThreadProxy::IsStarted() const {
74 DCHECK(Proxy::IsMainThread());
[email protected]3209161d2013-03-29 19:17:3475 return layer_tree_host_impl_;
[email protected]94f206c12012-08-25 00:09:1476}
77
[email protected]14bd5542013-05-08 21:51:3078void SingleThreadProxy::SetLayerTreeHostClientReady() {
[email protected]ccc08dc2014-01-30 07:33:2079 TRACE_EVENT0("cc", "SingleThreadProxy::SetLayerTreeHostClientReady");
[email protected]a8a049c2013-03-11 23:27:0680 // Scheduling is controlled by the embedder in the single thread case, so
81 // nothing to do.
[email protected]aeeedad2014-08-22 18:16:2282 DCHECK(Proxy::IsMainThread());
83 DebugScopedSetImplThread impl(this);
84 if (layer_tree_host_->settings().single_thread_proxy_scheduler &&
85 !scheduler_on_impl_thread_) {
86 SchedulerSettings scheduler_settings(layer_tree_host_->settings());
87 scheduler_on_impl_thread_ = Scheduler::Create(this,
88 scheduler_settings,
89 layer_tree_host_->id(),
sunnyps340939792014-10-16 21:59:5890 MainThreadTaskRunner(),
91 base::PowerMonitor::Get());
[email protected]aeeedad2014-08-22 18:16:2292 scheduler_on_impl_thread_->SetCanStart();
93 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
94 }
[email protected]a8a049c2013-03-11 23:27:0695}
96
97void SingleThreadProxy::SetVisible(bool visible) {
[email protected]ccc08dc2014-01-30 07:33:2098 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible");
[email protected]f7c01c82013-07-02 22:58:4699 DebugScopedSetImplThread impl(this);
[email protected]c1bb5af2013-03-13 19:06:27100 layer_tree_host_impl_->SetVisible(visible);
[email protected]aeeedad2014-08-22 18:16:22101 if (scheduler_on_impl_thread_)
102 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible());
[email protected]8ea875b2013-08-07 00:32:12103 // Changing visibility could change ShouldComposite().
[email protected]a8a049c2013-03-11 23:27:06104}
105
enne2097cab2014-09-25 20:16:31106void SingleThreadProxy::RequestNewOutputSurface() {
[email protected]a8a049c2013-03-11 23:27:06107 DCHECK(Proxy::IsMainThread());
[email protected]497edf82014-05-20 21:53:15108 DCHECK(layer_tree_host_->output_surface_lost());
jbauman8ab0f9e2014-10-15 02:30:34109 output_surface_creation_callback_.Cancel();
110 if (output_surface_creation_requested_)
111 return;
112 output_surface_creation_requested_ = true;
enne2097cab2014-09-25 20:16:31113 layer_tree_host_->RequestNewOutputSurface();
114}
[email protected]94f206c12012-08-25 00:09:14115
enne2097cab2014-09-25 20:16:31116void SingleThreadProxy::SetOutputSurface(
117 scoped_ptr<OutputSurface> output_surface) {
118 DCHECK(Proxy::IsMainThread());
119 DCHECK(layer_tree_host_->output_surface_lost());
jbauman8ab0f9e2014-10-15 02:30:34120 output_surface_creation_requested_ = false;
[email protected]da8e3b72b2014-04-25 02:33:45121 renderer_capabilities_for_main_thread_ = RendererCapabilities();
122
123 bool success = !!output_surface;
124 if (success) {
[email protected]819b9f52013-09-22 23:29:51125 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
[email protected]a8a049c2013-03-11 23:27:06126 DebugScopedSetImplThread impl(this);
[email protected]804c8982013-03-13 16:32:21127 layer_tree_host_->DeleteContentsTexturesOnImplThread(
[email protected]c1bb5af2013-03-13 19:06:27128 layer_tree_host_impl_->resource_provider());
[email protected]da8e3b72b2014-04-25 02:33:45129 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass());
[email protected]04049fc2013-05-01 03:13:20130 }
131
[email protected]da8e3b72b2014-04-25 02:33:45132 layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(success);
[email protected]04049fc2013-05-01 03:13:20133
[email protected]aeeedad2014-08-22 18:16:22134 if (success) {
135 if (scheduler_on_impl_thread_)
136 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface();
jbauman399aec1a2014-10-25 02:33:32137 else if (!inside_synchronous_composite_)
138 SetNeedsCommit();
[email protected]aeeedad2014-08-22 18:16:22139 } else if (Proxy::MainThreadTaskRunner()) {
jbauman8ab0f9e2014-10-15 02:30:34140 ScheduleRequestNewOutputSurface();
[email protected]04049fc2013-05-01 03:13:20141 }
[email protected]94f206c12012-08-25 00:09:14142}
143
[email protected]a8a049c2013-03-11 23:27:06144const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const {
[email protected]04049fc2013-05-01 03:13:20145 DCHECK(Proxy::IsMainThread());
146 DCHECK(!layer_tree_host_->output_surface_lost());
[email protected]a8a049c2013-03-11 23:27:06147 return renderer_capabilities_for_main_thread_;
[email protected]94f206c12012-08-25 00:09:14148}
149
[email protected]8b9e52b2014-01-17 16:35:31150void SingleThreadProxy::SetNeedsAnimate() {
[email protected]ccc08dc2014-01-30 07:33:20151 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate");
[email protected]c5134172013-12-11 06:19:48152 DCHECK(Proxy::IsMainThread());
[email protected]06cbc31b2014-01-17 06:43:20153 client_->ScheduleAnimation();
[email protected]aeeedad2014-08-22 18:16:22154 SetNeedsCommit();
[email protected]c5134172013-12-11 06:19:48155}
156
[email protected]8b9e52b2014-01-17 16:35:31157void SingleThreadProxy::SetNeedsUpdateLayers() {
[email protected]ccc08dc2014-01-30 07:33:20158 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers");
[email protected]8b9e52b2014-01-17 16:35:31159 DCHECK(Proxy::IsMainThread());
[email protected]aeeedad2014-08-22 18:16:22160 SetNeedsCommit();
[email protected]8b9e52b2014-01-17 16:35:31161}
162
mithro719bf6792014-11-10 15:36:47163void SingleThreadProxy::DoAnimate() {
164 // Don't animate if there is no root layer.
165 // TODO(mithro): Both Animate and UpdateAnimationState already have a
166 // "!active_tree_->root_layer()" check?
167 if (!layer_tree_host_impl_->active_tree()->root_layer()) {
168 return;
169 }
170
171 layer_tree_host_impl_->Animate(
172 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time);
173
174 // If animations are not visible, update the animation state now as it
175 // won't happen in DoComposite.
176 if (!layer_tree_host_impl_->AnimationsAreVisible()) {
177 layer_tree_host_impl_->UpdateAnimationState(true);
178 }
179}
180
enne98f3a6c2014-10-09 20:09:44181void SingleThreadProxy::DoCommit() {
[email protected]ccc08dc2014-01-30 07:33:20182 TRACE_EVENT0("cc", "SingleThreadProxy::DoCommit");
[email protected]a8a049c2013-03-11 23:27:06183 DCHECK(Proxy::IsMainThread());
enne98f3a6c2014-10-09 20:09:44184
[email protected]aeeedad2014-08-22 18:16:22185 commit_requested_ = false;
[email protected]aeeedad2014-08-22 18:16:22186 layer_tree_host_->WillCommit();
187
[email protected]a8a049c2013-03-11 23:27:06188 // Commit immediately.
189 {
[email protected]819b9f52013-09-22 23:29:51190 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
[email protected]f7c01c82013-07-02 22:58:46191 DebugScopedSetImplThread impl(this);
192
[email protected]9794fb32013-08-29 09:49:59193 // This CapturePostTasks should be destroyed before CommitComplete() is
194 // called since that goes out to the embedder, and we want the embedder
195 // to receive its callbacks before that.
enne98f3a6c2014-10-09 20:09:44196 commit_blocking_task_runner_.reset(new BlockingTaskRunner::CapturePostTasks(
197 blocking_main_thread_task_runner()));
[email protected]9794fb32013-08-29 09:49:59198
[email protected]c1bb5af2013-03-13 19:06:27199 layer_tree_host_impl_->BeginCommit();
[email protected]94f206c12012-08-25 00:09:14200
[email protected]5d2fec02013-11-28 20:08:33201 if (PrioritizedResourceManager* contents_texture_manager =
202 layer_tree_host_->contents_texture_manager()) {
203 contents_texture_manager->PushTexturePrioritiesToBackings();
[email protected]6e8c54922013-06-02 19:17:35204 }
[email protected]804c8982013-03-13 16:32:21205 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get());
[email protected]94f206c12012-08-25 00:09:14206
[email protected]ed511b8d2013-03-25 03:29:29207 scoped_ptr<ResourceUpdateController> update_controller =
[email protected]a8a049c2013-03-11 23:27:06208 ResourceUpdateController::Create(
209 NULL,
[email protected]aeeedad2014-08-22 18:16:22210 MainThreadTaskRunner(),
enne98f3a6c2014-10-09 20:09:44211 queue_for_commit_.Pass(),
[email protected]c1bb5af2013-03-13 19:06:27212 layer_tree_host_impl_->resource_provider());
[email protected]ed511b8d2013-03-25 03:29:29213 update_controller->Finalize();
[email protected]94f206c12012-08-25 00:09:14214
[email protected]127bdc1a2013-09-11 01:44:48215 if (layer_tree_host_impl_->EvictedUIResourcesExist())
216 layer_tree_host_->RecreateUIResources();
217
[email protected]804c8982013-03-13 16:32:21218 layer_tree_host_->FinishCommitOnImplThread(layer_tree_host_impl_.get());
[email protected]94f206c12012-08-25 00:09:14219
[email protected]c1bb5af2013-03-13 19:06:27220 layer_tree_host_impl_->CommitComplete();
[email protected]94f206c12012-08-25 00:09:14221
[email protected]767f38d72014-03-18 21:26:41222#if DCHECK_IS_ON
[email protected]3519b872013-07-30 07:17:50223 // In the single-threaded case, the scale and scroll deltas should never be
[email protected]a8a049c2013-03-11 23:27:06224 // touched on the impl layer tree.
[email protected]ed511b8d2013-03-25 03:29:29225 scoped_ptr<ScrollAndScaleSet> scroll_info =
[email protected]c1bb5af2013-03-13 19:06:27226 layer_tree_host_impl_->ProcessScrollDeltas();
[email protected]ed511b8d2013-03-25 03:29:29227 DCHECK(!scroll_info->scrolls.size());
[email protected]3519b872013-07-30 07:17:50228 DCHECK_EQ(1.f, scroll_info->page_scale_delta);
[email protected]94f206c12012-08-25 00:09:14229#endif
[email protected]a8a049c2013-03-11 23:27:06230 }
enne98f3a6c2014-10-09 20:09:44231
232 if (layer_tree_host_->settings().impl_side_painting) {
233 // TODO(enne): just commit directly to the active tree.
234 //
235 // Synchronously activate during commit to satisfy any potential
236 // SetNextCommitWaitsForActivation calls. Unfortunately, the tree
237 // might not be ready to draw, so DidActivateSyncTree must set
238 // the flag to force the tree to not draw until textures are ready.
239 NotifyReadyToActivate();
240 } else {
241 CommitComplete();
242 }
243}
244
245void SingleThreadProxy::CommitComplete() {
246 DCHECK(!layer_tree_host_impl_->pending_tree())
247 << "Activation is expected to have synchronously occurred by now.";
248 DCHECK(commit_blocking_task_runner_);
249
250 DebugScopedSetMainThread main(this);
251 commit_blocking_task_runner_.reset();
[email protected]804c8982013-03-13 16:32:21252 layer_tree_host_->CommitComplete();
[email protected]aeeedad2014-08-22 18:16:22253 layer_tree_host_->DidBeginMainFrame();
254 timing_history_.DidCommit();
255
[email protected]a8a049c2013-03-11 23:27:06256 next_frame_is_newly_committed_frame_ = true;
[email protected]94f206c12012-08-25 00:09:14257}
258
[email protected]a8a049c2013-03-11 23:27:06259void SingleThreadProxy::SetNeedsCommit() {
260 DCHECK(Proxy::IsMainThread());
[email protected]aeeedad2014-08-22 18:16:22261 DebugScopedSetImplThread impl(this);
[email protected]943528e2013-11-07 05:01:32262 client_->ScheduleComposite();
[email protected]aeeedad2014-08-22 18:16:22263 if (scheduler_on_impl_thread_)
264 scheduler_on_impl_thread_->SetNeedsCommit();
265 commit_requested_ = true;
[email protected]94f206c12012-08-25 00:09:14266}
267
[email protected]0023fc72014-01-10 20:05:06268void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) {
[email protected]ccc08dc2014-01-30 07:33:20269 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw");
[email protected]aeeedad2014-08-22 18:16:22270 DCHECK(Proxy::IsMainThread());
271 DebugScopedSetImplThread impl(this);
[email protected]2decdd782014-08-13 22:36:06272 client_->ScheduleComposite();
[email protected]aeeedad2014-08-22 18:16:22273 SetNeedsRedrawRectOnImplThread(damage_rect);
[email protected]94f206c12012-08-25 00:09:14274}
275
[email protected]74b43cc2013-08-30 06:29:27276void SingleThreadProxy::SetNextCommitWaitsForActivation() {
enne98f3a6c2014-10-09 20:09:44277 // Activation always forced in commit, so nothing to do.
[email protected]aeeedad2014-08-22 18:16:22278 DCHECK(Proxy::IsMainThread());
[email protected]74b43cc2013-08-30 06:29:27279}
280
[email protected]a8a049c2013-03-11 23:27:06281void SingleThreadProxy::SetDeferCommits(bool defer_commits) {
[email protected]aeeedad2014-08-22 18:16:22282 DCHECK(Proxy::IsMainThread());
283 // Deferring commits only makes sense if there's a scheduler.
284 if (!scheduler_on_impl_thread_)
285 return;
286 if (defer_commits_ == defer_commits)
287 return;
288
289 if (defer_commits)
290 TRACE_EVENT_ASYNC_BEGIN0("cc", "SingleThreadProxy::SetDeferCommits", this);
291 else
292 TRACE_EVENT_ASYNC_END0("cc", "SingleThreadProxy::SetDeferCommits", this);
293
294 defer_commits_ = defer_commits;
295 if (!defer_commits_ && commit_was_deferred_) {
296 commit_was_deferred_ = false;
297 BeginMainFrame();
298 }
[email protected]6b16679e2012-10-27 00:44:28299}
300
[email protected]174c6d42014-08-12 01:43:06301bool SingleThreadProxy::CommitRequested() const {
[email protected]aeeedad2014-08-22 18:16:22302 DCHECK(Proxy::IsMainThread());
303 return commit_requested_;
[email protected]174c6d42014-08-12 01:43:06304}
[email protected]a8a049c2013-03-11 23:27:06305
[email protected]174c6d42014-08-12 01:43:06306bool SingleThreadProxy::BeginMainFrameRequested() const {
[email protected]aeeedad2014-08-22 18:16:22307 DCHECK(Proxy::IsMainThread());
308 // If there is no scheduler, then there can be no pending begin frame,
309 // as all frames are all manually initiated by the embedder of cc.
310 if (!scheduler_on_impl_thread_)
311 return false;
312 return commit_requested_;
[email protected]174c6d42014-08-12 01:43:06313}
[email protected]971728d2013-10-26 10:39:31314
[email protected]a8a049c2013-03-11 23:27:06315size_t SingleThreadProxy::MaxPartialTextureUpdates() const {
316 return std::numeric_limits<size_t>::max();
317}
318
319void SingleThreadProxy::Stop() {
320 TRACE_EVENT0("cc", "SingleThreadProxy::stop");
321 DCHECK(Proxy::IsMainThread());
322 {
[email protected]819b9f52013-09-22 23:29:51323 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
[email protected]a8a049c2013-03-11 23:27:06324 DebugScopedSetImplThread impl(this);
325
skyostil3976a3f2014-09-04 22:07:23326 BlockingTaskRunner::CapturePostTasks blocked(
327 blocking_main_thread_task_runner());
[email protected]804c8982013-03-13 16:32:21328 layer_tree_host_->DeleteContentsTexturesOnImplThread(
[email protected]c1bb5af2013-03-13 19:06:27329 layer_tree_host_impl_->resource_provider());
danakjf446a072014-09-27 21:55:48330 scheduler_on_impl_thread_ = nullptr;
331 layer_tree_host_impl_ = nullptr;
[email protected]a8a049c2013-03-11 23:27:06332 }
[email protected]7aba6662013-03-12 10:17:34333 layer_tree_host_ = NULL;
[email protected]a8a049c2013-03-11 23:27:06334}
335
[email protected]3d9f7432013-04-06 00:35:18336void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) {
[email protected]ccc08dc2014-01-30 07:33:20337 TRACE_EVENT1(
338 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw);
[email protected]3d9f7432013-04-06 00:35:18339 DCHECK(Proxy::IsImplThread());
[email protected]aeeedad2014-08-22 18:16:22340 if (scheduler_on_impl_thread_)
341 scheduler_on_impl_thread_->SetCanDraw(can_draw);
[email protected]3d9f7432013-04-06 00:35:18342}
343
[email protected]4f48f6e2013-08-27 06:33:38344void SingleThreadProxy::NotifyReadyToActivate() {
enne98f3a6c2014-10-09 20:09:44345 TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToActivate");
346 DebugScopedSetImplThread impl(this);
347 if (scheduler_on_impl_thread_)
348 scheduler_on_impl_thread_->NotifyReadyToActivate();
[email protected]4f48f6e2013-08-27 06:33:38349}
350
ernstmdfac03e2014-11-11 20:18:05351void SingleThreadProxy::NotifyReadyToDraw() {
352}
353
[email protected]c1bb5af2013-03-13 19:06:27354void SingleThreadProxy::SetNeedsRedrawOnImplThread() {
[email protected]943528e2013-11-07 05:01:32355 client_->ScheduleComposite();
[email protected]aeeedad2014-08-22 18:16:22356 if (scheduler_on_impl_thread_)
357 scheduler_on_impl_thread_->SetNeedsRedraw();
[email protected]a8a049c2013-03-11 23:27:06358}
359
[email protected]43b8f982014-04-30 21:24:33360void SingleThreadProxy::SetNeedsAnimateOnImplThread() {
mithro719bf6792014-11-10 15:36:47361 client_->ScheduleComposite();
362 if (scheduler_on_impl_thread_)
363 scheduler_on_impl_thread_->SetNeedsAnimate();
[email protected]43b8f982014-04-30 21:24:33364}
365
[email protected]c48536a52013-09-14 00:02:08366void SingleThreadProxy::SetNeedsManageTilesOnImplThread() {
enne98f3a6c2014-10-09 20:09:44367 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsManageTilesOnImplThread");
368 if (scheduler_on_impl_thread_)
369 scheduler_on_impl_thread_->SetNeedsManageTiles();
[email protected]c48536a52013-09-14 00:02:08370}
371
[email protected]0023fc72014-01-10 20:05:06372void SingleThreadProxy::SetNeedsRedrawRectOnImplThread(
373 const gfx::Rect& damage_rect) {
[email protected]1cd9f5552013-04-26 04:22:03374 layer_tree_host_impl_->SetViewportDamage(damage_rect);
[email protected]aeeedad2014-08-22 18:16:22375 SetNeedsRedrawOnImplThread();
[email protected]1cd9f5552013-04-26 04:22:03376}
377
[email protected]86126792013-03-16 20:07:54378void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() {
enne98f3a6c2014-10-09 20:09:44379 TRACE_EVENT0("cc", "SingleThreadProxy::DidInitializeVisibleTileOnImplThread");
380 if (scheduler_on_impl_thread_)
381 scheduler_on_impl_thread_->SetNeedsRedraw();
[email protected]a8a049c2013-03-11 23:27:06382}
383
[email protected]c1bb5af2013-03-13 19:06:27384void SingleThreadProxy::SetNeedsCommitOnImplThread() {
[email protected]943528e2013-11-07 05:01:32385 client_->ScheduleComposite();
[email protected]aeeedad2014-08-22 18:16:22386 if (scheduler_on_impl_thread_)
387 scheduler_on_impl_thread_->SetNeedsCommit();
[email protected]a8a049c2013-03-11 23:27:06388}
389
[email protected]c1bb5af2013-03-13 19:06:27390void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread(
[email protected]85b57502014-03-11 15:37:48391 scoped_ptr<AnimationEventsVector> events) {
[email protected]ccc08dc2014-01-30 07:33:20392 TRACE_EVENT0(
393 "cc", "SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread");
[email protected]a8a049c2013-03-11 23:27:06394 DCHECK(Proxy::IsImplThread());
395 DebugScopedSetMainThread main(this);
[email protected]85b57502014-03-11 15:37:48396 layer_tree_host_->SetAnimationEvents(events.Pass());
[email protected]a8a049c2013-03-11 23:27:06397}
398
[email protected]c1bb5af2013-03-13 19:06:27399bool SingleThreadProxy::ReduceContentsTextureMemoryOnImplThread(
[email protected]a8a049c2013-03-11 23:27:06400 size_t limit_bytes,
401 int priority_cutoff) {
402 DCHECK(IsImplThread());
[email protected]5d2fec02013-11-28 20:08:33403 PrioritizedResourceManager* contents_texture_manager =
404 layer_tree_host_->contents_texture_manager();
405
406 ResourceProvider* resource_provider =
407 layer_tree_host_impl_->resource_provider();
408
409 if (!contents_texture_manager || !resource_provider)
[email protected]e7595ead2013-10-10 10:10:07410 return false;
[email protected]a8a049c2013-03-11 23:27:06411
[email protected]5d2fec02013-11-28 20:08:33412 return contents_texture_manager->ReduceMemoryOnImplThread(
413 limit_bytes, priority_cutoff, resource_provider);
[email protected]94f206c12012-08-25 00:09:14414}
415
[email protected]c1bb5af2013-03-13 19:06:27416bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; }
[email protected]a8a049c2013-03-11 23:27:06417
enne98f3a6c2014-10-09 20:09:44418void SingleThreadProxy::DidActivateSyncTree() {
419 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting
420 // defers until here to simulate SetNextCommitWaitsForActivation.
421 if (layer_tree_host_impl_->settings().impl_side_painting) {
422 // This is required because NotifyReadyToActivate gets called when
423 // the pending tree is not actually ready in the SingleThreadProxy.
424 layer_tree_host_impl_->SetRequiresHighResToDraw();
425
426 // Since activation could cause tasks to run, post CommitComplete
427 // separately so that it runs after these tasks. This is the loose
428 // equivalent of blocking commit until activation and also running
429 // all tasks posted during commit/activation before CommitComplete.
430 MainThreadTaskRunner()->PostTask(
431 FROM_HERE,
432 base::Bind(&SingleThreadProxy::CommitComplete,
433 weak_factory_.GetWeakPtr()));
434 }
435
enne98f3a6c2014-10-09 20:09:44436 timing_history_.DidActivateSyncTree();
437}
438
439void SingleThreadProxy::DidManageTiles() {
440 DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
441 DCHECK(Proxy::IsImplThread());
442 if (scheduler_on_impl_thread_)
443 scheduler_on_impl_thread_->DidManageTiles();
444}
445
[email protected]fa339032014-02-18 22:11:59446void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() {
447 DCHECK(IsImplThread());
448 renderer_capabilities_for_main_thread_ =
449 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities();
450}
451
[email protected]c1bb5af2013-03-13 19:06:27452void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() {
[email protected]ccc08dc2014-01-30 07:33:20453 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread");
[email protected]aeeedad2014-08-22 18:16:22454 {
455 DebugScopedSetMainThread main(this);
456 // This must happen before we notify the scheduler as it may try to recreate
457 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE.
458 layer_tree_host_->DidLoseOutputSurface();
459 }
[email protected]4d7e46a2013-11-08 05:33:40460 client_->DidAbortSwapBuffers();
[email protected]aeeedad2014-08-22 18:16:22461 if (scheduler_on_impl_thread_)
462 scheduler_on_impl_thread_->DidLoseOutputSurface();
[email protected]4d7e46a2013-11-08 05:33:40463}
464
465void SingleThreadProxy::DidSwapBuffersOnImplThread() {
[email protected]aeeedad2014-08-22 18:16:22466 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread");
467 if (scheduler_on_impl_thread_)
468 scheduler_on_impl_thread_->DidSwapBuffers();
[email protected]4d7e46a2013-11-08 05:33:40469 client_->DidPostSwapBuffers();
470}
471
[email protected]c14902662014-04-18 05:06:11472void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() {
473 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread");
[email protected]aeeedad2014-08-22 18:16:22474 if (scheduler_on_impl_thread_)
475 scheduler_on_impl_thread_->DidSwapBuffersComplete();
476 layer_tree_host_->DidCompleteSwapBuffers();
[email protected]493067512012-09-19 23:34:10477}
478
[email protected]f0c2a242013-03-15 19:34:52479void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) {
[email protected]ccc08dc2014-01-30 07:33:20480 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately");
[email protected]51f81da2014-05-16 21:29:26481 DCHECK(Proxy::IsMainThread());
jbauman399aec1a2014-10-25 02:33:32482 base::AutoReset<bool> inside_composite(&inside_synchronous_composite_, true);
483
484 if (layer_tree_host_->output_surface_lost()) {
485 RequestNewOutputSurface();
486 // RequestNewOutputSurface could have synchronously created an output
487 // surface, so check again before returning.
488 if (layer_tree_host_->output_surface_lost())
489 return;
490 }
[email protected]51f81da2014-05-16 21:29:26491
enne98f3a6c2014-10-09 20:09:44492 {
493 BeginFrameArgs begin_frame_args(
494 BeginFrameArgs::Create(frame_begin_time,
495 base::TimeTicks(),
496 BeginFrameArgs::DefaultInterval()));
497 DoBeginMainFrame(begin_frame_args);
498 DoCommit();
[email protected]e0341352013-04-06 05:01:20499
enne98f3a6c2014-10-09 20:09:44500 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises())
501 << "Commit should always succeed and transfer promises.";
502 }
503
504 {
505 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this));
enne69277cb2014-10-29 23:03:40506 if (layer_tree_host_impl_->settings().impl_side_painting) {
507 layer_tree_host_impl_->ActivateSyncTree();
508 layer_tree_host_impl_->active_tree()->UpdateDrawProperties();
509 layer_tree_host_impl_->ManageTiles();
510 layer_tree_host_impl_->SynchronouslyInitializeAllTiles();
511 }
512
mithro719bf6792014-11-10 15:36:47513 DoAnimate();
514
enne98f3a6c2014-10-09 20:09:44515 LayerTreeHostImpl::FrameData frame;
516 DoComposite(frame_begin_time, &frame);
517
518 // DoComposite could abort, but because this is a synchronous composite
519 // another draw will never be scheduled, so break remaining promises.
520 layer_tree_host_impl_->active_tree()->BreakSwapPromises(
521 SwapPromise::SWAP_FAILS);
522 }
[email protected]74d9063c2013-01-18 03:14:47523}
524
[email protected]d12aa932014-08-01 13:10:38525void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const {
526 // The following line casts away const modifiers because it is just
527 // setting debug state. We still want the AsValue() function and its
528 // call chain to be const throughout.
529 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this));
[email protected]a8a049c2013-03-11 23:27:06530
[email protected]d12aa932014-08-01 13:10:38531 state->BeginDictionary("layer_tree_host_impl");
532 layer_tree_host_impl_->AsValueInto(state);
533 state->EndDictionary();
[email protected]493067512012-09-19 23:34:10534}
535
[email protected]a8a049c2013-03-11 23:27:06536void SingleThreadProxy::ForceSerializeOnSwapBuffers() {
537 {
538 DebugScopedSetImplThread impl(this);
[email protected]04049fc2013-05-01 03:13:20539 if (layer_tree_host_impl_->renderer()) {
540 DCHECK(!layer_tree_host_->output_surface_lost());
[email protected]a8a049c2013-03-11 23:27:06541 layer_tree_host_impl_->renderer()->DoNoOp();
[email protected]04049fc2013-05-01 03:13:20542 }
[email protected]a8a049c2013-03-11 23:27:06543 }
[email protected]8947cbe2012-11-28 05:27:43544}
545
[email protected]5d8bec72014-07-03 03:03:11546bool SingleThreadProxy::SupportsImplScrolling() const {
547 return false;
548}
549
[email protected]3d9f7432013-04-06 00:35:18550bool SingleThreadProxy::ShouldComposite() const {
551 DCHECK(Proxy::IsImplThread());
552 return layer_tree_host_impl_->visible() &&
553 layer_tree_host_impl_->CanDraw();
554}
555
jbauman8ab0f9e2014-10-15 02:30:34556void SingleThreadProxy::ScheduleRequestNewOutputSurface() {
557 if (output_surface_creation_callback_.IsCancelled() &&
558 !output_surface_creation_requested_) {
559 output_surface_creation_callback_.Reset(
560 base::Bind(&SingleThreadProxy::RequestNewOutputSurface,
561 weak_factory_.GetWeakPtr()));
562 MainThreadTaskRunner()->PostTask(
563 FROM_HERE, output_surface_creation_callback_.callback());
564 }
565}
566
[email protected]aeeedad2014-08-22 18:16:22567DrawResult SingleThreadProxy::DoComposite(base::TimeTicks frame_begin_time,
568 LayerTreeHostImpl::FrameData* frame) {
[email protected]ccc08dc2014-01-30 07:33:20569 TRACE_EVENT0("cc", "SingleThreadProxy::DoComposite");
[email protected]04049fc2013-05-01 03:13:20570 DCHECK(!layer_tree_host_->output_surface_lost());
571
enne98f3a6c2014-10-09 20:09:44572 DrawResult draw_result;
573 bool draw_frame;
[email protected]a8a049c2013-03-11 23:27:06574 {
575 DebugScopedSetImplThread impl(this);
576 base::AutoReset<bool> mark_inside(&inside_draw_, true);
577
[email protected]3d9f7432013-04-06 00:35:18578 // We guard PrepareToDraw() with CanDraw() because it always returns a valid
579 // frame, so can only be used when such a frame is possible. Since
580 // DrawLayers() depends on the result of PrepareToDraw(), it is guarded on
581 // CanDraw() as well.
[email protected]2aae96792014-05-15 23:10:50582 if (!ShouldComposite()) {
[email protected]aeeedad2014-08-22 18:16:22583 return DRAW_ABORTED_CANT_DRAW;
[email protected]3d9f7432013-04-06 00:35:18584 }
[email protected]a8a049c2013-03-11 23:27:06585
[email protected]aeeedad2014-08-22 18:16:22586 timing_history_.DidStartDrawing();
587
enne98f3a6c2014-10-09 20:09:44588 draw_result = layer_tree_host_impl_->PrepareToDraw(frame);
589 draw_frame = draw_result == DRAW_SUCCESS;
590 if (draw_frame)
591 layer_tree_host_impl_->DrawLayers(frame, frame_begin_time);
dnetob71e30c2014-08-25 23:27:20592 layer_tree_host_impl_->DidDrawAllLayers(*frame);
[email protected]a8a049c2013-03-11 23:27:06593
enne98f3a6c2014-10-09 20:09:44594 bool start_ready_animations = draw_frame;
[email protected]3d9f7432013-04-06 00:35:18595 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations);
[email protected]04c5900d2014-08-18 13:38:36596 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
[email protected]aeeedad2014-08-22 18:16:22597
598 timing_history_.DidFinishDrawing();
[email protected]a8a049c2013-03-11 23:27:06599 }
600
enne98f3a6c2014-10-09 20:09:44601 if (draw_frame) {
[email protected]aeeedad2014-08-22 18:16:22602 DebugScopedSetImplThread impl(this);
[email protected]174c6d42014-08-12 01:43:06603
dnetob71e30c2014-08-25 23:27:20604 // This CapturePostTasks should be destroyed before
605 // DidCommitAndDrawFrame() is called since that goes out to the
606 // embedder,
607 // and we want the embedder to receive its callbacks before that.
608 // NOTE: This maintains consistent ordering with the ThreadProxy since
609 // the DidCommitAndDrawFrame() must be post-tasked from the impl thread
610 // there as the main thread is not blocked, so any posted tasks inside
611 // the swap buffers will execute first.
612 DebugScopedSetMainThreadBlocked main_thread_blocked(this);
[email protected]aeeedad2014-08-22 18:16:22613
skyostil3976a3f2014-09-04 22:07:23614 BlockingTaskRunner::CapturePostTasks blocked(
615 blocking_main_thread_task_runner());
dnetob71e30c2014-08-25 23:27:20616 layer_tree_host_impl_->SwapBuffers(*frame);
[email protected]aeeedad2014-08-22 18:16:22617 }
618 DidCommitAndDrawFrame();
619
enne98f3a6c2014-10-09 20:09:44620 return draw_result;
[email protected]a8a049c2013-03-11 23:27:06621}
622
[email protected]aeeedad2014-08-22 18:16:22623void SingleThreadProxy::DidCommitAndDrawFrame() {
[email protected]a8a049c2013-03-11 23:27:06624 if (next_frame_is_newly_committed_frame_) {
[email protected]aeeedad2014-08-22 18:16:22625 DebugScopedSetMainThread main(this);
[email protected]a8a049c2013-03-11 23:27:06626 next_frame_is_newly_committed_frame_ = false;
[email protected]804c8982013-03-13 16:32:21627 layer_tree_host_->DidCommitAndDrawFrame();
[email protected]a8a049c2013-03-11 23:27:06628 }
629}
630
[email protected]4ea293f72014-08-13 03:03:17631bool SingleThreadProxy::MainFrameWillHappenForTesting() {
632 return false;
633}
[email protected]a8a049c2013-03-11 23:27:06634
mithroc34fc0b12014-09-30 09:10:41635BeginFrameSource* SingleThreadProxy::ExternalBeginFrameSource() {
636 return layer_tree_host_impl_.get();
[email protected]aeeedad2014-08-22 18:16:22637}
638
639void SingleThreadProxy::WillBeginImplFrame(const BeginFrameArgs& args) {
640 layer_tree_host_impl_->WillBeginImplFrame(args);
641}
642
643void SingleThreadProxy::ScheduledActionSendBeginMainFrame() {
644 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionSendBeginMainFrame");
645 // Although this proxy is single-threaded, it's problematic to synchronously
646 // have BeginMainFrame happen after ScheduledActionSendBeginMainFrame. This
647 // could cause a commit to occur in between a series of SetNeedsCommit calls
648 // (i.e. property modifications) causing some to fall on one frame and some to
649 // fall on the next. Doing it asynchronously instead matches the semantics of
650 // ThreadProxy::SetNeedsCommit where SetNeedsCommit will not cause a
651 // synchronous commit.
652 MainThreadTaskRunner()->PostTask(
653 FROM_HERE,
654 base::Bind(&SingleThreadProxy::BeginMainFrame,
655 weak_factory_.GetWeakPtr()));
656}
657
658void SingleThreadProxy::BeginMainFrame() {
659 if (defer_commits_) {
660 DCHECK(!commit_was_deferred_);
661 commit_was_deferred_ = true;
662 layer_tree_host_->DidDeferCommit();
663 return;
664 }
665
enne98f3a6c2014-10-09 20:09:44666 // This checker assumes NotifyReadyToCommit in this stack causes a synchronous
667 // commit.
[email protected]aeeedad2014-08-22 18:16:22668 ScopedAbortRemainingSwapPromises swap_promise_checker(layer_tree_host_);
669
670 if (!layer_tree_host_->visible()) {
671 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NotVisible", TRACE_EVENT_SCOPE_THREAD);
672 BeginMainFrameAbortedOnImplThread();
673 return;
674 }
675
676 if (layer_tree_host_->output_surface_lost()) {
677 TRACE_EVENT_INSTANT0(
678 "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD);
679 BeginMainFrameAbortedOnImplThread();
680 return;
681 }
682
enne98f3a6c2014-10-09 20:09:44683 const BeginFrameArgs& begin_frame_args =
684 layer_tree_host_impl_->CurrentBeginFrameArgs();
685 DoBeginMainFrame(begin_frame_args);
686}
687
688void SingleThreadProxy::DoBeginMainFrame(
689 const BeginFrameArgs& begin_frame_args) {
690 layer_tree_host_->WillBeginMainFrame();
691 layer_tree_host_->BeginMainFrame(begin_frame_args);
692 layer_tree_host_->AnimateLayers(begin_frame_args.frame_time);
693 layer_tree_host_->Layout();
694
695 if (PrioritizedResourceManager* contents_texture_manager =
696 layer_tree_host_->contents_texture_manager()) {
697 contents_texture_manager->UnlinkAndClearEvictedBackings();
698 contents_texture_manager->SetMaxMemoryLimitBytes(
699 layer_tree_host_impl_->memory_allocation_limit_bytes());
700 contents_texture_manager->SetExternalPriorityCutoff(
701 layer_tree_host_impl_->memory_allocation_priority_cutoff());
702 }
703
704 DCHECK(!queue_for_commit_);
705 queue_for_commit_ = make_scoped_ptr(new ResourceUpdateQueue);
706
707 layer_tree_host_->UpdateLayers(queue_for_commit_.get());
708
[email protected]aeeedad2014-08-22 18:16:22709 timing_history_.DidBeginMainFrame();
710
enne98f3a6c2014-10-09 20:09:44711 if (scheduler_on_impl_thread_) {
712 scheduler_on_impl_thread_->NotifyBeginMainFrameStarted();
713 scheduler_on_impl_thread_->NotifyReadyToCommit();
714 }
[email protected]aeeedad2014-08-22 18:16:22715}
716
717void SingleThreadProxy::BeginMainFrameAbortedOnImplThread() {
718 DebugScopedSetImplThread impl(this);
719 DCHECK(scheduler_on_impl_thread_->CommitPending());
720 DCHECK(!layer_tree_host_impl_->pending_tree());
721
722 // TODO(enne): SingleThreadProxy does not support cancelling commits yet so
723 // did_handle is always false.
724 bool did_handle = false;
725 layer_tree_host_impl_->BeginMainFrameAborted(did_handle);
726 scheduler_on_impl_thread_->BeginMainFrameAborted(did_handle);
727}
728
729DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapIfPossible() {
730 DebugScopedSetImplThread impl(this);
[email protected]aeeedad2014-08-22 18:16:22731 LayerTreeHostImpl::FrameData frame;
732 return DoComposite(layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time,
733 &frame);
734}
735
736DrawResult SingleThreadProxy::ScheduledActionDrawAndSwapForced() {
737 NOTREACHED();
738 return INVALID_RESULT;
739}
740
741void SingleThreadProxy::ScheduledActionCommit() {
742 DebugScopedSetMainThread main(this);
enne98f3a6c2014-10-09 20:09:44743 DoCommit();
[email protected]aeeedad2014-08-22 18:16:22744}
745
746void SingleThreadProxy::ScheduledActionAnimate() {
747 TRACE_EVENT0("cc", "ScheduledActionAnimate");
mithro719bf6792014-11-10 15:36:47748 DebugScopedSetImplThread impl(this);
749 DoAnimate();
[email protected]aeeedad2014-08-22 18:16:22750}
751
752void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() {
enne98f3a6c2014-10-09 20:09:44753 DebugScopedSetImplThread impl(this);
754 layer_tree_host_impl_->UpdateVisibleTiles();
[email protected]aeeedad2014-08-22 18:16:22755}
756
757void SingleThreadProxy::ScheduledActionActivateSyncTree() {
enne98f3a6c2014-10-09 20:09:44758 DebugScopedSetImplThread impl(this);
759 layer_tree_host_impl_->ActivateSyncTree();
[email protected]aeeedad2014-08-22 18:16:22760}
761
762void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() {
763 DebugScopedSetMainThread main(this);
764 DCHECK(scheduler_on_impl_thread_);
765 // If possible, create the output surface in a post task. Synchronously
766 // creating the output surface makes tests more awkward since this differs
767 // from the ThreadProxy behavior. However, sometimes there is no
768 // task runner.
769 if (Proxy::MainThreadTaskRunner()) {
jbauman8ab0f9e2014-10-15 02:30:34770 ScheduleRequestNewOutputSurface();
[email protected]aeeedad2014-08-22 18:16:22771 } else {
enne2097cab2014-09-25 20:16:31772 RequestNewOutputSurface();
[email protected]aeeedad2014-08-22 18:16:22773 }
774}
775
776void SingleThreadProxy::ScheduledActionManageTiles() {
enne98f3a6c2014-10-09 20:09:44777 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionManageTiles");
778 DCHECK(layer_tree_host_impl_->settings().impl_side_painting);
779 DebugScopedSetImplThread impl(this);
780 layer_tree_host_impl_->ManageTiles();
[email protected]aeeedad2014-08-22 18:16:22781}
782
783void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) {
784}
785
786base::TimeDelta SingleThreadProxy::DrawDurationEstimate() {
787 return timing_history_.DrawDurationEstimate();
788}
789
790base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() {
791 return timing_history_.BeginMainFrameToCommitDurationEstimate();
792}
793
794base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() {
795 return timing_history_.CommitToActivateDurationEstimate();
796}
797
798void SingleThreadProxy::DidBeginImplFrameDeadline() {
799 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame();
800}
801
[email protected]bc5e77c2012-11-05 20:00:49802} // namespace cc