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" |
(...skipping 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 if (layer_tree_host_impl_->settings().impl_side_painting) { | 423 if (layer_tree_host_impl_->settings().impl_side_painting) { |
424 // This is required because NotifyReadyToActivate gets called when | 424 // This is required because NotifyReadyToActivate gets called when |
425 // the pending tree is not actually ready in the SingleThreadProxy. | 425 // the pending tree is not actually ready in the SingleThreadProxy. |
426 layer_tree_host_impl_->SetRequiresHighResToDraw(); | 426 layer_tree_host_impl_->SetRequiresHighResToDraw(); |
427 | 427 |
428 // Since activation could cause tasks to run, post CommitComplete | 428 // Since activation could cause tasks to run, post CommitComplete |
429 // separately so that it runs after these tasks. This is the loose | 429 // separately so that it runs after these tasks. This is the loose |
430 // equivalent of blocking commit until activation and also running | 430 // equivalent of blocking commit until activation and also running |
431 // all tasks posted during commit/activation before CommitComplete. | 431 // all tasks posted during commit/activation before CommitComplete. |
432 MainThreadTaskRunner()->PostTask( | 432 MainThreadTaskRunner()->PostTask( |
433 FROM_HERE, | 433 FROM_HERE, base::Bind(&SingleThreadProxy::CommitComplete, |
434 base::Bind(&SingleThreadProxy::CommitComplete, | 434 weak_factory_.GetWeakPtr())); |
435 weak_factory_.GetWeakPtr())); | |
436 } | 435 } |
437 | 436 |
438 timing_history_.DidActivateSyncTree(); | 437 timing_history_.DidActivateSyncTree(); |
439 } | 438 } |
440 | 439 |
441 void SingleThreadProxy::DidManageTiles() { | 440 void SingleThreadProxy::DidManageTiles() { |
442 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); | 441 DCHECK(layer_tree_host_impl_->settings().impl_side_painting); |
443 DCHECK(Proxy::IsImplThread()); | 442 DCHECK(Proxy::IsImplThread()); |
444 if (scheduler_on_impl_thread_) | 443 if (scheduler_on_impl_thread_) |
445 scheduler_on_impl_thread_->DidManageTiles(); | 444 scheduler_on_impl_thread_->DidManageTiles(); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
486 if (layer_tree_host_->output_surface_lost()) { | 485 if (layer_tree_host_->output_surface_lost()) { |
487 RequestNewOutputSurface(); | 486 RequestNewOutputSurface(); |
488 // RequestNewOutputSurface could have synchronously created an output | 487 // RequestNewOutputSurface could have synchronously created an output |
489 // surface, so check again before returning. | 488 // surface, so check again before returning. |
490 if (layer_tree_host_->output_surface_lost()) | 489 if (layer_tree_host_->output_surface_lost()) |
491 return; | 490 return; |
492 } | 491 } |
493 | 492 |
494 { | 493 { |
495 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( | 494 BeginFrameArgs begin_frame_args(BeginFrameArgs::Create( |
496 frame_begin_time, base::TimeTicks(), BeginFrameArgs::DefaultInterval(), | 495 BEGINFRAME_FROM_HERE, frame_begin_time, base::TimeTicks(), |
497 BeginFrameArgs::SYNCHRONOUS)); | 496 BeginFrameArgs::DefaultInterval(), BeginFrameArgs::SYNCHRONOUS)); |
498 DoBeginMainFrame(begin_frame_args); | 497 DoBeginMainFrame(begin_frame_args); |
499 DoCommit(); | 498 DoCommit(); |
500 | 499 |
501 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) | 500 DCHECK_EQ(0u, layer_tree_host_->num_queued_swap_promises()) |
502 << "Commit should always succeed and transfer promises."; | 501 << "Commit should always succeed and transfer promises."; |
503 } | 502 } |
504 | 503 |
505 { | 504 { |
506 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); | 505 DebugScopedSetImplThread impl(const_cast<SingleThreadProxy*>(this)); |
507 if (layer_tree_host_impl_->settings().impl_side_painting) { | 506 if (layer_tree_host_impl_->settings().impl_side_painting) { |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 | 794 |
796 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 795 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
797 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 796 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
798 } | 797 } |
799 | 798 |
800 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 799 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
801 layer_tree_host_->SendBeginFramesToChildren(args); | 800 layer_tree_host_->SendBeginFramesToChildren(args); |
802 } | 801 } |
803 | 802 |
804 } // namespace cc | 803 } // namespace cc |
OLD | NEW |