| 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 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 159 std::move(external_begin_frame_source))); | 159 std::move(external_begin_frame_source))); |
| 160 } | 160 } |
| 161 | 161 |
| 162 void LayerTreeHost::InitializeForTesting( | 162 void LayerTreeHost::InitializeForTesting( |
| 163 scoped_ptr<TaskRunnerProvider> task_runner_provider, | 163 scoped_ptr<TaskRunnerProvider> task_runner_provider, |
| 164 scoped_ptr<Proxy> proxy_for_testing) { | 164 scoped_ptr<Proxy> proxy_for_testing) { |
| 165 task_runner_provider_ = std::move(task_runner_provider); | 165 task_runner_provider_ = std::move(task_runner_provider); |
| 166 InitializeProxy(std::move(proxy_for_testing)); | 166 InitializeProxy(std::move(proxy_for_testing)); |
| 167 } | 167 } |
| 168 | 168 |
| 169 void LayerTreeHost::SetTaskRunnerProviderForTesting( |
| 170 scoped_ptr<TaskRunnerProvider> task_runner_provider) { |
| 171 DCHECK(!task_runner_provider_); |
| 172 task_runner_provider_ = std::move(task_runner_provider); |
| 173 } |
| 174 |
| 169 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { | 175 void LayerTreeHost::InitializeProxy(scoped_ptr<Proxy> proxy) { |
| 170 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); | 176 TRACE_EVENT0("cc", "LayerTreeHost::InitializeForReal"); |
| 171 | 177 |
| 172 proxy_ = std::move(proxy); | 178 proxy_ = std::move(proxy); |
| 173 proxy_->Start(); | 179 proxy_->Start(); |
| 174 if (settings_.accelerated_animation_enabled) { | 180 if (settings_.accelerated_animation_enabled) { |
| 175 if (animation_host_) | 181 if (animation_host_) |
| 176 animation_host_->SetSupportsScrollAnimations( | 182 animation_host_->SetSupportsScrollAnimations( |
| 177 proxy_->SupportsImplScrolling()); | 183 proxy_->SupportsImplScrolling()); |
| 178 else | 184 else |
| (...skipping 551 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); | 736 Layer* found = FindFirstScrollableLayer(layer->children()[i].get()); |
| 731 if (found) | 737 if (found) |
| 732 return found; | 738 return found; |
| 733 } | 739 } |
| 734 | 740 |
| 735 return NULL; | 741 return NULL; |
| 736 } | 742 } |
| 737 | 743 |
| 738 void LayerTreeHost::RecordGpuRasterizationHistogram() { | 744 void LayerTreeHost::RecordGpuRasterizationHistogram() { |
| 739 // Gpu rasterization is only supported for Renderer compositors. | 745 // Gpu rasterization is only supported for Renderer compositors. |
| 740 // Checking for IsThreaded() to exclude Browser compositors. | 746 // Checking for IsSingleThreaded() to exclude Browser compositors. |
| 741 if (gpu_rasterization_histogram_recorded_ || IsThreaded()) | 747 if (gpu_rasterization_histogram_recorded_ || IsSingleThreaded()) |
| 742 return; | 748 return; |
| 743 | 749 |
| 744 // Record how widely gpu rasterization is enabled. | 750 // Record how widely gpu rasterization is enabled. |
| 745 // This number takes device/gpu whitelisting/backlisting into account. | 751 // This number takes device/gpu whitelisting/backlisting into account. |
| 746 // Note that we do not consider the forced gpu rasterization mode, which is | 752 // Note that we do not consider the forced gpu rasterization mode, which is |
| 747 // mostly used for debugging purposes. | 753 // mostly used for debugging purposes. |
| 748 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationEnabled", | 754 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationEnabled", |
| 749 settings_.gpu_rasterization_enabled); | 755 settings_.gpu_rasterization_enabled); |
| 750 if (settings_.gpu_rasterization_enabled) { | 756 if (settings_.gpu_rasterization_enabled) { |
| 751 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationTriggered", | 757 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationTriggered", |
| (...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1257 return compositor_mode_ == CompositorMode::SingleThreaded; | 1263 return compositor_mode_ == CompositorMode::SingleThreaded; |
| 1258 } | 1264 } |
| 1259 | 1265 |
| 1260 bool LayerTreeHost::IsThreaded() const { | 1266 bool LayerTreeHost::IsThreaded() const { |
| 1261 DCHECK(compositor_mode_ != CompositorMode::Threaded || | 1267 DCHECK(compositor_mode_ != CompositorMode::Threaded || |
| 1262 task_runner_provider_->HasImplThread()); | 1268 task_runner_provider_->HasImplThread()); |
| 1263 return compositor_mode_ == CompositorMode::Threaded; | 1269 return compositor_mode_ == CompositorMode::Threaded; |
| 1264 } | 1270 } |
| 1265 | 1271 |
| 1266 } // namespace cc | 1272 } // namespace cc |
| OLD | NEW |