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 #include <utility> |
10 | 11 |
11 #include "base/atomic_sequence_num.h" | 12 #include "base/atomic_sequence_num.h" |
12 #include "base/bind.h" | 13 #include "base/bind.h" |
13 #include "base/command_line.h" | 14 #include "base/command_line.h" |
14 #include "base/debug/trace_event.h" | 15 #include "base/debug/trace_event.h" |
15 #include "base/debug/trace_event_argument.h" | 16 #include "base/debug/trace_event_argument.h" |
16 #include "base/message_loop/message_loop.h" | 17 #include "base/message_loop/message_loop.h" |
17 #include "base/metrics/histogram.h" | 18 #include "base/metrics/histogram.h" |
18 #include "base/stl_util.h" | 19 #include "base/stl_util.h" |
19 #include "base/strings/string_number_conversions.h" | 20 #include "base/strings/string_number_conversions.h" |
(...skipping 13 matching lines...) Expand all Loading... |
33 #include "cc/resources/prioritized_resource_manager.h" | 34 #include "cc/resources/prioritized_resource_manager.h" |
34 #include "cc/resources/ui_resource_request.h" | 35 #include "cc/resources/ui_resource_request.h" |
35 #include "cc/trees/layer_tree_host_client.h" | 36 #include "cc/trees/layer_tree_host_client.h" |
36 #include "cc/trees/layer_tree_host_common.h" | 37 #include "cc/trees/layer_tree_host_common.h" |
37 #include "cc/trees/layer_tree_host_impl.h" | 38 #include "cc/trees/layer_tree_host_impl.h" |
38 #include "cc/trees/layer_tree_impl.h" | 39 #include "cc/trees/layer_tree_impl.h" |
39 #include "cc/trees/occlusion_tracker.h" | 40 #include "cc/trees/occlusion_tracker.h" |
40 #include "cc/trees/single_thread_proxy.h" | 41 #include "cc/trees/single_thread_proxy.h" |
41 #include "cc/trees/thread_proxy.h" | 42 #include "cc/trees/thread_proxy.h" |
42 #include "cc/trees/tree_synchronizer.h" | 43 #include "cc/trees/tree_synchronizer.h" |
| 44 #include "ui/gfx/frame_time.h" |
43 #include "ui/gfx/size_conversions.h" | 45 #include "ui/gfx/size_conversions.h" |
44 | 46 |
45 namespace { | 47 namespace { |
46 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number; | 48 static base::StaticAtomicSequenceNumber s_layer_tree_host_sequence_number; |
47 } | 49 } |
48 | 50 |
49 namespace cc { | 51 namespace cc { |
50 | 52 |
51 RendererCapabilities::RendererCapabilities(ResourceFormat best_texture_format, | 53 RendererCapabilities::RendererCapabilities(ResourceFormat best_texture_format, |
52 bool allow_partial_texture_updates, | 54 bool allow_partial_texture_updates, |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1046 // This means that once the layer-tree becomes unsuitable for gpu | 1048 // This means that once the layer-tree becomes unsuitable for gpu |
1047 // rasterization due to some content, it will continue to be unsuitable | 1049 // rasterization due to some content, it will continue to be unsuitable |
1048 // even if that content is replaced by gpu-friendly content. | 1050 // even if that content is replaced by gpu-friendly content. |
1049 // This is to avoid switching back-and-forth between gpu and sw | 1051 // This is to avoid switching back-and-forth between gpu and sw |
1050 // rasterization which may be both bad for performance and visually | 1052 // rasterization which may be both bad for performance and visually |
1051 // jarring. | 1053 // jarring. |
1052 content_is_suitable_for_gpu_rasterization_ &= | 1054 content_is_suitable_for_gpu_rasterization_ &= |
1053 it->IsSuitableForGpuRasterization(); | 1055 it->IsSuitableForGpuRasterization(); |
1054 } | 1056 } |
1055 | 1057 |
| 1058 if (*did_paint_content && it->smoothness_timing_requests().size()) { |
| 1059 const std::vector<std::pair<int64_t, gfx::Rect> >& vec = |
| 1060 it->smoothness_timing_requests(); |
| 1061 std::pair<int, base::TimeTicks> timestamp(source_frame_number(), |
| 1062 gfx::FrameTime::Now()); |
| 1063 for (size_t i = 0; i < vec.size(); ++i) { |
| 1064 client_->RecordCommitTiming(vec[i].first, timestamp); |
| 1065 } |
| 1066 } |
| 1067 |
1056 occlusion_tracker.LeaveLayer(it); | 1068 occlusion_tracker.LeaveLayer(it); |
1057 } | 1069 } |
1058 | 1070 |
1059 in_paint_layer_contents_ = false; | 1071 in_paint_layer_contents_ = false; |
1060 } | 1072 } |
1061 | 1073 |
1062 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { | 1074 void LayerTreeHost::ApplyScrollAndScale(ScrollAndScaleSet* info) { |
1063 if (!root_layer_.get()) | 1075 if (!root_layer_.get()) |
1064 return; | 1076 return; |
1065 | 1077 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1113 } | 1125 } |
1114 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); | 1126 ApplyPageScaleDeltaFromImplSide(info->page_scale_delta); |
1115 | 1127 |
1116 client_->ApplyViewportDeltas( | 1128 client_->ApplyViewportDeltas( |
1117 inner_viewport_scroll_delta + outer_viewport_scroll_delta, | 1129 inner_viewport_scroll_delta + outer_viewport_scroll_delta, |
1118 info->page_scale_delta, | 1130 info->page_scale_delta, |
1119 info->top_controls_delta); | 1131 info->top_controls_delta); |
1120 } | 1132 } |
1121 } | 1133 } |
1122 | 1134 |
| 1135 void LayerTreeHost::RecordCompositeTiming(const CompositeTimingSet& info) { |
| 1136 if (!root_layer_.get()) |
| 1137 return; |
| 1138 |
| 1139 for (size_t i = 0; i < info.composites.size(); ++i) { |
| 1140 client_->RecordCompositeTiming(info.composites[i].rect_id, |
| 1141 info.composites[i].timestamps); |
| 1142 } |
| 1143 } |
| 1144 |
1123 void LayerTreeHost::StartRateLimiter() { | 1145 void LayerTreeHost::StartRateLimiter() { |
1124 if (inside_begin_main_frame_) | 1146 if (inside_begin_main_frame_) |
1125 return; | 1147 return; |
1126 | 1148 |
1127 if (!rate_limit_timer_.IsRunning()) { | 1149 if (!rate_limit_timer_.IsRunning()) { |
1128 rate_limit_timer_.Start(FROM_HERE, | 1150 rate_limit_timer_.Start(FROM_HERE, |
1129 base::TimeDelta(), | 1151 base::TimeDelta(), |
1130 this, | 1152 this, |
1131 &LayerTreeHost::RateLimit); | 1153 &LayerTreeHost::RateLimit); |
1132 } | 1154 } |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1324 swap_promise_list_.push_back(swap_promise.Pass()); | 1346 swap_promise_list_.push_back(swap_promise.Pass()); |
1325 } | 1347 } |
1326 | 1348 |
1327 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { | 1349 void LayerTreeHost::BreakSwapPromises(SwapPromise::DidNotSwapReason reason) { |
1328 for (size_t i = 0; i < swap_promise_list_.size(); i++) | 1350 for (size_t i = 0; i < swap_promise_list_.size(); i++) |
1329 swap_promise_list_[i]->DidNotSwap(reason); | 1351 swap_promise_list_[i]->DidNotSwap(reason); |
1330 swap_promise_list_.clear(); | 1352 swap_promise_list_.clear(); |
1331 } | 1353 } |
1332 | 1354 |
1333 } // namespace cc | 1355 } // namespace cc |
OLD | NEW |