| 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 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 layer_tree_host_->RequestNewOutputSurface(); | 122 layer_tree_host_->RequestNewOutputSurface(); |
| 123 } | 123 } |
| 124 | 124 |
| 125 void SingleThreadProxy::SetOutputSurface( | 125 void SingleThreadProxy::SetOutputSurface( |
| 126 scoped_ptr<OutputSurface> output_surface) { | 126 scoped_ptr<OutputSurface> output_surface) { |
| 127 DCHECK(Proxy::IsMainThread()); | 127 DCHECK(Proxy::IsMainThread()); |
| 128 DCHECK(layer_tree_host_->output_surface_lost()); | 128 DCHECK(layer_tree_host_->output_surface_lost()); |
| 129 output_surface_creation_requested_ = false; | 129 output_surface_creation_requested_ = false; |
| 130 renderer_capabilities_for_main_thread_ = RendererCapabilities(); | 130 renderer_capabilities_for_main_thread_ = RendererCapabilities(); |
| 131 | 131 |
| 132 bool success = !!output_surface; | 132 bool success; |
| 133 if (success) { | 133 { |
| 134 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 134 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 135 DebugScopedSetImplThread impl(this); | 135 DebugScopedSetImplThread impl(this); |
| 136 layer_tree_host_->DeleteContentsTexturesOnImplThread( | 136 layer_tree_host_->DeleteContentsTexturesOnImplThread( |
| 137 layer_tree_host_impl_->resource_provider()); | 137 layer_tree_host_impl_->resource_provider()); |
| 138 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); | 138 success = layer_tree_host_impl_->InitializeRenderer(output_surface.Pass()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 layer_tree_host_->OnCreateAndInitializeOutputSurfaceAttempted(success); | |
| 142 | |
| 143 if (success) { | 141 if (success) { |
| 142 layer_tree_host_->DidInitializeOutputSurface(); |
| 144 if (scheduler_on_impl_thread_) | 143 if (scheduler_on_impl_thread_) |
| 145 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); | 144 scheduler_on_impl_thread_->DidCreateAndInitializeOutputSurface(); |
| 146 else if (!inside_synchronous_composite_) | 145 else if (!inside_synchronous_composite_) |
| 147 SetNeedsCommit(); | 146 SetNeedsCommit(); |
| 148 } else if (Proxy::MainThreadTaskRunner()) { | 147 } else { |
| 149 ScheduleRequestNewOutputSurface(); | 148 layer_tree_host_->DidFailToInitializeOutputSurface(); |
| 150 } | 149 } |
| 151 } | 150 } |
| 152 | 151 |
| 153 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { | 152 const RendererCapabilities& SingleThreadProxy::GetRendererCapabilities() const { |
| 154 DCHECK(Proxy::IsMainThread()); | 153 DCHECK(Proxy::IsMainThread()); |
| 155 DCHECK(!layer_tree_host_->output_surface_lost()); | 154 DCHECK(!layer_tree_host_->output_surface_lost()); |
| 156 return renderer_capabilities_for_main_thread_; | 155 return renderer_capabilities_for_main_thread_; |
| 157 } | 156 } |
| 158 | 157 |
| 159 void SingleThreadProxy::SetNeedsAnimate() { | 158 void SingleThreadProxy::SetNeedsAnimate() { |
| (...skipping 635 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 |