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/layer_tree_host.h" | 5 #include "cc/trees/layer_tree_host.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <stack> | 8 #include <stack> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 return InitializeProxy(proxy_for_testing.Pass()); | 117 return InitializeProxy(proxy_for_testing.Pass()); |
118 } | 118 } |
119 | 119 |
120 bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { | 120 bool LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
121 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); | 121 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
122 | 122 |
123 scoped_ptr<OutputSurface> output_surface(CreateOutputSurface()); | 123 scoped_ptr<OutputSurface> output_surface(CreateOutputSurface()); |
124 if (!output_surface) | 124 if (!output_surface) |
125 return false; | 125 return false; |
126 | 126 |
| 127 using_gl_renderer_ = |
| 128 output_surface->context3d() || |
| 129 output_surface->capabilities().deferred_gl_initialization; |
| 130 |
127 proxy_ = proxy.Pass(); | 131 proxy_ = proxy.Pass(); |
128 proxy_->Start(output_surface.Pass()); | 132 proxy_->Start(output_surface.Pass()); |
129 return true; | 133 return true; |
130 } | 134 } |
131 | 135 |
132 LayerTreeHost::~LayerTreeHost() { | 136 LayerTreeHost::~LayerTreeHost() { |
133 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 137 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
134 if (root_layer_.get()) | 138 if (root_layer_.get()) |
135 root_layer_->SetLayerTreeHost(NULL); | 139 root_layer_->SetLayerTreeHost(NULL); |
136 | 140 |
(...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 bool update_total_num_cc_layers_will_use_lcd_text) { | 704 bool update_total_num_cc_layers_will_use_lcd_text) { |
701 lcd_text_metrics_.total_num_cc_layers++; | 705 lcd_text_metrics_.total_num_cc_layers++; |
702 if (update_total_num_cc_layers_can_use_lcd_text) | 706 if (update_total_num_cc_layers_can_use_lcd_text) |
703 lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text++; | 707 lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text++; |
704 if (update_total_num_cc_layers_will_use_lcd_text) { | 708 if (update_total_num_cc_layers_will_use_lcd_text) { |
705 DCHECK(update_total_num_cc_layers_can_use_lcd_text); | 709 DCHECK(update_total_num_cc_layers_can_use_lcd_text); |
706 lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text++; | 710 lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text++; |
707 } | 711 } |
708 } | 712 } |
709 | 713 |
| 714 bool LayerTreeHost::UsingGLRenderer() { return using_gl_renderer_; } |
| 715 |
710 void LayerTreeHost::UpdateLayers(Layer* root_layer, | 716 void LayerTreeHost::UpdateLayers(Layer* root_layer, |
711 ResourceUpdateQueue* queue) { | 717 ResourceUpdateQueue* queue) { |
712 TRACE_EVENT1("cc", "LayerTreeHost::UpdateLayers", | 718 TRACE_EVENT1("cc", "LayerTreeHost::UpdateLayers", |
713 "commit_number", commit_number()); | 719 "commit_number", commit_number()); |
714 | 720 |
715 LayerList update_list; | 721 LayerList update_list; |
716 { | 722 { |
717 UpdateHudLayer(); | 723 UpdateHudLayer(); |
718 | 724 |
719 Layer* root_scroll = FindFirstScrollableLayer(root_layer); | 725 Layer* root_scroll = FindFirstScrollableLayer(root_layer); |
(...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1080 bool start_ready_animations = true; | 1086 bool start_ready_animations = true; |
1081 (*iter).second->UpdateState(start_ready_animations, NULL); | 1087 (*iter).second->UpdateState(start_ready_animations, NULL); |
1082 } | 1088 } |
1083 } | 1089 } |
1084 | 1090 |
1085 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { | 1091 skia::RefPtr<SkPicture> LayerTreeHost::CapturePicture() { |
1086 return proxy_->CapturePicture(); | 1092 return proxy_->CapturePicture(); |
1087 } | 1093 } |
1088 | 1094 |
1089 } // namespace cc | 1095 } // namespace cc |
OLD | NEW |