Chromium Code Reviews| 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/profiler/scoped_tracker.h" | 8 #include "base/profiler/scoped_tracker.h" |
| 9 #include "base/trace_event/trace_event.h" | 9 #include "base/trace_event/trace_event.h" |
| 10 #include "cc/debug/benchmark_instrumentation.h" | 10 #include "cc/debug/benchmark_instrumentation.h" |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { | 171 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { |
| 172 DCHECK(Proxy::IsMainThread()); | 172 DCHECK(Proxy::IsMainThread()); |
| 173 DCHECK(!layer_tree_host_->output_surface_lost()); | 173 DCHECK(!layer_tree_host_->output_surface_lost()); |
| 174 return renderer_capabilities_for_main_thread_; | 174 return renderer_capabilities_for_main_thread_; |
| 175 } | 175 } |
| 176 | 176 |
| 177 void SingleThreadProxy::SetNeedsAnimate() { | 177 void SingleThreadProxy::SetNeedsAnimate() { |
| 178 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate"); | 178 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsAnimate"); |
| 179 DCHECK(Proxy::IsMainThread()); | 179 DCHECK(Proxy::IsMainThread()); |
| 180 client_->ScheduleAnimation(); | 180 client_->ScheduleAnimation(); |
| 181 SetNeedsCommit(); | 181 DebugScopedSetImplThread impl(this); |
| 182 SetNeedsCommitOnImplThread(); | |
|
danakj
2015/04/28 20:00:44
This would ScheduleComposite twice, and we should
| |
| 182 } | 183 } |
| 183 | 184 |
| 184 void SingleThreadProxy::SetNeedsUpdateLayers() { | 185 void SingleThreadProxy::SetNeedsUpdateLayers() { |
| 185 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers"); | 186 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsUpdateLayers"); |
| 186 DCHECK(Proxy::IsMainThread()); | 187 DCHECK(Proxy::IsMainThread()); |
| 187 SetNeedsCommit(); | 188 SetNeedsCommit(); |
| 188 } | 189 } |
| 189 | 190 |
| 190 void SingleThreadProxy::DoAnimate() { | 191 void SingleThreadProxy::DoAnimate() { |
| 191 // Don't animate if there is no root layer. | 192 // Don't animate if there is no root layer. |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 329 | 330 |
| 330 next_frame_is_newly_committed_frame_ = true; | 331 next_frame_is_newly_committed_frame_ = true; |
| 331 } | 332 } |
| 332 | 333 |
| 333 void SingleThreadProxy::SetNeedsCommit() { | 334 void SingleThreadProxy::SetNeedsCommit() { |
| 334 DCHECK(Proxy::IsMainThread()); | 335 DCHECK(Proxy::IsMainThread()); |
| 335 client_->ScheduleComposite(); | 336 client_->ScheduleComposite(); |
| 336 if (commit_requested_) | 337 if (commit_requested_) |
| 337 return; | 338 return; |
| 338 DebugScopedSetImplThread impl(this); | 339 DebugScopedSetImplThread impl(this); |
| 339 if (scheduler_on_impl_thread_) | 340 SetNeedsCommitOnImplThread(); |
| 340 scheduler_on_impl_thread_->SetNeedsCommit(); | |
| 341 commit_requested_ = true; | 341 commit_requested_ = true; |
| 342 } | 342 } |
| 343 | 343 |
| 344 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { | 344 void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { |
| 345 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); | 345 TRACE_EVENT0("cc", "SingleThreadProxy::SetNeedsRedraw"); |
| 346 DCHECK(Proxy::IsMainThread()); | 346 DCHECK(Proxy::IsMainThread()); |
| 347 DebugScopedSetImplThread impl(this); | 347 DebugScopedSetImplThread impl(this); |
| 348 client_->ScheduleComposite(); | 348 client_->ScheduleComposite(); |
| 349 SetNeedsRedrawRectOnImplThread(damage_rect); | 349 SetNeedsRedrawRectOnImplThread(damage_rect); |
| 350 } | 350 } |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 830 } | 830 } |
| 831 | 831 |
| 832 if (layer_tree_host_->output_surface_lost()) { | 832 if (layer_tree_host_->output_surface_lost()) { |
| 833 TRACE_EVENT_INSTANT0( | 833 TRACE_EVENT_INSTANT0( |
| 834 "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD); | 834 "cc", "EarlyOut_OutputSurfaceLost", TRACE_EVENT_SCOPE_THREAD); |
| 835 BeginMainFrameAbortedOnImplThread( | 835 BeginMainFrameAbortedOnImplThread( |
| 836 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST); | 836 CommitEarlyOutReason::ABORTED_OUTPUT_SURFACE_LOST); |
| 837 return; | 837 return; |
| 838 } | 838 } |
| 839 | 839 |
| 840 // Prevent new commits from being requested inside DoBeginMainFrame. | 840 // Prevent new commits from being requested inside DoBeginMainFrame. |
|
danakj
2015/04/28 20:03:11
Can you add a comment here about this shouldn't af
| |
| 841 commit_requested_ = true; | 841 commit_requested_ = true; |
| 842 | 842 |
| 843 const BeginFrameArgs& begin_frame_args = | 843 const BeginFrameArgs& begin_frame_args = |
| 844 layer_tree_host_impl_->CurrentBeginFrameArgs(); | 844 layer_tree_host_impl_->CurrentBeginFrameArgs(); |
| 845 DoBeginMainFrame(begin_frame_args); | 845 DoBeginMainFrame(begin_frame_args); |
| 846 } | 846 } |
| 847 | 847 |
| 848 void SingleThreadProxy::DoBeginMainFrame( | 848 void SingleThreadProxy::DoBeginMainFrame( |
| 849 const BeginFrameArgs& begin_frame_args) { | 849 const BeginFrameArgs& begin_frame_args) { |
| 850 layer_tree_host_->WillBeginMainFrame(); | 850 layer_tree_host_->WillBeginMainFrame(); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 960 | 960 |
| 961 void SingleThreadProxy::DidBeginImplFrameDeadline() { | 961 void SingleThreadProxy::DidBeginImplFrameDeadline() { |
| 962 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | 962 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); |
| 963 } | 963 } |
| 964 | 964 |
| 965 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { | 965 void SingleThreadProxy::SendBeginFramesToChildren(const BeginFrameArgs& args) { |
| 966 layer_tree_host_->SendBeginFramesToChildren(args); | 966 layer_tree_host_->SendBeginFramesToChildren(args); |
| 967 } | 967 } |
| 968 | 968 |
| 969 } // namespace cc | 969 } // namespace cc |
| OLD | NEW |