| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 if (layer_tree_->needs_full_tree_sync()) | 302 if (layer_tree_->needs_full_tree_sync()) |
| 303 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); | 303 TreeSynchronizer::SynchronizeTrees(layer_tree_->root_layer(), sync_tree); |
| 304 | 304 |
| 305 layer_tree_->PushPropertiesTo(sync_tree); | 305 layer_tree_->PushPropertiesTo(sync_tree); |
| 306 | 306 |
| 307 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); | 307 sync_tree->PassSwapPromises(swap_promise_manager_.TakeSwapPromises()); |
| 308 | 308 |
| 309 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); | 309 host_impl->SetHasGpuRasterizationTrigger(has_gpu_rasterization_trigger_); |
| 310 host_impl->SetContentIsSuitableForGpuRasterization( | 310 host_impl->SetContentIsSuitableForGpuRasterization( |
| 311 content_is_suitable_for_gpu_rasterization_); | 311 content_is_suitable_for_gpu_rasterization_); |
| 312 RecordGpuRasterizationHistogram(); | 312 RecordGpuRasterizationHistogram(host_impl); |
| 313 | 313 |
| 314 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); | 314 host_impl->SetViewportSize(layer_tree_->device_viewport_size()); |
| 315 sync_tree->SetDeviceScaleFactor(layer_tree_->device_scale_factor()); | 315 sync_tree->SetDeviceScaleFactor(layer_tree_->device_scale_factor()); |
| 316 host_impl->SetDebugState(debug_state_); | 316 host_impl->SetDebugState(debug_state_); |
| 317 | 317 |
| 318 sync_tree->set_ui_resource_request_queue( | 318 sync_tree->set_ui_resource_request_queue( |
| 319 ui_resource_manager_->TakeUIResourcesRequests()); | 319 ui_resource_manager_->TakeUIResourcesRequests()); |
| 320 | 320 |
| 321 { | 321 { |
| 322 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); | 322 TRACE_EVENT0("cc", "LayerTreeHostInProcess::PushProperties"); |
| (...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 ->Add(timer.Elapsed().InMicroseconds()); | 581 ->Add(timer.Elapsed().InMicroseconds()); |
| 582 } | 582 } |
| 583 | 583 |
| 584 return result || next_commit_forces_redraw_; | 584 return result || next_commit_forces_redraw_; |
| 585 } | 585 } |
| 586 | 586 |
| 587 void LayerTreeHost::DidCompletePageScaleAnimation() { | 587 void LayerTreeHost::DidCompletePageScaleAnimation() { |
| 588 did_complete_scale_animation_ = true; | 588 did_complete_scale_animation_ = true; |
| 589 } | 589 } |
| 590 | 590 |
| 591 void LayerTreeHost::RecordGpuRasterizationHistogram() { | 591 void LayerTreeHost::RecordGpuRasterizationHistogram( |
| 592 const LayerTreeHostImpl* host_impl) { |
| 592 // Gpu rasterization is only supported for Renderer compositors. | 593 // Gpu rasterization is only supported for Renderer compositors. |
| 593 // Checking for IsSingleThreaded() to exclude Browser compositors. | 594 // Checking for IsSingleThreaded() to exclude Browser compositors. |
| 594 if (gpu_rasterization_histogram_recorded_ || IsSingleThreaded()) | 595 if (gpu_rasterization_histogram_recorded_ || IsSingleThreaded()) |
| 595 return; | 596 return; |
| 596 | 597 |
| 598 bool gpu_rasterization_enabled = false; |
| 599 if (host_impl->compositor_frame_sink()) { |
| 600 ContextProvider* compositor_context_provider = |
| 601 host_impl->compositor_frame_sink()->context_provider(); |
| 602 if (compositor_context_provider) { |
| 603 gpu_rasterization_enabled = |
| 604 compositor_context_provider->ContextCapabilities().gpu_rasterization; |
| 605 } |
| 606 } |
| 607 |
| 597 // Record how widely gpu rasterization is enabled. | 608 // Record how widely gpu rasterization is enabled. |
| 598 // This number takes device/gpu whitelisting/backlisting into account. | 609 // This number takes device/gpu whitelisting/backlisting into account. |
| 599 // Note that we do not consider the forced gpu rasterization mode, which is | 610 // Note that we do not consider the forced gpu rasterization mode, which is |
| 600 // mostly used for debugging purposes. | 611 // mostly used for debugging purposes. |
| 601 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationEnabled", | 612 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationEnabled", |
| 602 settings_.gpu_rasterization_enabled); | 613 gpu_rasterization_enabled); |
| 603 if (settings_.gpu_rasterization_enabled) { | 614 if (gpu_rasterization_enabled) { |
| 604 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationTriggered", | 615 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationTriggered", |
| 605 has_gpu_rasterization_trigger_); | 616 has_gpu_rasterization_trigger_); |
| 606 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationSuitableContent", | 617 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationSuitableContent", |
| 607 content_is_suitable_for_gpu_rasterization_); | 618 content_is_suitable_for_gpu_rasterization_); |
| 608 // Record how many pages actually get gpu rasterization when enabled. | 619 // Record how many pages actually get gpu rasterization when enabled. |
| 609 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationUsed", | 620 UMA_HISTOGRAM_BOOLEAN("Renderer4.GpuRasterizationUsed", |
| 610 (has_gpu_rasterization_trigger_ && | 621 (has_gpu_rasterization_trigger_ && |
| 611 content_is_suitable_for_gpu_rasterization_)); | 622 content_is_suitable_for_gpu_rasterization_)); |
| 612 } | 623 } |
| 613 | 624 |
| (...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 return compositor_mode_ == CompositorMode::SINGLE_THREADED; | 817 return compositor_mode_ == CompositorMode::SINGLE_THREADED; |
| 807 } | 818 } |
| 808 | 819 |
| 809 bool LayerTreeHost::IsThreaded() const { | 820 bool LayerTreeHost::IsThreaded() const { |
| 810 DCHECK(compositor_mode_ != CompositorMode::THREADED || | 821 DCHECK(compositor_mode_ != CompositorMode::THREADED || |
| 811 task_runner_provider_->HasImplThread()); | 822 task_runner_provider_->HasImplThread()); |
| 812 return compositor_mode_ == CompositorMode::THREADED; | 823 return compositor_mode_ == CompositorMode::THREADED; |
| 813 } | 824 } |
| 814 | 825 |
| 815 } // namespace cc | 826 } // namespace cc |
| OLD | NEW |