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_in_process.h" | 5 #include "cc/trees/layer_tree_host_in_process.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> |
| 11 #include <memory> | 11 #include <memory> |
| 12 #include <stack> | 12 #include <stack> |
| 13 #include <string> | 13 #include <string> |
| 14 #include <unordered_map> | 14 #include <unordered_map> |
| 15 | 15 |
| 16 #include "base/atomic_sequence_num.h" | 16 #include "base/atomic_sequence_num.h" |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/location.h" | 19 #include "base/location.h" |
| 20 #include "base/memory/ptr_util.h" | 20 #include "base/memory/ptr_util.h" |
| 21 #include "base/metrics/histogram_macros.h" | 21 #include "base/metrics/histogram_macros.h" |
| 22 #include "base/numerics/safe_math.h" | 22 #include "base/numerics/safe_math.h" |
| 23 #include "base/single_thread_task_runner.h" | 23 #include "base/single_thread_task_runner.h" |
| 24 #include "base/stl_util.h" | 24 #include "base/stl_util.h" |
| 25 #include "base/strings/string_number_conversions.h" | 25 #include "base/strings/string_number_conversions.h" |
| 26 #include "base/threading/thread_task_runner_handle.h" | 26 #include "base/threading/thread_task_runner_handle.h" |
| 27 #include "base/timer/elapsed_timer.h" | |
| 27 #include "base/trace_event/trace_event.h" | 28 #include "base/trace_event/trace_event.h" |
| 28 #include "base/trace_event/trace_event_argument.h" | 29 #include "base/trace_event/trace_event_argument.h" |
| 29 #include "cc/animation/animation_events.h" | 30 #include "cc/animation/animation_events.h" |
| 30 #include "cc/animation/animation_host.h" | 31 #include "cc/animation/animation_host.h" |
| 31 #include "cc/base/math_util.h" | 32 #include "cc/base/math_util.h" |
| 32 #include "cc/blimp/client_picture_cache.h" | 33 #include "cc/blimp/client_picture_cache.h" |
| 33 #include "cc/blimp/engine_picture_cache.h" | 34 #include "cc/blimp/engine_picture_cache.h" |
| 34 #include "cc/blimp/image_serialization_processor.h" | 35 #include "cc/blimp/image_serialization_processor.h" |
| 35 #include "cc/blimp/picture_data.h" | 36 #include "cc/blimp/picture_data.h" |
| 36 #include "cc/blimp/picture_data_conversions.h" | 37 #include "cc/blimp/picture_data_conversions.h" |
| (...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 712 DCHECK(!settings_.single_thread_proxy_scheduler); | 713 DCHECK(!settings_.single_thread_proxy_scheduler); |
| 713 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); | 714 SingleThreadProxy* proxy = static_cast<SingleThreadProxy*>(proxy_.get()); |
| 714 | 715 |
| 715 proxy->CompositeImmediately(frame_begin_time); | 716 proxy->CompositeImmediately(frame_begin_time); |
| 716 } | 717 } |
| 717 | 718 |
| 718 bool LayerTreeHostInProcess::UpdateLayers() { | 719 bool LayerTreeHostInProcess::UpdateLayers() { |
| 719 if (!layer_tree_->root_layer()) | 720 if (!layer_tree_->root_layer()) |
| 720 return false; | 721 return false; |
| 721 DCHECK(!layer_tree_->root_layer()->parent()); | 722 DCHECK(!layer_tree_->root_layer()->parent()); |
| 723 base::ElapsedTimer timer; | |
| 724 | |
| 722 bool result = DoUpdateLayers(layer_tree_->root_layer()); | 725 bool result = DoUpdateLayers(layer_tree_->root_layer()); |
| 723 micro_benchmark_controller_.DidUpdateLayers(); | 726 micro_benchmark_controller_.DidUpdateLayers(); |
| 727 | |
| 728 std::string histogram_name = base::StringPrintf( | |
| 729 "Compositing.Renderer.LayersUpdateTime.%" PRIuS, | |
| 730 std::min(static_cast<size_t>(400), layer_tree_->NumLayers()) / 50); | |
|
majidvp
2016/11/15 13:10:55
In the current patch I have a simple equal buckets
flackr
2016/11/16 16:56:50
You mean 50 wide?
majidvp
2016/12/02 20:03:31
Fair enough, I changed my bucketization to an expo
| |
| 731 base::Histogram::FactoryTimeGet( | |
| 732 histogram_name, base::TimeDelta::FromMilliseconds(1), | |
| 733 base::TimeDelta::FromSeconds(10), 50, | |
| 734 base::HistogramBase::kUmaTargetedHistogramFlag) | |
| 735 ->AddTime(timer.Elapsed()); | |
| 736 | |
| 724 return result || next_commit_forces_redraw_; | 737 return result || next_commit_forces_redraw_; |
| 725 } | 738 } |
| 726 | 739 |
| 727 void LayerTreeHostInProcess::DidCompletePageScaleAnimation() { | 740 void LayerTreeHostInProcess::DidCompletePageScaleAnimation() { |
| 728 did_complete_scale_animation_ = true; | 741 did_complete_scale_animation_ = true; |
| 729 } | 742 } |
| 730 | 743 |
| 731 void LayerTreeHostInProcess::RecordGpuRasterizationHistogram() { | 744 void LayerTreeHostInProcess::RecordGpuRasterizationHistogram() { |
| 732 // Gpu rasterization is only supported for Renderer compositors. | 745 // Gpu rasterization is only supported for Renderer compositors. |
| 733 // Checking for IsSingleThreaded() to exclude Browser compositors. | 746 // Checking for IsSingleThreaded() to exclude Browser compositors. |
| (...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1038 | 1051 |
| 1039 debug_state_.FromProtobuf(proto.debug_state()); | 1052 debug_state_.FromProtobuf(proto.debug_state()); |
| 1040 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); | 1053 has_gpu_rasterization_trigger_ = proto.has_gpu_rasterization_trigger(); |
| 1041 content_is_suitable_for_gpu_rasterization_ = | 1054 content_is_suitable_for_gpu_rasterization_ = |
| 1042 proto.content_is_suitable_for_gpu_rasterization(); | 1055 proto.content_is_suitable_for_gpu_rasterization(); |
| 1043 id_ = proto.id(); | 1056 id_ = proto.id(); |
| 1044 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); | 1057 next_commit_forces_redraw_ = proto.next_commit_forces_redraw(); |
| 1045 } | 1058 } |
| 1046 | 1059 |
| 1047 } // namespace cc | 1060 } // namespace cc |
| OLD | NEW |