Chromium Code Reviews| 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_software_renderer_ = !output_surface->context3d(); | |
|
danakj
2013/06/26 19:09:57
This would be wrong on WebView when they defer ini
boliu
2013/06/28 01:27:29
For android webview, we should strive to make GL m
| |
| 128 | |
| 127 proxy_ = proxy.Pass(); | 129 proxy_ = proxy.Pass(); |
| 128 proxy_->Start(output_surface.Pass()); | 130 proxy_->Start(output_surface.Pass()); |
| 129 return true; | 131 return true; |
| 130 } | 132 } |
| 131 | 133 |
| 132 LayerTreeHost::~LayerTreeHost() { | 134 LayerTreeHost::~LayerTreeHost() { |
| 133 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); | 135 TRACE_EVENT0("cc", "LayerTreeHost::~LayerTreeHost"); |
| 134 if (root_layer_.get()) | 136 if (root_layer_.get()) |
| 135 root_layer_->SetLayerTreeHost(NULL); | 137 root_layer_->SetLayerTreeHost(NULL); |
| 136 | 138 |
| (...skipping 563 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 700 bool update_total_num_cc_layers_will_use_lcd_text) { | 702 bool update_total_num_cc_layers_will_use_lcd_text) { |
| 701 lcd_text_metrics_.total_num_cc_layers++; | 703 lcd_text_metrics_.total_num_cc_layers++; |
| 702 if (update_total_num_cc_layers_can_use_lcd_text) | 704 if (update_total_num_cc_layers_can_use_lcd_text) |
| 703 lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text++; | 705 lcd_text_metrics_.total_num_cc_layers_can_use_lcd_text++; |
| 704 if (update_total_num_cc_layers_will_use_lcd_text) { | 706 if (update_total_num_cc_layers_will_use_lcd_text) { |
| 705 DCHECK(update_total_num_cc_layers_can_use_lcd_text); | 707 DCHECK(update_total_num_cc_layers_can_use_lcd_text); |
| 706 lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text++; | 708 lcd_text_metrics_.total_num_cc_layers_will_use_lcd_text++; |
| 707 } | 709 } |
| 708 } | 710 } |
| 709 | 711 |
| 712 bool LayerTreeHost::UsingSoftwareRenderer() { | |
| 713 return using_software_renderer_; | |
| 714 } | |
| 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 |