OLD | NEW |
---|---|
1 // Copyright 2011 The Chromium Authors. All rights reserved. | 1 // Copyright 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "cc/trees/single_thread_proxy.h" | 5 #include "cc/trees/single_thread_proxy.h" |
6 | 6 |
7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
8 #include "base/debug/trace_event.h" | 8 #include "base/debug/trace_event.h" |
9 #include "cc/debug/benchmark_instrumentation.h" | 9 #include "cc/debug/benchmark_instrumentation.h" |
10 #include "cc/output/context_provider.h" | 10 #include "cc/output/context_provider.h" |
11 #include "cc/output/output_surface.h" | 11 #include "cc/output/output_surface.h" |
12 #include "cc/quads/draw_quad.h" | 12 #include "cc/quads/draw_quad.h" |
13 #include "cc/resources/prioritized_resource_manager.h" | 13 #include "cc/resources/prioritized_resource_manager.h" |
14 #include "cc/resources/resource_update_controller.h" | 14 #include "cc/resources/resource_update_controller.h" |
15 #include "cc/trees/blocking_task_runner.h" | |
16 #include "cc/trees/layer_tree_host.h" | 15 #include "cc/trees/layer_tree_host.h" |
17 #include "cc/trees/layer_tree_host_single_thread_client.h" | 16 #include "cc/trees/layer_tree_host_single_thread_client.h" |
18 #include "cc/trees/layer_tree_impl.h" | 17 #include "cc/trees/layer_tree_impl.h" |
19 #include "cc/trees/scoped_abort_remaining_swap_promises.h" | 18 #include "cc/trees/scoped_abort_remaining_swap_promises.h" |
20 #include "ui/gfx/frame_time.h" | 19 #include "ui/gfx/frame_time.h" |
21 | 20 |
22 namespace cc { | 21 namespace cc { |
23 | 22 |
24 scoped_ptr<Proxy> SingleThreadProxy::Create( | 23 scoped_ptr<Proxy> SingleThreadProxy::Create( |
25 LayerTreeHost* layer_tree_host, | 24 LayerTreeHost* layer_tree_host, |
(...skipping 14 matching lines...) Expand all Loading... | |
40 timing_history_(layer_tree_host->rendering_stats_instrumentation()), | 39 timing_history_(layer_tree_host->rendering_stats_instrumentation()), |
41 next_frame_is_newly_committed_frame_(false), | 40 next_frame_is_newly_committed_frame_(false), |
42 inside_draw_(false), | 41 inside_draw_(false), |
43 defer_commits_(false), | 42 defer_commits_(false), |
44 commit_was_deferred_(false), | 43 commit_was_deferred_(false), |
45 commit_requested_(false), | 44 commit_requested_(false), |
46 weak_factory_(this) { | 45 weak_factory_(this) { |
47 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); | 46 TRACE_EVENT0("cc", "SingleThreadProxy::SingleThreadProxy"); |
48 DCHECK(Proxy::IsMainThread()); | 47 DCHECK(Proxy::IsMainThread()); |
49 DCHECK(layer_tree_host); | 48 DCHECK(layer_tree_host); |
50 | |
51 // Impl-side painting not supported without threaded compositing. | |
52 CHECK(!layer_tree_host->settings().impl_side_painting) | |
53 << "Threaded compositing must be enabled to use impl-side painting."; | |
54 } | 49 } |
55 | 50 |
56 void SingleThreadProxy::Start() { | 51 void SingleThreadProxy::Start() { |
57 DebugScopedSetImplThread impl(this); | 52 DebugScopedSetImplThread impl(this); |
58 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); | 53 layer_tree_host_impl_ = layer_tree_host_->CreateLayerTreeHostImpl(this); |
59 } | 54 } |
60 | 55 |
61 SingleThreadProxy::~SingleThreadProxy() { | 56 SingleThreadProxy::~SingleThreadProxy() { |
62 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); | 57 TRACE_EVENT0("cc", "SingleThreadProxy::~SingleThreadProxy"); |
63 DCHECK(Proxy::IsMainThread()); | 58 DCHECK(Proxy::IsMainThread()); |
(...skipping 23 matching lines...) Expand all Loading... | |
87 DebugScopedSetImplThread impl(this); | 82 DebugScopedSetImplThread impl(this); |
88 if (layer_tree_host_->settings().single_thread_proxy_scheduler && | 83 if (layer_tree_host_->settings().single_thread_proxy_scheduler && |
89 !scheduler_on_impl_thread_) { | 84 !scheduler_on_impl_thread_) { |
90 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); | 85 SchedulerSettings scheduler_settings(layer_tree_host_->settings()); |
91 scheduler_on_impl_thread_ = Scheduler::Create(this, | 86 scheduler_on_impl_thread_ = Scheduler::Create(this, |
92 scheduler_settings, | 87 scheduler_settings, |
93 layer_tree_host_->id(), | 88 layer_tree_host_->id(), |
94 MainThreadTaskRunner()); | 89 MainThreadTaskRunner()); |
95 scheduler_on_impl_thread_->SetCanStart(); | 90 scheduler_on_impl_thread_->SetCanStart(); |
96 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 91 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
92 scheduler_on_impl_thread_->SetSmoothnessTakesPriority(false); | |
97 } | 93 } |
98 } | 94 } |
99 | 95 |
100 void SingleThreadProxy::SetVisible(bool visible) { | 96 void SingleThreadProxy::SetVisible(bool visible) { |
101 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible"); | 97 TRACE_EVENT0("cc", "SingleThreadProxy::SetVisible"); |
102 DebugScopedSetImplThread impl(this); | 98 DebugScopedSetImplThread impl(this); |
103 layer_tree_host_impl_->SetVisible(visible); | 99 layer_tree_host_impl_->SetVisible(visible); |
104 if (scheduler_on_impl_thread_) | 100 if (scheduler_on_impl_thread_) |
105 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); | 101 scheduler_on_impl_thread_->SetVisible(layer_tree_host_impl_->visible()); |
106 // Changing visibility could change ShouldComposite(). | 102 // Changing visibility could change ShouldComposite(). |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
185 layer_tree_host_->WillCommit(); | 181 layer_tree_host_->WillCommit(); |
186 | 182 |
187 // Commit immediately. | 183 // Commit immediately. |
188 { | 184 { |
189 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 185 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
190 DebugScopedSetImplThread impl(this); | 186 DebugScopedSetImplThread impl(this); |
191 | 187 |
192 // This CapturePostTasks should be destroyed before CommitComplete() is | 188 // This CapturePostTasks should be destroyed before CommitComplete() is |
193 // called since that goes out to the embedder, and we want the embedder | 189 // called since that goes out to the embedder, and we want the embedder |
194 // to receive its callbacks before that. | 190 // to receive its callbacks before that. |
195 BlockingTaskRunner::CapturePostTasks blocked; | 191 commit_blocking_task_runner_.reset( |
192 new BlockingTaskRunner::CapturePostTasks); | |
196 | 193 |
197 layer_tree_host_impl_->BeginCommit(); | 194 layer_tree_host_impl_->BeginCommit(); |
198 | 195 |
199 if (PrioritizedResourceManager* contents_texture_manager = | 196 if (PrioritizedResourceManager* contents_texture_manager = |
200 layer_tree_host_->contents_texture_manager()) { | 197 layer_tree_host_->contents_texture_manager()) { |
201 contents_texture_manager->PushTexturePrioritiesToBackings(); | 198 contents_texture_manager->PushTexturePrioritiesToBackings(); |
202 } | 199 } |
203 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); | 200 layer_tree_host_->BeginCommitOnImplThread(layer_tree_host_impl_.get()); |
204 | 201 |
205 scoped_ptr<ResourceUpdateController> update_controller = | 202 scoped_ptr<ResourceUpdateController> update_controller = |
(...skipping 21 matching lines...) Expand all Loading... | |
227 DCHECK(!scroll_info->scrolls.size()); | 224 DCHECK(!scroll_info->scrolls.size()); |
228 DCHECK_EQ(1.f, scroll_info->page_scale_delta); | 225 DCHECK_EQ(1.f, scroll_info->page_scale_delta); |
229 #endif | 226 #endif |
230 | 227 |
231 RenderingStatsInstrumentation* stats_instrumentation = | 228 RenderingStatsInstrumentation* stats_instrumentation = |
232 layer_tree_host_->rendering_stats_instrumentation(); | 229 layer_tree_host_->rendering_stats_instrumentation(); |
233 benchmark_instrumentation::IssueMainThreadRenderingStatsEvent( | 230 benchmark_instrumentation::IssueMainThreadRenderingStatsEvent( |
234 stats_instrumentation->main_thread_rendering_stats()); | 231 stats_instrumentation->main_thread_rendering_stats()); |
235 stats_instrumentation->AccumulateAndClearMainThreadStats(); | 232 stats_instrumentation->AccumulateAndClearMainThreadStats(); |
236 } | 233 } |
234 | |
235 if (layer_tree_host_->settings().impl_side_painting) { | |
236 // TODO(enne): just commit directly to the active tree. | |
237 // | |
238 // Synchronously activate during commit to satisfy any potential | |
239 // SetNextCommitWaitsForActivation calls. Unfortunately, the tree | |
240 // might not be ready to draw, so DidActivateSyncTree must set | |
241 // the flag to force the tree to not draw until textures are ready. | |
242 NotifyReadyToActivate(); | |
243 } else { | |
244 CommitComplete(); | |
245 } | |
246 } | |
247 | |
248 void SingleThreadProxy::CommitComplete() { | |
249 DCHECK(!layer_tree_host_impl_->pending_tree()) | |
250 << "Activation is expected to have synchronously occurred by now."; | |
251 DCHECK(commit_blocking_task_runner_.get()); | |
danakj
2014/09/03 21:14:24
nit: don't need .get() to check scoped_ptr for NUL
enne (OOO)
2014/09/03 21:36:25
Done.
| |
252 commit_blocking_task_runner_.reset(); | |
253 | |
254 DebugScopedSetMainThread main(this); | |
danakj
2014/09/03 21:14:24
Can you do this before the reset? To indicate main
enne (OOO)
2014/09/03 21:36:25
Done.
| |
237 layer_tree_host_->CommitComplete(); | 255 layer_tree_host_->CommitComplete(); |
238 layer_tree_host_->DidBeginMainFrame(); | 256 layer_tree_host_->DidBeginMainFrame(); |
239 timing_history_.DidCommit(); | 257 timing_history_.DidCommit(); |
240 | 258 |
241 next_frame_is_newly_committed_frame_ = true; | 259 next_frame_is_newly_committed_frame_ = true; |
242 } | 260 } |
243 | 261 |
244 void SingleThreadProxy::SetNeedsCommit() { | 262 void SingleThreadProxy::SetNeedsCommit() { |
245 DCHECK(Proxy::IsMainThread()); | 263 DCHECK(Proxy::IsMainThread()); |
246 DebugScopedSetImplThread impl(this); | 264 DebugScopedSetImplThread impl(this); |
247 client_->ScheduleComposite(); | 265 client_->ScheduleComposite(); |
248 if (scheduler_on_impl_thread_) | 266 if (scheduler_on_impl_thread_) |
249 scheduler_on_impl_thread_->SetNeedsCommit(); | 267 scheduler_on_impl_thread_->SetNeedsCommit(); |
250 commit_requested_ = true; | 268 commit_requested_ = true; |
251 } | 269 } |
252 | 270 |
253 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { | 271 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
254 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); | 272 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); |
255 DCHECK(Proxy::IsMainThread()); | 273 DCHECK(Proxy::IsMainThread()); |
256 DebugScopedSetImplThread impl(this); | 274 DebugScopedSetImplThread impl(this); |
257 client_->ScheduleComposite(); | 275 client_->ScheduleComposite(); |
258 SetNeedsRedrawRectOnImplThread(damage_rect); | 276 SetNeedsRedrawRectOnImplThread(damage_rect); |
259 } | 277 } |
260 | 278 |
261 void SingleThreadProxy::SetNextCommitWaitsForActivation() { | 279 void SingleThreadProxy::SetNextCommitWaitsForActivation() { |
262 // There is no activation here other than commit. So do nothing. | 280 // Activation always forced in commit, so nothing to do. |
263 DCHECK(Proxy::IsMainThread()); | 281 DCHECK(Proxy::IsMainThread()); |
264 } | 282 } |
265 | 283 |
266 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { | 284 void SingleThreadProxy::SetDeferCommits(bool defer_commits) { |
267 DCHECK(Proxy::IsMainThread()); | 285 DCHECK(Proxy::IsMainThread()); |
268 // Deferring commits only makes sense if there's a scheduler. | 286 // Deferring commits only makes sense if there's a scheduler. |
269 if (!scheduler_on_impl_thread_) | 287 if (!scheduler_on_impl_thread_) |
270 return; | 288 return; |
271 if (defer_commits_ == defer_commits) | 289 if (defer_commits_ == defer_commits) |
272 return; | 290 return; |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
320 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { | 338 void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { |
321 TRACE_EVENT1( | 339 TRACE_EVENT1( |
322 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); | 340 "cc", "SingleThreadProxy::OnCanDrawStateChanged", "can_draw", can_draw); |
323 DCHECK(Proxy::IsImplThread()); | 341 DCHECK(Proxy::IsImplThread()); |
324 UpdateBackgroundAnimateTicking(); | 342 UpdateBackgroundAnimateTicking(); |
325 if (scheduler_on_impl_thread_) | 343 if (scheduler_on_impl_thread_) |
326 scheduler_on_impl_thread_->SetCanDraw(can_draw); | 344 scheduler_on_impl_thread_->SetCanDraw(can_draw); |
327 } | 345 } |
328 | 346 |
329 void SingleThreadProxy::NotifyReadyToActivate() { | 347 void SingleThreadProxy::NotifyReadyToActivate() { |
330 // Impl-side painting only. | 348 TRACE_EVENT0("cc", "SingleThreadProxy::NotifyReadyToActivate"); |
331 NOTREACHED(); | 349 DebugScopedSetImplThread impl(this); |
350 if (scheduler_on_impl_thread_) | |
351 scheduler_on_impl_thread_->NotifyReadyToActivate(); | |
332 } | 352 } |
333 | 353 |
334 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { | 354 void SingleThreadProxy::SetNeedsRedrawOnImplThread() { |
335 client_->ScheduleComposite(); | 355 client_->ScheduleComposite(); |
336 if (scheduler_on_impl_thread_) | 356 if (scheduler_on_impl_thread_) |
337 scheduler_on_impl_thread_->SetNeedsRedraw(); | 357 scheduler_on_impl_thread_->SetNeedsRedraw(); |
338 } | 358 } |
339 | 359 |
340 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { | 360 void SingleThreadProxy::SetNeedsAnimateOnImplThread() { |
341 SetNeedsRedrawOnImplThread(); | 361 SetNeedsRedrawOnImplThread(); |
342 } | 362 } |
343 | 363 |
344 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { | 364 void SingleThreadProxy::SetNeedsManageTilesOnImplThread() { |
345 // Impl-side painting only. | 365 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsManageTilesOnImplThread"); |
346 NOTREACHED(); | 366 if (scheduler_on_impl_thread_) |
367 scheduler_on_impl_thread_->SetNeedsManageTiles(); | |
347 } | 368 } |
348 | 369 |
349 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( | 370 void SingleThreadProxy::SetNeedsRedrawRectOnImplThread( |
350 const gfx::Rect& damage_rect) { | 371 const gfx::Rect& damage_rect) { |
351 layer_tree_host_impl_->SetViewportDamage(damage_rect); | 372 layer_tree_host_impl_->SetViewportDamage(damage_rect); |
352 SetNeedsRedrawOnImplThread(); | 373 SetNeedsRedrawOnImplThread(); |
353 } | 374 } |
354 | 375 |
355 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { | 376 void SingleThreadProxy::DidInitializeVisibleTileOnImplThread() { |
356 // Impl-side painting only. | 377 TRACE_EVENT0("cc", "SingleThreadProxy::DidInitializeVisibleTileOnImplThread"); |
357 NOTREACHED(); | 378 if (scheduler_on_impl_thread_) |
379 scheduler_on_impl_thread_->SetNeedsRedraw(); | |
358 } | 380 } |
359 | 381 |
360 void SingleThreadProxy::SetNeedsCommitOnImplThread() { | 382 void SingleThreadProxy::SetNeedsCommitOnImplThread() { |
361 client_->ScheduleComposite(); | 383 client_->ScheduleComposite(); |
362 if (scheduler_on_impl_thread_) | 384 if (scheduler_on_impl_thread_) |
363 scheduler_on_impl_thread_->SetNeedsCommit(); | 385 scheduler_on_impl_thread_->SetNeedsCommit(); |
364 } | 386 } |
365 | 387 |
366 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( | 388 void SingleThreadProxy::PostAnimationEventsToMainThreadOnImplThread( |
367 scoped_ptr<AnimationEventsVector> events) { | 389 scoped_ptr<AnimationEventsVector> events) { |
(...skipping 16 matching lines...) Expand all Loading... | |
384 | 406 |
385 if (!contents_texture_manager || !resource_provider) | 407 if (!contents_texture_manager || !resource_provider) |
386 return false; | 408 return false; |
387 | 409 |
388 return contents_texture_manager->ReduceMemoryOnImplThread( | 410 return contents_texture_manager->ReduceMemoryOnImplThread( |
389 limit_bytes, priority_cutoff, resource_provider); | 411 limit_bytes, priority_cutoff, resource_provider); |
390 } | 412 } |
391 | 413 |
392 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 414 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
393 | 415 |
416 void SingleThreadProxy::DidActivateSyncTree() { | |
417 // Non-impl-side painting finishes commit in DoCommit. Impl-side painting | |
418 // defers until here to simulate SetNextCommitWaitsForActivation. | |
419 if (layer_tree_host_impl_->settings().impl_side_painting) { | |
420 // This is required because NotifyReadyToActivate gets called when | |
421 // the pending tree is not actually ready in the SingleThreadProxy. | |
422 layer_tree_host_impl_->active_tree()->SetRequiresHighResToDraw(); | |
423 | |
424 // Since activation could cause tasks to run, post CommitComplete | |
425 // separately so that it runs after these tasks. This is the loose | |
426 // equivalent of blocking commit until activation and also running | |
427 // all tasks posted during commit/activation before CommitComplete. | |
428 MainThreadTaskRunner()->PostTask( | |
429 FROM_HERE, | |
430 base::Bind(&SingleThreadProxy::CommitComplete, | |
431 weak_factory_.GetWeakPtr())); | |
432 } | |
433 | |
434 UpdateBackgroundAnimateTicking(); | |
435 timing_history_.DidActivateSyncTree(); | |
436 } | |
437 | |
438 void SingleThreadProxy::DidManageTiles() { | |
439 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | |
440 DCHECK(Proxy::IsImplThread()); | |
441 if (scheduler_on_impl_thread_) | |
442 scheduler_on_impl_thread_->DidManageTiles(); | |
443 } | |
444 | |
394 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { | 445 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
395 DCHECK(IsImplThread()); | 446 DCHECK(IsImplThread()); |
396 renderer_capabilities_for_main_thread_ = | 447 renderer_capabilities_for_main_thread_ = |
397 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); | 448 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); |
398 } | 449 } |
399 | 450 |
400 void SingleThreadProxy::DidManageTiles() { | |
401 // Impl-side painting only. | |
402 NOTREACHED(); | |
403 } | |
404 | |
405 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 451 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
406 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); | 452 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
407 { | 453 { |
408 DebugScopedSetMainThread main(this); | 454 DebugScopedSetMainThread main(this); |
409 // This must happen before we notify the scheduler as it may try to recreate | 455 // This must happen before we notify the scheduler as it may try to recreate |
410 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. | 456 // the output surface if already in BEGIN_IMPL_FRAME_STATE_IDLE. |
411 layer_tree_host_->DidLoseOutputSurface(); | 457 layer_tree_host_->DidLoseOutputSurface(); |
412 } | 458 } |
413 client_->DidAbortSwapBuffers(); | 459 client_->DidAbortSwapBuffers(); |
414 if (scheduler_on_impl_thread_) | 460 if (scheduler_on_impl_thread_) |
(...skipping 22 matching lines...) Expand all Loading... | |
437 | 483 |
438 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 484 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
439 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); | 485 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); |
440 DCHECK(Proxy::IsMainThread()); | 486 DCHECK(Proxy::IsMainThread()); |
441 DCHECK(!layer_tree_host_->output_surface_lost()); | 487 DCHECK(!layer_tree_host_->output_surface_lost()); |
442 | 488 |
443 BeginFrameArgs begin_frame_args = BeginFrameArgs::Create( | 489 BeginFrameArgs begin_frame_args = BeginFrameArgs::Create( |
444 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval()); | 490 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval()); |
445 DoCommit(begin_frame_args); | 491 DoCommit(begin_frame_args); |
446 | 492 |
493 DCHECK(!layer_tree_host_impl_->settings().impl_side_painting) | |
494 << "Impl-side painting and synchronous compositing are not supported."; | |
495 | |
447 LayerTreeHostImpl::FrameData frame; | 496 LayerTreeHostImpl::FrameData frame; |
448 DoComposite(frame_begin_time, &frame); | 497 DoComposite(frame_begin_time, &frame); |
449 } | 498 } |
450 | 499 |
451 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { | 500 void SingleThreadProxy::AsValueInto(base::debug::TracedValue* state) const { |
452 // The following line casts away const modifiers because it is just | 501 // The following line casts away const modifiers because it is just |
453 // setting debug state. We still want the AsValue() function and its | 502 // setting debug state. We still want the AsValue() function and its |
454 // call chain to be const throughout. | 503 // call chain to be const throughout. |
455 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 504 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
456 | 505 |
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
637 DoCommit(layer_tree_host_impl_->CurrentBeginFrameArgs()); | 686 DoCommit(layer_tree_host_impl_->CurrentBeginFrameArgs()); |
638 } | 687 } |
639 | 688 |
640 void SingleThreadProxy::ScheduledActionAnimate() { | 689 void SingleThreadProxy::ScheduledActionAnimate() { |
641 TRACE_EVENT0("cc", "ScheduledActionAnimate"); | 690 TRACE_EVENT0("cc", "ScheduledActionAnimate"); |
642 layer_tree_host_impl_->Animate( | 691 layer_tree_host_impl_->Animate( |
643 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); | 692 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); |
644 } | 693 } |
645 | 694 |
646 void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() { | 695 void SingleThreadProxy::ScheduledActionUpdateVisibleTiles() { |
647 // Impl-side painting only. | 696 DebugScopedSetImplThread impl(this); |
648 NOTREACHED(); | 697 layer_tree_host_impl_->UpdateVisibleTiles(); |
649 } | 698 } |
650 | 699 |
651 void SingleThreadProxy::ScheduledActionActivateSyncTree() { | 700 void SingleThreadProxy::ScheduledActionActivateSyncTree() { |
701 DebugScopedSetImplThread impl(this); | |
702 layer_tree_host_impl_->ActivateSyncTree(); | |
652 } | 703 } |
653 | 704 |
654 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { | 705 void SingleThreadProxy::ScheduledActionBeginOutputSurfaceCreation() { |
655 DebugScopedSetMainThread main(this); | 706 DebugScopedSetMainThread main(this); |
656 DCHECK(scheduler_on_impl_thread_); | 707 DCHECK(scheduler_on_impl_thread_); |
657 // If possible, create the output surface in a post task. Synchronously | 708 // If possible, create the output surface in a post task. Synchronously |
658 // creating the output surface makes tests more awkward since this differs | 709 // creating the output surface makes tests more awkward since this differs |
659 // from the ThreadProxy behavior. However, sometimes there is no | 710 // from the ThreadProxy behavior. However, sometimes there is no |
660 // task runner. | 711 // task runner. |
661 if (Proxy::MainThreadTaskRunner()) { | 712 if (Proxy::MainThreadTaskRunner()) { |
662 MainThreadTaskRunner()->PostTask( | 713 MainThreadTaskRunner()->PostTask( |
663 FROM_HERE, | 714 FROM_HERE, |
664 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface, | 715 base::Bind(&SingleThreadProxy::CreateAndInitializeOutputSurface, |
665 weak_factory_.GetWeakPtr())); | 716 weak_factory_.GetWeakPtr())); |
666 } else { | 717 } else { |
667 CreateAndInitializeOutputSurface(); | 718 CreateAndInitializeOutputSurface(); |
668 } | 719 } |
669 } | 720 } |
670 | 721 |
671 void SingleThreadProxy::ScheduledActionManageTiles() { | 722 void SingleThreadProxy::ScheduledActionManageTiles() { |
672 // Impl-side painting only. | 723 TRACE_EVENT0("cc", "SingleThreadProxy::ScheduledActionManageTiles"); |
673 NOTREACHED(); | 724 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
725 DebugScopedSetImplThread impl(this); | |
726 layer_tree_host_impl_->ManageTiles(); | |
674 } | 727 } |
675 | 728 |
676 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { | 729 void SingleThreadProxy::DidAnticipatedDrawTimeChange(base::TimeTicks time) { |
677 } | 730 } |
678 | 731 |
679 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { | 732 base::TimeDelta SingleThreadProxy::DrawDurationEstimate() { |
680 return timing_history_.DrawDurationEstimate(); | 733 return timing_history_.DrawDurationEstimate(); |
681 } | 734 } |
682 | 735 |
683 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { | 736 base::TimeDelta SingleThreadProxy::BeginMainFrameToCommitDurationEstimate() { |
684 return timing_history_.BeginMainFrameToCommitDurationEstimate(); | 737 return timing_history_.BeginMainFrameToCommitDurationEstimate(); |
685 } | 738 } |
686 | 739 |
687 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { | 740 base::TimeDelta SingleThreadProxy::CommitToActivateDurationEstimate() { |
688 return timing_history_.CommitToActivateDurationEstimate(); | 741 return timing_history_.CommitToActivateDurationEstimate(); |
689 } | 742 } |
690 | 743 |
691 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 744 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
692 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 745 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
693 } | 746 } |
694 | 747 |
695 } // namespace cc | 748 } // namespace cc |
OLD | NEW |