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