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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 layer_tree_host_impl_->SetVisible(visible); | 81 layer_tree_host_impl_->SetVisible(visible); |
82 | 82 |
83 // Changing visibility could change ShouldComposite(). | 83 // Changing visibility could change ShouldComposite(). |
84 UpdateBackgroundAnimateTicking(); | 84 UpdateBackgroundAnimateTicking(); |
85 } | 85 } |
86 | 86 |
87 void SingleThreadProxy::CreateAndInitializeOutputSurface() { | 87 void SingleThreadProxy::CreateAndInitializeOutputSurface() { |
88 TRACE_EVENT0( | 88 TRACE_EVENT0( |
89 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface"); | 89 "cc", "SingleThreadProxy::CreateAndInitializeOutputSurface"); |
90 DCHECK(Proxy::IsMainThread()); | 90 DCHECK(Proxy::IsMainThread()); |
| 91 DCHECK(layer_tree_host_->output_surface_lost()); |
91 | 92 |
92 scoped_ptr<OutputSurface> output_surface = | 93 scoped_ptr<OutputSurface> output_surface = |
93 layer_tree_host_->CreateOutputSurface(); | 94 layer_tree_host_->CreateOutputSurface(); |
94 | 95 |
95 renderer_capabilities_for_main_thread_ = RendererCapabilities(); | 96 renderer_capabilities_for_main_thread_ = RendererCapabilities(); |
96 | 97 |
97 bool success = !!output_surface; | 98 bool success = !!output_surface; |
98 if (success) { | 99 if (success) { |
99 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 100 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
100 DebugScopedSetImplThread impl(this); | 101 DebugScopedSetImplThread impl(this); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { | 333 void SingleThreadProxy::DidSwapBuffersCompleteOnImplThread() { |
333 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); | 334 TRACE_EVENT0("cc", "SingleThreadProxy::DidSwapBuffersCompleteOnImplThread"); |
334 client_->DidCompleteSwapBuffers(); | 335 client_->DidCompleteSwapBuffers(); |
335 } | 336 } |
336 | 337 |
337 // Called by the legacy scheduling path (e.g. where render_widget does the | 338 // Called by the legacy scheduling path (e.g. where render_widget does the |
338 // scheduling) | 339 // scheduling) |
339 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { | 340 void SingleThreadProxy::CompositeImmediately(base::TimeTicks frame_begin_time) { |
340 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); | 341 TRACE_EVENT0("cc", "SingleThreadProxy::CompositeImmediately"); |
341 DCHECK(Proxy::IsMainThread()); | 342 DCHECK(Proxy::IsMainThread()); |
342 | 343 DCHECK(!layer_tree_host_->output_surface_lost()); |
343 if (!layer_tree_host_->InitializeOutputSurfaceIfNeeded()) | |
344 return; | |
345 | 344 |
346 layer_tree_host_->AnimateLayers(frame_begin_time); | 345 layer_tree_host_->AnimateLayers(frame_begin_time); |
347 | 346 |
348 if (PrioritizedResourceManager* contents_texture_manager = | 347 if (PrioritizedResourceManager* contents_texture_manager = |
349 layer_tree_host_->contents_texture_manager()) { | 348 layer_tree_host_->contents_texture_manager()) { |
350 contents_texture_manager->UnlinkAndClearEvictedBackings(); | 349 contents_texture_manager->UnlinkAndClearEvictedBackings(); |
351 contents_texture_manager->SetMaxMemoryLimitBytes( | 350 contents_texture_manager->SetMaxMemoryLimitBytes( |
352 layer_tree_host_impl_->memory_allocation_limit_bytes()); | 351 layer_tree_host_impl_->memory_allocation_limit_bytes()); |
353 contents_texture_manager->SetExternalPriorityCutoff( | 352 contents_texture_manager->SetExternalPriorityCutoff( |
354 layer_tree_host_impl_->memory_allocation_priority_cutoff()); | 353 layer_tree_host_impl_->memory_allocation_priority_cutoff()); |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
466 void SingleThreadProxy::DidSwapFrame() { | 465 void SingleThreadProxy::DidSwapFrame() { |
467 if (next_frame_is_newly_committed_frame_) { | 466 if (next_frame_is_newly_committed_frame_) { |
468 next_frame_is_newly_committed_frame_ = false; | 467 next_frame_is_newly_committed_frame_ = false; |
469 layer_tree_host_->DidCommitAndDrawFrame(); | 468 layer_tree_host_->DidCommitAndDrawFrame(); |
470 } | 469 } |
471 } | 470 } |
472 | 471 |
473 bool SingleThreadProxy::CommitPendingForTesting() { return false; } | 472 bool SingleThreadProxy::CommitPendingForTesting() { return false; } |
474 | 473 |
475 } // namespace cc | 474 } // namespace cc |
OLD | NEW |