| 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/thread_proxy.h" | 5 #include "cc/trees/thread_proxy.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 void ThreadProxy::UpdateBackgroundAnimateTicking() { | 259 void ThreadProxy::UpdateBackgroundAnimateTicking() { |
| 260 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( | 260 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( |
| 261 !scheduler_on_impl_thread_->WillDrawIfNeeded() && | 261 !scheduler_on_impl_thread_->WillDrawIfNeeded() && |
| 262 layer_tree_host_impl_->active_tree()->root_layer()); | 262 layer_tree_host_impl_->active_tree()->root_layer()); |
| 263 } | 263 } |
| 264 | 264 |
| 265 void ThreadProxy::DoCreateAndInitializeOutputSurface() { | 265 void ThreadProxy::DoCreateAndInitializeOutputSurface() { |
| 266 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); | 266 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); |
| 267 DCHECK(IsMainThread()); | 267 DCHECK(IsMainThread()); |
| 268 | 268 |
| 269 scoped_ptr<OutputSurface> output_surface = first_output_surface_.Pass(); | 269 scoped_ptr<OutputSurface> output_surface = |
| 270 if (!output_surface) | 270 layer_tree_host()->CreateOutputSurface(); |
| 271 output_surface = layer_tree_host()->CreateOutputSurface(); | |
| 272 | 271 |
| 273 RendererCapabilities capabilities; | 272 RendererCapabilities capabilities; |
| 274 bool success = !!output_surface; | 273 bool success = !!output_surface; |
| 275 if (!success) { | 274 if (!success) { |
| 276 OnOutputSurfaceInitializeAttempted(false, capabilities); | 275 OnOutputSurfaceInitializeAttempted(false, capabilities); |
| 277 return; | 276 return; |
| 278 } | 277 } |
| 279 | 278 |
| 280 scoped_refptr<ContextProvider> offscreen_context_provider; | 279 scoped_refptr<ContextProvider> offscreen_context_provider; |
| 281 if (created_offscreen_context_provider_) { | 280 if (created_offscreen_context_provider_) { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 634 DCHECK(IsMainThread() || IsMainThreadBlocked()); | 633 DCHECK(IsMainThread() || IsMainThreadBlocked()); |
| 635 return layer_tree_host()->contents_texture_manager(); | 634 return layer_tree_host()->contents_texture_manager(); |
| 636 } | 635 } |
| 637 | 636 |
| 638 PrioritizedResourceManager* | 637 PrioritizedResourceManager* |
| 639 ThreadProxy::contents_texture_manager_on_impl_thread() { | 638 ThreadProxy::contents_texture_manager_on_impl_thread() { |
| 640 DCHECK(IsImplThread()); | 639 DCHECK(IsImplThread()); |
| 641 return contents_texture_manager_unsafe_; | 640 return contents_texture_manager_unsafe_; |
| 642 } | 641 } |
| 643 | 642 |
| 644 void ThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { | 643 void ThreadProxy::Start() { |
| 645 DCHECK(IsMainThread()); | 644 DCHECK(IsMainThread()); |
| 646 DCHECK(Proxy::HasImplThread()); | 645 DCHECK(Proxy::HasImplThread()); |
| 647 DCHECK(first_output_surface); | |
| 648 | 646 |
| 649 // Create LayerTreeHostImpl. | 647 // Create LayerTreeHostImpl. |
| 650 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 648 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 651 CompletionEvent completion; | 649 CompletionEvent completion; |
| 652 Proxy::ImplThreadTaskRunner()->PostTask( | 650 Proxy::ImplThreadTaskRunner()->PostTask( |
| 653 FROM_HERE, | 651 FROM_HERE, |
| 654 base::Bind(&ThreadProxy::InitializeImplOnImplThread, | 652 base::Bind(&ThreadProxy::InitializeImplOnImplThread, |
| 655 base::Unretained(this), | 653 base::Unretained(this), |
| 656 &completion)); | 654 &completion)); |
| 657 completion.Wait(); | 655 completion.Wait(); |
| 658 | 656 |
| 659 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); | 657 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); |
| 660 first_output_surface_ = first_output_surface.Pass(); | |
| 661 | 658 |
| 662 started_ = true; | 659 started_ = true; |
| 663 } | 660 } |
| 664 | 661 |
| 665 void ThreadProxy::Stop() { | 662 void ThreadProxy::Stop() { |
| 666 TRACE_EVENT0("cc", "ThreadProxy::Stop"); | 663 TRACE_EVENT0("cc", "ThreadProxy::Stop"); |
| 667 DCHECK(IsMainThread()); | 664 DCHECK(IsMainThread()); |
| 668 DCHECK(started_); | 665 DCHECK(started_); |
| 669 | 666 |
| 670 // Synchronously finishes pending GL operations and deletes the impl. | 667 // Synchronously finishes pending GL operations and deletes the impl. |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 commit_to_activate_duration_history_.InsertSample( | 1642 commit_to_activate_duration_history_.InsertSample( |
| 1646 base::TimeTicks::HighResNow() - commit_complete_time_); | 1643 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1647 } | 1644 } |
| 1648 | 1645 |
| 1649 void ThreadProxy::DidManageTiles() { | 1646 void ThreadProxy::DidManageTiles() { |
| 1650 DCHECK(IsImplThread()); | 1647 DCHECK(IsImplThread()); |
| 1651 scheduler_on_impl_thread_->DidManageTiles(); | 1648 scheduler_on_impl_thread_->DidManageTiles(); |
| 1652 } | 1649 } |
| 1653 | 1650 |
| 1654 } // namespace cc | 1651 } // namespace cc |
| OLD | NEW |