| 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/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/profiler/scoped_tracker.h" | 9 #include "base/profiler/scoped_tracker.h" |
| 10 #include "base/trace_event/trace_event.h" | 10 #include "base/trace_event/trace_event.h" |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 505 return; | 505 return; |
| 506 if (scheduler_on_impl_thread_) | 506 if (scheduler_on_impl_thread_) |
| 507 scheduler_on_impl_thread_->SetBeginFrameSource(source); | 507 scheduler_on_impl_thread_->SetBeginFrameSource(source); |
| 508 } | 508 } |
| 509 | 509 |
| 510 void SingleThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { | 510 void SingleThreadProxy::SetEstimatedParentDrawTime(base::TimeDelta draw_time) { |
| 511 if (scheduler_on_impl_thread_) | 511 if (scheduler_on_impl_thread_) |
| 512 scheduler_on_impl_thread_->SetEstimatedParentDrawTime(draw_time); | 512 scheduler_on_impl_thread_->SetEstimatedParentDrawTime(draw_time); |
| 513 } | 513 } |
| 514 | 514 |
| 515 void SingleThreadProxy::DidSwapBuffersOnImplThread() { | |
| 516 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersOnImplThread"); | |
| 517 if (scheduler_on_impl_thread_) | |
| 518 scheduler_on_impl_thread_->DidSwapBuffers(); | |
| 519 client_->DidPostSwapBuffers(); | |
| 520 } | |
| 521 | |
| 522 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 515 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
| 523 TRACE_EVENT0("cc,benchmark", | 516 TRACE_EVENT0("cc,benchmark", |
| 524 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 517 "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
| 525 if (scheduler_on_impl_thread_) | 518 if (scheduler_on_impl_thread_) |
| 526 scheduler_on_impl_thread_->DidSwapBuffersComplete(); | 519 scheduler_on_impl_thread_->DidSwapBuffersComplete(); |
| 527 layer_tree_host_->DidCompleteSwapBuffers(); | 520 layer_tree_host_->DidCompleteSwapBuffers(); |
| 528 } | 521 } |
| 529 | 522 |
| 530 void SingleThreadProxy::OnDrawForOutputSurface( | 523 void SingleThreadProxy::OnDrawForOutputSurface( |
| 531 bool resourceless_software_draw) { | 524 bool resourceless_software_draw) { |
| (...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 689 // the swap buffers will execute first. | 682 // the swap buffers will execute first. |
| 690 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); | 683 DebugScopedSetMainThreadBlocked main_thread_blocked(task_runner_provider_); |
| 691 | 684 |
| 692 BlockingTaskRunner::CapturePostTasks blocked( | 685 BlockingTaskRunner::CapturePostTasks blocked( |
| 693 task_runner_provider_->blocking_main_thread_task_runner()); | 686 task_runner_provider_->blocking_main_thread_task_runner()); |
| 694 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 | 687 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 |
| 695 // is fixed. | 688 // is fixed. |
| 696 tracked_objects::ScopedTracker tracking_profile8( | 689 tracked_objects::ScopedTracker tracking_profile8( |
| 697 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 690 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 698 "461509 SingleThreadProxy::DoComposite8")); | 691 "461509 SingleThreadProxy::DoComposite8")); |
| 699 layer_tree_host_impl_->SwapBuffers(*frame); | 692 if (layer_tree_host_impl_->SwapBuffers(*frame)) { |
| 693 if (scheduler_on_impl_thread_) |
| 694 scheduler_on_impl_thread_->DidSwapBuffers(); |
| 695 client_->DidPostSwapBuffers(); |
| 696 } |
| 700 } | 697 } |
| 701 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 is | 698 // TODO(robliao): Remove ScopedTracker below once https://crbug.com/461509 is |
| 702 // fixed. | 699 // fixed. |
| 703 tracked_objects::ScopedTracker tracking_profile9( | 700 tracked_objects::ScopedTracker tracking_profile9( |
| 704 FROM_HERE_WITH_EXPLICIT_FUNCTION( | 701 FROM_HERE_WITH_EXPLICIT_FUNCTION( |
| 705 "461509 SingleThreadProxy::DoComposite9")); | 702 "461509 SingleThreadProxy::DoComposite9")); |
| 706 DidCommitAndDrawFrame(); | 703 DidCommitAndDrawFrame(); |
| 707 | 704 |
| 708 return draw_result; | 705 return draw_result; |
| 709 } | 706 } |
| (...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 885 void SingleThreadProxy::DidFinishImplFrame() { | 882 void SingleThreadProxy::DidFinishImplFrame() { |
| 886 layer_tree_host_impl_->DidFinishImplFrame(); | 883 layer_tree_host_impl_->DidFinishImplFrame(); |
| 887 #if DCHECK_IS_ON() | 884 #if DCHECK_IS_ON() |
| 888 DCHECK(inside_impl_frame_) | 885 DCHECK(inside_impl_frame_) |
| 889 << "DidFinishImplFrame called while not inside an impl frame!"; | 886 << "DidFinishImplFrame called while not inside an impl frame!"; |
| 890 inside_impl_frame_ = false; | 887 inside_impl_frame_ = false; |
| 891 #endif | 888 #endif |
| 892 } | 889 } |
| 893 | 890 |
| 894 } // namespace cc | 891 } // namespace cc |
| OLD | NEW |