| 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 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 void ThreadProxy::UpdateBackgroundAnimateTicking() { | 240 void ThreadProxy::UpdateBackgroundAnimateTicking() { |
| 241 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( | 241 layer_tree_host_impl_->UpdateBackgroundAnimateTicking( |
| 242 !scheduler_on_impl_thread_->WillDrawIfNeeded() && | 242 !scheduler_on_impl_thread_->WillDrawIfNeeded() && |
| 243 layer_tree_host_impl_->active_tree()->root_layer()); | 243 layer_tree_host_impl_->active_tree()->root_layer()); |
| 244 } | 244 } |
| 245 | 245 |
| 246 void ThreadProxy::DoCreateAndInitializeOutputSurface() { | 246 void ThreadProxy::DoCreateAndInitializeOutputSurface() { |
| 247 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); | 247 TRACE_EVENT0("cc", "ThreadProxy::DoCreateAndInitializeOutputSurface"); |
| 248 DCHECK(IsMainThread()); | 248 DCHECK(IsMainThread()); |
| 249 | 249 |
| 250 scoped_ptr<OutputSurface> output_surface = first_output_surface_.Pass(); | 250 scoped_ptr<OutputSurface> output_surface = |
| 251 if (!output_surface) | 251 layer_tree_host()->CreateOutputSurface(); |
| 252 output_surface = layer_tree_host()->CreateOutputSurface(); | |
| 253 | 252 |
| 254 RendererCapabilities capabilities; | 253 RendererCapabilities capabilities; |
| 255 bool success = !!output_surface; | 254 bool success = !!output_surface; |
| 256 if (!success) { | 255 if (!success) { |
| 257 OnOutputSurfaceInitializeAttempted(false, capabilities); | 256 OnOutputSurfaceInitializeAttempted(false, capabilities); |
| 258 return; | 257 return; |
| 259 } | 258 } |
| 260 | 259 |
| 261 scoped_refptr<ContextProvider> offscreen_context_provider; | 260 scoped_refptr<ContextProvider> offscreen_context_provider; |
| 262 if (created_offscreen_context_provider_) { | 261 if (created_offscreen_context_provider_) { |
| (...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 DCHECK(IsMainThread() || IsMainThreadBlocked()); | 614 DCHECK(IsMainThread() || IsMainThreadBlocked()); |
| 616 return layer_tree_host()->contents_texture_manager(); | 615 return layer_tree_host()->contents_texture_manager(); |
| 617 } | 616 } |
| 618 | 617 |
| 619 PrioritizedResourceManager* | 618 PrioritizedResourceManager* |
| 620 ThreadProxy::contents_texture_manager_on_impl_thread() { | 619 ThreadProxy::contents_texture_manager_on_impl_thread() { |
| 621 DCHECK(IsImplThread()); | 620 DCHECK(IsImplThread()); |
| 622 return contents_texture_manager_unsafe_; | 621 return contents_texture_manager_unsafe_; |
| 623 } | 622 } |
| 624 | 623 |
| 625 void ThreadProxy::Start(scoped_ptr<OutputSurface> first_output_surface) { | 624 void ThreadProxy::Start() { |
| 626 DCHECK(IsMainThread()); | 625 DCHECK(IsMainThread()); |
| 627 DCHECK(Proxy::HasImplThread()); | 626 DCHECK(Proxy::HasImplThread()); |
| 628 DCHECK(first_output_surface); | |
| 629 | 627 |
| 630 // Create LayerTreeHostImpl. | 628 // Create LayerTreeHostImpl. |
| 631 DebugScopedSetMainThreadBlocked main_thread_blocked(this); | 629 DebugScopedSetMainThreadBlocked main_thread_blocked(this); |
| 632 CompletionEvent completion; | 630 CompletionEvent completion; |
| 633 Proxy::ImplThreadTaskRunner()->PostTask( | 631 Proxy::ImplThreadTaskRunner()->PostTask( |
| 634 FROM_HERE, | 632 FROM_HERE, |
| 635 base::Bind(&ThreadProxy::InitializeImplOnImplThread, | 633 base::Bind(&ThreadProxy::InitializeImplOnImplThread, |
| 636 base::Unretained(this), | 634 base::Unretained(this), |
| 637 &completion)); | 635 &completion)); |
| 638 completion.Wait(); | 636 completion.Wait(); |
| 639 | 637 |
| 640 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); | 638 main_thread_weak_ptr_ = weak_factory_.GetWeakPtr(); |
| 641 first_output_surface_ = first_output_surface.Pass(); | |
| 642 | 639 |
| 643 started_ = true; | 640 started_ = true; |
| 644 } | 641 } |
| 645 | 642 |
| 646 void ThreadProxy::Stop() { | 643 void ThreadProxy::Stop() { |
| 647 TRACE_EVENT0("cc", "ThreadProxy::Stop"); | 644 TRACE_EVENT0("cc", "ThreadProxy::Stop"); |
| 648 DCHECK(IsMainThread()); | 645 DCHECK(IsMainThread()); |
| 649 DCHECK(started_); | 646 DCHECK(started_); |
| 650 | 647 |
| 651 // Synchronously finishes pending GL operations and deletes the impl. | 648 // Synchronously finishes pending GL operations and deletes the impl. |
| (...skipping 974 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1626 commit_to_activate_duration_history_.InsertSample( | 1623 commit_to_activate_duration_history_.InsertSample( |
| 1627 base::TimeTicks::HighResNow() - commit_complete_time_); | 1624 base::TimeTicks::HighResNow() - commit_complete_time_); |
| 1628 } | 1625 } |
| 1629 | 1626 |
| 1630 void ThreadProxy::DidManageTiles() { | 1627 void ThreadProxy::DidManageTiles() { |
| 1631 DCHECK(IsImplThread()); | 1628 DCHECK(IsImplThread()); |
| 1632 scheduler_on_impl_thread_->DidManageTiles(); | 1629 scheduler_on_impl_thread_->DidManageTiles(); |
| 1633 } | 1630 } |
| 1634 | 1631 |
| 1635 } // namespace cc | 1632 } // namespace cc |
| OLD | NEW |