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 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 layer_tree_host_impl_->resource_provider()); | 140 layer_tree_host_impl_->resource_provider()); |
141 } | 141 } |
142 | 142 |
143 bool initialized; | 143 bool initialized; |
144 { | 144 { |
145 DebugScopedSetImplThread impl(this); | 145 DebugScopedSetImplThread impl(this); |
146 | 146 |
147 DCHECK(output_surface); | 147 DCHECK(output_surface); |
148 initialized = layer_tree_host_impl_->InitializeRenderer( | 148 initialized = layer_tree_host_impl_->InitializeRenderer( |
149 output_surface.Pass()); | 149 output_surface.Pass()); |
150 if (initialized) { | 150 if (!initialized && offscreen_context_provider.get()) { |
151 renderer_capabilities_for_main_thread_ = | |
152 layer_tree_host_impl_->GetRendererCapabilities() | |
153 .MainThreadCapabilities(); | |
154 } else if (offscreen_context_provider.get()) { | |
155 offscreen_context_provider->VerifyContexts(); | 151 offscreen_context_provider->VerifyContexts(); |
156 offscreen_context_provider = NULL; | 152 offscreen_context_provider = NULL; |
157 } | 153 } |
158 | 154 |
159 layer_tree_host_impl_->SetOffscreenContextProvider( | 155 layer_tree_host_impl_->SetOffscreenContextProvider( |
160 offscreen_context_provider); | 156 offscreen_context_provider); |
161 } | 157 } |
162 | 158 |
163 OnOutputSurfaceInitializeAttempted(initialized); | 159 OnOutputSurfaceInitializeAttempted(initialized); |
164 } | 160 } |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return; | 359 return; |
364 | 360 |
365 layer_tree_host_impl_->SendManagedMemoryStats( | 361 layer_tree_host_impl_->SendManagedMemoryStats( |
366 contents_texture_manager->MemoryVisibleBytes(), | 362 contents_texture_manager->MemoryVisibleBytes(), |
367 contents_texture_manager->MemoryVisibleAndNearbyBytes(), | 363 contents_texture_manager->MemoryVisibleAndNearbyBytes(), |
368 contents_texture_manager->MemoryUseBytes()); | 364 contents_texture_manager->MemoryUseBytes()); |
369 } | 365 } |
370 | 366 |
371 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } | 367 bool SingleThreadProxy::IsInsideDraw() { return inside_draw_; } |
372 | 368 |
| 369 void SingleThreadProxy::UpdateRendererCapabilitiesOnImplThread() { |
| 370 DCHECK(IsImplThread()); |
| 371 renderer_capabilities_for_main_thread_ = |
| 372 layer_tree_host_impl_->GetRendererCapabilities().MainThreadCapabilities(); |
| 373 } |
| 374 |
373 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { | 375 void SingleThreadProxy::DidLoseOutputSurfaceOnImplThread() { |
374 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); | 376 TRACE_EVENT0("cc", "SingleThreadProxy::DidLoseOutputSurfaceOnImplThread"); |
375 // Cause a commit so we can notice the lost context. | 377 // Cause a commit so we can notice the lost context. |
376 SetNeedsCommitOnImplThread(); | 378 SetNeedsCommitOnImplThread(); |
377 client_->DidAbortSwapBuffers(); | 379 client_->DidAbortSwapBuffers(); |
378 } | 380 } |
379 | 381 |
380 void SingleThreadProxy::DidSwapBuffersOnImplThread() { | 382 void SingleThreadProxy::DidSwapBuffersOnImplThread() { |
381 client_->DidPostSwapBuffers(); | 383 client_->DidPostSwapBuffers(); |
382 } | 384 } |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
564 void SingleThreadProxy::DidSwapFrame() { | 566 void SingleThreadProxy::DidSwapFrame() { |
565 if (next_frame_is_newly_committed_frame_) { | 567 if (next_frame_is_newly_committed_frame_) { |
566 next_frame_is_newly_committed_frame_ = false; | 568 next_frame_is_newly_committed_frame_ = false; |
567 layer_tree_host_->DidCommitAndDrawFrame(); | 569 layer_tree_host_->DidCommitAndDrawFrame(); |
568 } | 570 } |
569 } | 571 } |
570 | 572 |
571 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 573 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
572 | 574 |
573 } // namespace cc | 575 } // namespace cc |
OLD | NEW |