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_impl.h" | 5 #include "cc/trees/layer_tree_host_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <limits> | 8 #include <limits> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "cc/base/math_util.h" | 22 #include "cc/base/math_util.h" |
23 #include "cc/base/util.h" | 23 #include "cc/base/util.h" |
24 #include "cc/debug/benchmark_instrumentation.h" | 24 #include "cc/debug/benchmark_instrumentation.h" |
25 #include "cc/debug/debug_rect_history.h" | 25 #include "cc/debug/debug_rect_history.h" |
26 #include "cc/debug/devtools_instrumentation.h" | 26 #include "cc/debug/devtools_instrumentation.h" |
27 #include "cc/debug/frame_rate_counter.h" | 27 #include "cc/debug/frame_rate_counter.h" |
28 #include "cc/debug/paint_time_counter.h" | 28 #include "cc/debug/paint_time_counter.h" |
29 #include "cc/debug/rendering_stats_instrumentation.h" | 29 #include "cc/debug/rendering_stats_instrumentation.h" |
30 #include "cc/debug/traced_value.h" | 30 #include "cc/debug/traced_value.h" |
31 #include "cc/input/page_scale_animation.h" | 31 #include "cc/input/page_scale_animation.h" |
| 32 #include "cc/input/scroll_elasticity_helper.h" |
32 #include "cc/input/top_controls_manager.h" | 33 #include "cc/input/top_controls_manager.h" |
33 #include "cc/layers/append_quads_data.h" | 34 #include "cc/layers/append_quads_data.h" |
34 #include "cc/layers/heads_up_display_layer_impl.h" | 35 #include "cc/layers/heads_up_display_layer_impl.h" |
35 #include "cc/layers/layer_impl.h" | 36 #include "cc/layers/layer_impl.h" |
36 #include "cc/layers/layer_iterator.h" | 37 #include "cc/layers/layer_iterator.h" |
37 #include "cc/layers/painted_scrollbar_layer_impl.h" | 38 #include "cc/layers/painted_scrollbar_layer_impl.h" |
38 #include "cc/layers/render_surface_impl.h" | 39 #include "cc/layers/render_surface_impl.h" |
39 #include "cc/layers/scrollbar_layer_impl_base.h" | 40 #include "cc/layers/scrollbar_layer_impl_base.h" |
40 #include "cc/output/compositor_frame_metadata.h" | 41 #include "cc/output/compositor_frame_metadata.h" |
41 #include "cc/output/copy_output_request.h" | 42 #include "cc/output/copy_output_request.h" |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return GL_TEXTURE_2D; | 167 return GL_TEXTURE_2D; |
167 } | 168 } |
168 | 169 |
169 size_t GetMaxStagingResourceCount() { | 170 size_t GetMaxStagingResourceCount() { |
170 // Upper bound for number of staging resource to allow. | 171 // Upper bound for number of staging resource to allow. |
171 return 32; | 172 return 32; |
172 } | 173 } |
173 | 174 |
174 } // namespace | 175 } // namespace |
175 | 176 |
176 class LayerTreeHostImplTimeSourceAdapter : public TimeSourceClient { | |
177 public: | |
178 static scoped_ptr<LayerTreeHostImplTimeSourceAdapter> Create( | |
179 LayerTreeHostImpl* layer_tree_host_impl, | |
180 scoped_refptr<DelayBasedTimeSource> time_source) { | |
181 return make_scoped_ptr( | |
182 new LayerTreeHostImplTimeSourceAdapter(layer_tree_host_impl, | |
183 time_source)); | |
184 } | |
185 ~LayerTreeHostImplTimeSourceAdapter() override { | |
186 time_source_->SetClient(NULL); | |
187 time_source_->SetActive(false); | |
188 } | |
189 | |
190 void OnTimerTick() override { | |
191 // In single threaded mode we attempt to simulate changing the current | |
192 // thread by maintaining a fake thread id. When we switch from one | |
193 // thread to another, we construct DebugScopedSetXXXThread objects that | |
194 // update the thread id. This lets DCHECKS that ensure we're on the | |
195 // right thread to work correctly in single threaded mode. The problem | |
196 // here is that the timer tasks are run via the message loop, and when | |
197 // they run, we've had no chance to construct a DebugScopedSetXXXThread | |
198 // object. The result is that we report that we're running on the main | |
199 // thread. In multi-threaded mode, this timer is run on the compositor | |
200 // thread, so to keep this consistent in single-threaded mode, we'll | |
201 // construct a DebugScopedSetImplThread object. There is no need to do | |
202 // this in multi-threaded mode since the real thread id's will be | |
203 // correct. In fact, setting fake thread id's interferes with the real | |
204 // thread id's and causes breakage. | |
205 scoped_ptr<DebugScopedSetImplThread> set_impl_thread; | |
206 if (!layer_tree_host_impl_->proxy()->HasImplThread()) { | |
207 set_impl_thread.reset( | |
208 new DebugScopedSetImplThread(layer_tree_host_impl_->proxy())); | |
209 } | |
210 | |
211 layer_tree_host_impl_->Animate( | |
212 layer_tree_host_impl_->CurrentBeginFrameArgs().frame_time); | |
213 layer_tree_host_impl_->UpdateBackgroundAnimateTicking(true); | |
214 bool start_ready_animations = true; | |
215 layer_tree_host_impl_->UpdateAnimationState(start_ready_animations); | |
216 | |
217 if (layer_tree_host_impl_->pending_tree()) { | |
218 layer_tree_host_impl_->pending_tree()->UpdateDrawProperties(); | |
219 layer_tree_host_impl_->ManageTiles(); | |
220 } | |
221 | |
222 layer_tree_host_impl_->ResetCurrentBeginFrameArgsForNextFrame(); | |
223 } | |
224 | |
225 void SetActive(bool active) { | |
226 if (active != time_source_->Active()) | |
227 time_source_->SetActive(active); | |
228 } | |
229 | |
230 bool Active() const { return time_source_->Active(); } | |
231 | |
232 private: | |
233 LayerTreeHostImplTimeSourceAdapter( | |
234 LayerTreeHostImpl* layer_tree_host_impl, | |
235 scoped_refptr<DelayBasedTimeSource> time_source) | |
236 : layer_tree_host_impl_(layer_tree_host_impl), | |
237 time_source_(time_source) { | |
238 time_source_->SetClient(this); | |
239 } | |
240 | |
241 LayerTreeHostImpl* layer_tree_host_impl_; | |
242 scoped_refptr<DelayBasedTimeSource> time_source_; | |
243 | |
244 DISALLOW_COPY_AND_ASSIGN(LayerTreeHostImplTimeSourceAdapter); | |
245 }; | |
246 | |
247 LayerTreeHostImpl::FrameData::FrameData() | 177 LayerTreeHostImpl::FrameData::FrameData() |
248 : contains_incomplete_tile(false), has_no_damage(false) {} | 178 : contains_incomplete_tile(false), has_no_damage(false) {} |
249 | 179 |
250 LayerTreeHostImpl::FrameData::~FrameData() {} | 180 LayerTreeHostImpl::FrameData::~FrameData() {} |
251 | 181 |
252 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 182 scoped_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
253 const LayerTreeSettings& settings, | 183 const LayerTreeSettings& settings, |
254 LayerTreeHostImplClient* client, | 184 LayerTreeHostImplClient* client, |
255 Proxy* proxy, | 185 Proxy* proxy, |
256 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 186 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
(...skipping 10 matching lines...) Expand all Loading... |
267 } | 197 } |
268 | 198 |
269 LayerTreeHostImpl::LayerTreeHostImpl( | 199 LayerTreeHostImpl::LayerTreeHostImpl( |
270 const LayerTreeSettings& settings, | 200 const LayerTreeSettings& settings, |
271 LayerTreeHostImplClient* client, | 201 LayerTreeHostImplClient* client, |
272 Proxy* proxy, | 202 Proxy* proxy, |
273 RenderingStatsInstrumentation* rendering_stats_instrumentation, | 203 RenderingStatsInstrumentation* rendering_stats_instrumentation, |
274 SharedBitmapManager* shared_bitmap_manager, | 204 SharedBitmapManager* shared_bitmap_manager, |
275 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, | 205 gpu::GpuMemoryBufferManager* gpu_memory_buffer_manager, |
276 int id) | 206 int id) |
277 : BeginFrameSourceMixIn(), | 207 : client_(client), |
278 client_(client), | |
279 proxy_(proxy), | 208 proxy_(proxy), |
280 use_gpu_rasterization_(false), | 209 use_gpu_rasterization_(false), |
281 input_handler_client_(NULL), | 210 input_handler_client_(NULL), |
282 did_lock_scrolling_layer_(false), | 211 did_lock_scrolling_layer_(false), |
283 should_bubble_scrolls_(false), | 212 should_bubble_scrolls_(false), |
284 wheel_scrolling_(false), | 213 wheel_scrolling_(false), |
285 scroll_affects_scroll_handler_(false), | 214 scroll_affects_scroll_handler_(false), |
286 scroll_layer_id_when_mouse_over_scrollbar_(0), | 215 scroll_layer_id_when_mouse_over_scrollbar_(0), |
287 tile_priorities_dirty_(false), | 216 tile_priorities_dirty_(false), |
288 root_layer_scroll_offset_delegate_(NULL), | 217 root_layer_scroll_offset_delegate_(NULL), |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 LayerTreeHostImpl::~LayerTreeHostImpl() { | 274 LayerTreeHostImpl::~LayerTreeHostImpl() { |
346 DCHECK(proxy_->IsImplThread()); | 275 DCHECK(proxy_->IsImplThread()); |
347 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); | 276 TRACE_EVENT0("cc", "LayerTreeHostImpl::~LayerTreeHostImpl()"); |
348 TRACE_EVENT_OBJECT_DELETED_WITH_ID( | 277 TRACE_EVENT_OBJECT_DELETED_WITH_ID( |
349 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); | 278 TRACE_DISABLED_BY_DEFAULT("cc.debug"), "cc::LayerTreeHostImpl", id_); |
350 | 279 |
351 if (input_handler_client_) { | 280 if (input_handler_client_) { |
352 input_handler_client_->WillShutdown(); | 281 input_handler_client_->WillShutdown(); |
353 input_handler_client_ = NULL; | 282 input_handler_client_ = NULL; |
354 } | 283 } |
| 284 if (scroll_elasticity_helper_) |
| 285 scroll_elasticity_helper_.reset(); |
355 | 286 |
356 // The layer trees must be destroyed before the layer tree host. We've | 287 // The layer trees must be destroyed before the layer tree host. We've |
357 // made a contract with our animation controllers that the registrar | 288 // made a contract with our animation controllers that the registrar |
358 // will outlive them, and we must make good. | 289 // will outlive them, and we must make good. |
359 if (recycle_tree_) | 290 if (recycle_tree_) |
360 recycle_tree_->Shutdown(); | 291 recycle_tree_->Shutdown(); |
361 if (pending_tree_) | 292 if (pending_tree_) |
362 pending_tree_->Shutdown(); | 293 pending_tree_->Shutdown(); |
363 active_tree_->Shutdown(); | 294 active_tree_->Shutdown(); |
364 recycle_tree_ = nullptr; | 295 recycle_tree_ = nullptr; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 return layer_impl != NULL; | 445 return layer_impl != NULL; |
515 } | 446 } |
516 | 447 |
517 scoped_ptr<SwapPromiseMonitor> | 448 scoped_ptr<SwapPromiseMonitor> |
518 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( | 449 LayerTreeHostImpl::CreateLatencyInfoSwapPromiseMonitor( |
519 ui::LatencyInfo* latency) { | 450 ui::LatencyInfo* latency) { |
520 return make_scoped_ptr( | 451 return make_scoped_ptr( |
521 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); | 452 new LatencyInfoSwapPromiseMonitor(latency, NULL, this)); |
522 } | 453 } |
523 | 454 |
| 455 ScrollElasticityHelper* LayerTreeHostImpl::CreateScrollElasticityHelper() { |
| 456 DCHECK(!scroll_elasticity_helper_); |
| 457 scroll_elasticity_helper_.reset(new ScrollElasticityHelper(this)); |
| 458 return scroll_elasticity_helper_.get(); |
| 459 } |
| 460 |
524 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( | 461 void LayerTreeHostImpl::QueueSwapPromiseForMainThreadScrollUpdate( |
525 scoped_ptr<SwapPromise> swap_promise) { | 462 scoped_ptr<SwapPromise> swap_promise) { |
526 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); | 463 swap_promises_for_main_thread_scroll_update_.push_back(swap_promise.Pass()); |
527 } | 464 } |
528 | 465 |
529 void LayerTreeHostImpl::TrackDamageForAllSurfaces( | 466 void LayerTreeHostImpl::TrackDamageForAllSurfaces( |
530 LayerImpl* root_draw_layer, | 467 LayerImpl* root_draw_layer, |
531 const LayerImplList& render_surface_layer_list) { | 468 const LayerImplList& render_surface_layer_list) { |
532 // For now, we use damage tracking to compute a global scissor. To do this, we | 469 // For now, we use damage tracking to compute a global scissor. To do this, we |
533 // must compute all damage tracking before drawing anything, so that we know | 470 // must compute all damage tracking before drawing anything, so that we know |
(...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
967 << frame->render_passes.size(); | 904 << frame->render_passes.size(); |
968 | 905 |
969 return draw_result; | 906 return draw_result; |
970 } | 907 } |
971 | 908 |
972 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { | 909 void LayerTreeHostImpl::MainThreadHasStoppedFlinging() { |
973 if (input_handler_client_) | 910 if (input_handler_client_) |
974 input_handler_client_->MainThreadHasStoppedFlinging(); | 911 input_handler_client_->MainThreadHasStoppedFlinging(); |
975 } | 912 } |
976 | 913 |
977 void LayerTreeHostImpl::UpdateBackgroundAnimateTicking( | |
978 bool should_background_tick) { | |
979 DCHECK(proxy_->IsImplThread()); | |
980 if (should_background_tick) | |
981 DCHECK(active_tree_->root_layer()); | |
982 | |
983 bool enabled = should_background_tick && needs_animate_layers(); | |
984 | |
985 // Lazily create the time_source adapter so that we can vary the interval for | |
986 // testing. | |
987 if (!time_source_client_adapter_) { | |
988 time_source_client_adapter_ = LayerTreeHostImplTimeSourceAdapter::Create( | |
989 this, | |
990 DelayBasedTimeSource::Create( | |
991 LowFrequencyAnimationInterval(), | |
992 proxy_->HasImplThread() ? proxy_->ImplThreadTaskRunner() | |
993 : proxy_->MainThreadTaskRunner())); | |
994 } | |
995 | |
996 time_source_client_adapter_->SetActive(enabled); | |
997 } | |
998 | |
999 void LayerTreeHostImpl::DidAnimateScrollOffset() { | 914 void LayerTreeHostImpl::DidAnimateScrollOffset() { |
1000 client_->SetNeedsCommitOnImplThread(); | 915 client_->SetNeedsCommitOnImplThread(); |
1001 client_->RenewTreePriority(); | 916 client_->RenewTreePriority(); |
1002 } | 917 } |
1003 | 918 |
1004 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { | 919 void LayerTreeHostImpl::SetViewportDamage(const gfx::Rect& damage_rect) { |
1005 viewport_damage_rect_.Union(damage_rect); | 920 viewport_damage_rect_.Union(damage_rect); |
1006 } | 921 } |
1007 | 922 |
1008 static inline RenderPass* FindRenderPassById( | 923 static inline RenderPass* FindRenderPassById( |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1264 tile_priorities_dirty_ = true; | 1179 tile_priorities_dirty_ = true; |
1265 client_->SetNeedsManageTilesOnImplThread(); | 1180 client_->SetNeedsManageTilesOnImplThread(); |
1266 } | 1181 } |
1267 | 1182 |
1268 void LayerTreeHostImpl::DidInitializeVisibleTile() { | 1183 void LayerTreeHostImpl::DidInitializeVisibleTile() { |
1269 if (client_ && !client_->IsInsideDraw()) | 1184 if (client_ && !client_->IsInsideDraw()) |
1270 client_->DidInitializeVisibleTileOnImplThread(); | 1185 client_->DidInitializeVisibleTileOnImplThread(); |
1271 } | 1186 } |
1272 | 1187 |
1273 void LayerTreeHostImpl::GetPictureLayerImplPairs( | 1188 void LayerTreeHostImpl::GetPictureLayerImplPairs( |
1274 std::vector<PictureLayerImpl::Pair>* layer_pairs) const { | 1189 std::vector<PictureLayerImpl::Pair>* layer_pairs, |
| 1190 bool need_valid_tile_priorities) const { |
1275 DCHECK(layer_pairs->empty()); | 1191 DCHECK(layer_pairs->empty()); |
1276 for (std::vector<PictureLayerImpl*>::const_iterator it = | 1192 for (std::vector<PictureLayerImpl*>::const_iterator it = |
1277 picture_layers_.begin(); | 1193 picture_layers_.begin(); |
1278 it != picture_layers_.end(); | 1194 it != picture_layers_.end(); |
1279 ++it) { | 1195 ++it) { |
1280 PictureLayerImpl* layer = *it; | 1196 PictureLayerImpl* layer = *it; |
1281 | 1197 |
1282 // TODO(vmpstr): Iterators and should handle this instead. crbug.com/381704 | 1198 if (!layer->IsOnActiveOrPendingTree() || |
1283 if (!layer->HasValidTilePriorities()) | 1199 (need_valid_tile_priorities && !layer->HasValidTilePriorities())) |
1284 continue; | 1200 continue; |
1285 | 1201 |
1286 PictureLayerImpl* twin_layer = layer->GetPendingOrActiveTwinLayer(); | 1202 PictureLayerImpl* twin_layer = layer->GetPendingOrActiveTwinLayer(); |
1287 | 1203 |
1288 // Ignore the twin layer when tile priorities are invalid. | 1204 // Ignore the twin layer when tile priorities are invalid. |
1289 // TODO(vmpstr): Iterators should handle this instead. crbug.com/381704 | 1205 if (need_valid_tile_priorities && twin_layer && |
1290 if (twin_layer && !twin_layer->HasValidTilePriorities()) | 1206 !twin_layer->HasValidTilePriorities()) |
1291 twin_layer = NULL; | 1207 twin_layer = NULL; |
1292 | 1208 |
1293 // If the current tree is ACTIVE_TREE, then always generate a layer_pair. | 1209 // If the current tree is ACTIVE_TREE, then always generate a layer_pair. |
1294 // If current tree is PENDING_TREE, then only generate a layer_pair if | 1210 // If current tree is PENDING_TREE, then only generate a layer_pair if |
1295 // there is no twin layer. | 1211 // there is no twin layer. |
1296 if (layer->GetTree() == ACTIVE_TREE) { | 1212 if (layer->GetTree() == ACTIVE_TREE) { |
1297 DCHECK(!twin_layer || twin_layer->GetTree() == PENDING_TREE); | 1213 DCHECK_IMPLIES(twin_layer, twin_layer->GetTree() == PENDING_TREE); |
1298 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); | 1214 layer_pairs->push_back(PictureLayerImpl::Pair(layer, twin_layer)); |
1299 } else if (!twin_layer) { | 1215 } else if (!twin_layer) { |
| 1216 DCHECK(layer->GetTree() == PENDING_TREE); |
1300 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); | 1217 layer_pairs->push_back(PictureLayerImpl::Pair(NULL, layer)); |
1301 } | 1218 } |
1302 } | 1219 } |
1303 } | 1220 } |
1304 | 1221 |
1305 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, | 1222 void LayerTreeHostImpl::BuildRasterQueue(RasterTilePriorityQueue* queue, |
1306 TreePriority tree_priority) { | 1223 TreePriority tree_priority) { |
1307 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); | 1224 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildRasterQueue"); |
1308 picture_layer_pairs_.clear(); | 1225 picture_layer_pairs_.clear(); |
1309 GetPictureLayerImplPairs(&picture_layer_pairs_); | 1226 GetPictureLayerImplPairs(&picture_layer_pairs_, true); |
1310 queue->Build(picture_layer_pairs_, tree_priority); | 1227 queue->Build(picture_layer_pairs_, tree_priority); |
1311 } | 1228 } |
1312 | 1229 |
1313 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, | 1230 void LayerTreeHostImpl::BuildEvictionQueue(EvictionTilePriorityQueue* queue, |
1314 TreePriority tree_priority) { | 1231 TreePriority tree_priority) { |
1315 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); | 1232 TRACE_EVENT0("cc", "LayerTreeHostImpl::BuildEvictionQueue"); |
1316 picture_layer_pairs_.clear(); | 1233 picture_layer_pairs_.clear(); |
1317 GetPictureLayerImplPairs(&picture_layer_pairs_); | 1234 GetPictureLayerImplPairs(&picture_layer_pairs_, false); |
1318 queue->Build(picture_layer_pairs_, tree_priority); | 1235 queue->Build(picture_layer_pairs_, tree_priority); |
1319 } | 1236 } |
1320 | 1237 |
1321 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() | 1238 const std::vector<PictureLayerImpl*>& LayerTreeHostImpl::GetPictureLayers() |
1322 const { | 1239 const { |
1323 return picture_layers_; | 1240 return picture_layers_; |
1324 } | 1241 } |
1325 | 1242 |
1326 void LayerTreeHostImpl::NotifyReadyToActivate() { | 1243 void LayerTreeHostImpl::NotifyReadyToActivate() { |
1327 client_->NotifyReadyToActivate(); | 1244 client_->NotifyReadyToActivate(); |
1328 } | 1245 } |
1329 | 1246 |
| 1247 void LayerTreeHostImpl::NotifyReadyToDraw() { |
| 1248 client_->NotifyReadyToDraw(); |
| 1249 } |
| 1250 |
1330 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { | 1251 void LayerTreeHostImpl::NotifyTileStateChanged(const Tile* tile) { |
1331 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged"); | 1252 TRACE_EVENT0("cc", "LayerTreeHostImpl::NotifyTileStateChanged"); |
1332 | 1253 |
1333 if (active_tree_) { | 1254 if (active_tree_) { |
1334 LayerImpl* layer_impl = | 1255 LayerImpl* layer_impl = |
1335 active_tree_->FindActiveTreeLayerById(tile->layer_id()); | 1256 active_tree_->FindActiveTreeLayerById(tile->layer_id()); |
1336 if (layer_impl) | 1257 if (layer_impl) |
1337 layer_impl->NotifyTileStateChanged(tile); | 1258 layer_impl->NotifyTileStateChanged(tile); |
1338 } | 1259 } |
1339 | 1260 |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1430 resourceless_software_draw_ = resourceless_software_draw; | 1351 resourceless_software_draw_ = resourceless_software_draw; |
1431 } | 1352 } |
1432 | 1353 |
1433 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { | 1354 void LayerTreeHostImpl::SetNeedsRedrawRect(const gfx::Rect& damage_rect) { |
1434 if (damage_rect.IsEmpty()) | 1355 if (damage_rect.IsEmpty()) |
1435 return; | 1356 return; |
1436 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); | 1357 NotifySwapPromiseMonitorsOfSetNeedsRedraw(); |
1437 client_->SetNeedsRedrawRectOnImplThread(damage_rect); | 1358 client_->SetNeedsRedrawRectOnImplThread(damage_rect); |
1438 } | 1359 } |
1439 | 1360 |
1440 void LayerTreeHostImpl::BeginFrame(const BeginFrameArgs& args) { | |
1441 CallOnBeginFrame(args); | |
1442 } | |
1443 | |
1444 void LayerTreeHostImpl::DidSwapBuffers() { | 1361 void LayerTreeHostImpl::DidSwapBuffers() { |
1445 client_->DidSwapBuffersOnImplThread(); | 1362 client_->DidSwapBuffersOnImplThread(); |
1446 } | 1363 } |
1447 | 1364 |
1448 void LayerTreeHostImpl::DidSwapBuffersComplete() { | 1365 void LayerTreeHostImpl::DidSwapBuffersComplete() { |
1449 client_->DidSwapBuffersCompleteOnImplThread(); | 1366 client_->DidSwapBuffersCompleteOnImplThread(); |
1450 } | 1367 } |
1451 | 1368 |
1452 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { | 1369 void LayerTreeHostImpl::ReclaimResources(const CompositorFrameAck* ack) { |
1453 // TODO(piman): We may need to do some validation on this ack before | 1370 // TODO(piman): We may need to do some validation on this ack before |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1536 active_tree_->hud_layer(), | 1453 active_tree_->hud_layer(), |
1537 *frame->render_surface_layer_list, | 1454 *frame->render_surface_layer_list, |
1538 frame->occluding_screen_space_rects, | 1455 frame->occluding_screen_space_rects, |
1539 frame->non_occluding_screen_space_rects, | 1456 frame->non_occluding_screen_space_rects, |
1540 debug_state_); | 1457 debug_state_); |
1541 } | 1458 } |
1542 | 1459 |
1543 if (!settings_.impl_side_painting && debug_state_.continuous_painting) { | 1460 if (!settings_.impl_side_painting && debug_state_.continuous_painting) { |
1544 const RenderingStats& stats = | 1461 const RenderingStats& stats = |
1545 rendering_stats_instrumentation_->GetRenderingStats(); | 1462 rendering_stats_instrumentation_->GetRenderingStats(); |
1546 paint_time_counter_->SavePaintTime(stats.main_stats.paint_time); | 1463 paint_time_counter_->SavePaintTime( |
| 1464 stats.begin_main_frame_to_commit_duration.GetLastTimeDelta()); |
1547 } | 1465 } |
1548 | 1466 |
1549 bool is_new_trace; | 1467 bool is_new_trace; |
1550 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); | 1468 TRACE_EVENT_IS_NEW_TRACE(&is_new_trace); |
1551 if (is_new_trace) { | 1469 if (is_new_trace) { |
1552 if (pending_tree_) { | 1470 if (pending_tree_) { |
1553 LayerTreeHostCommon::CallFunctionForSubtree( | 1471 LayerTreeHostCommon::CallFunctionForSubtree( |
1554 pending_tree_->root_layer(), | 1472 pending_tree_->root_layer(), |
1555 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); | 1473 base::Bind(&LayerTreeHostImplDidBeginTracingCallback)); |
1556 } | 1474 } |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1671 TRACE_EVENT_FLOW_STEP0( | 1589 TRACE_EVENT_FLOW_STEP0( |
1672 "input", | 1590 "input", |
1673 "LatencyInfo.Flow", | 1591 "LatencyInfo.Flow", |
1674 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), | 1592 TRACE_ID_DONT_MANGLE(metadata.latency_info[i].trace_id), |
1675 "SwapBuffers"); | 1593 "SwapBuffers"); |
1676 } | 1594 } |
1677 renderer_->SwapBuffers(metadata); | 1595 renderer_->SwapBuffers(metadata); |
1678 return true; | 1596 return true; |
1679 } | 1597 } |
1680 | 1598 |
1681 void LayerTreeHostImpl::OnNeedsBeginFramesChange(bool enable) { | |
1682 if (output_surface_) | |
1683 output_surface_->SetNeedsBeginFrame(enable); | |
1684 else | |
1685 DCHECK(!enable); | |
1686 } | |
1687 | |
1688 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { | 1599 void LayerTreeHostImpl::WillBeginImplFrame(const BeginFrameArgs& args) { |
1689 // Sample the frame time now. This time will be used for updating animations | 1600 // Sample the frame time now. This time will be used for updating animations |
1690 // when we draw. | 1601 // when we draw. |
1691 UpdateCurrentBeginFrameArgs(args); | 1602 UpdateCurrentBeginFrameArgs(args); |
1692 // Cache the begin impl frame interval | 1603 // Cache the begin impl frame interval |
1693 begin_impl_frame_interval_ = args.interval; | 1604 begin_impl_frame_interval_ = args.interval; |
1694 } | 1605 } |
1695 | 1606 |
1696 void LayerTreeHostImpl::UpdateViewportContainerSizes() { | 1607 void LayerTreeHostImpl::UpdateViewportContainerSizes() { |
1697 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); | 1608 LayerImpl* inner_container = active_tree_->InnerViewportContainerLayer(); |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1876 client_->DidActivateSyncTree(); | 1787 client_->DidActivateSyncTree(); |
1877 if (!tree_activation_callback_.is_null()) | 1788 if (!tree_activation_callback_.is_null()) |
1878 tree_activation_callback_.Run(); | 1789 tree_activation_callback_.Run(); |
1879 | 1790 |
1880 if (debug_state_.continuous_painting) { | 1791 if (debug_state_.continuous_painting) { |
1881 const RenderingStats& stats = | 1792 const RenderingStats& stats = |
1882 rendering_stats_instrumentation_->GetRenderingStats(); | 1793 rendering_stats_instrumentation_->GetRenderingStats(); |
1883 // TODO(hendrikw): This requires a different metric when we commit directly | 1794 // TODO(hendrikw): This requires a different metric when we commit directly |
1884 // to the active tree. See crbug.com/429311. | 1795 // to the active tree. See crbug.com/429311. |
1885 paint_time_counter_->SavePaintTime( | 1796 paint_time_counter_->SavePaintTime( |
1886 stats.impl_stats.commit_to_activate_duration.GetLastTimeDelta() + | 1797 stats.commit_to_activate_duration.GetLastTimeDelta() + |
1887 stats.impl_stats.draw_duration.GetLastTimeDelta()); | 1798 stats.draw_duration.GetLastTimeDelta()); |
1888 } | 1799 } |
1889 | 1800 |
1890 if (time_source_client_adapter_ && time_source_client_adapter_->Active()) | |
1891 DCHECK(active_tree_->root_layer()); | |
1892 | |
1893 scoped_ptr<PageScaleAnimation> page_scale_animation = | 1801 scoped_ptr<PageScaleAnimation> page_scale_animation = |
1894 active_tree_->TakePageScaleAnimation(); | 1802 active_tree_->TakePageScaleAnimation(); |
1895 if (page_scale_animation) { | 1803 if (page_scale_animation) { |
1896 page_scale_animation_ = page_scale_animation.Pass(); | 1804 page_scale_animation_ = page_scale_animation.Pass(); |
1897 SetNeedsAnimate(); | 1805 SetNeedsAnimate(); |
1898 client_->SetNeedsCommitOnImplThread(); | 1806 client_->SetNeedsCommitOnImplThread(); |
1899 client_->RenewTreePriority(); | 1807 client_->RenewTreePriority(); |
1900 } | 1808 } |
1901 } | 1809 } |
1902 | 1810 |
(...skipping 285 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2188 CreateAndSetTileManager(); | 2096 CreateAndSetTileManager(); |
2189 | 2097 |
2190 // Initialize vsync parameters to sane values. | 2098 // Initialize vsync parameters to sane values. |
2191 const base::TimeDelta display_refresh_interval = | 2099 const base::TimeDelta display_refresh_interval = |
2192 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / | 2100 base::TimeDelta::FromMicroseconds(base::Time::kMicrosecondsPerSecond / |
2193 settings_.refresh_rate); | 2101 settings_.refresh_rate); |
2194 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval); | 2102 CommitVSyncParameters(base::TimeTicks(), display_refresh_interval); |
2195 | 2103 |
2196 // TODO(brianderson): Don't use a hard-coded parent draw time. | 2104 // TODO(brianderson): Don't use a hard-coded parent draw time. |
2197 base::TimeDelta parent_draw_time = | 2105 base::TimeDelta parent_draw_time = |
2198 (!settings_.begin_frame_scheduling_enabled && | 2106 (!settings_.use_external_begin_frame_source && |
2199 output_surface_->capabilities().adjust_deadline_for_parent) | 2107 output_surface_->capabilities().adjust_deadline_for_parent) |
2200 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() | 2108 ? BeginFrameArgs::DefaultEstimatedParentDrawTime() |
2201 : base::TimeDelta(); | 2109 : base::TimeDelta(); |
2202 client_->SetEstimatedParentDrawTime(parent_draw_time); | 2110 client_->SetEstimatedParentDrawTime(parent_draw_time); |
2203 | 2111 |
2204 int max_frames_pending = output_surface_->capabilities().max_frames_pending; | 2112 int max_frames_pending = output_surface_->capabilities().max_frames_pending; |
2205 if (max_frames_pending <= 0) | 2113 if (max_frames_pending <= 0) |
2206 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; | 2114 max_frames_pending = OutputSurface::DEFAULT_MAX_FRAMES_PENDING; |
2207 client_->SetMaxSwapsPendingOnImplThread(max_frames_pending); | 2115 client_->SetMaxSwapsPendingOnImplThread(max_frames_pending); |
2208 client_->OnCanDrawStateChanged(CanDraw()); | 2116 client_->OnCanDrawStateChanged(CanDraw()); |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2465 return ScrollIgnored; | 2373 return ScrollIgnored; |
2466 | 2374 |
2467 ScrollOffsetAnimationCurve* curve = | 2375 ScrollOffsetAnimationCurve* curve = |
2468 animation->curve()->ToScrollOffsetAnimationCurve(); | 2376 animation->curve()->ToScrollOffsetAnimationCurve(); |
2469 | 2377 |
2470 gfx::ScrollOffset new_target = | 2378 gfx::ScrollOffset new_target = |
2471 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); | 2379 gfx::ScrollOffsetWithDelta(curve->target_value(), scroll_delta); |
2472 new_target.SetToMax(gfx::ScrollOffset()); | 2380 new_target.SetToMax(gfx::ScrollOffset()); |
2473 new_target.SetToMin(layer_impl->MaxScrollOffset()); | 2381 new_target.SetToMin(layer_impl->MaxScrollOffset()); |
2474 | 2382 |
2475 curve->UpdateTarget(animation->TrimTimeToCurrentIteration( | 2383 curve->UpdateTarget( |
2476 CurrentBeginFrameArgs().frame_time), | 2384 animation->TrimTimeToCurrentIteration( |
2477 new_target); | 2385 CurrentBeginFrameArgs().frame_time).InSecondsF(), |
| 2386 new_target); |
2478 | 2387 |
2479 return ScrollStarted; | 2388 return ScrollStarted; |
2480 } | 2389 } |
2481 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling | 2390 // ScrollAnimated is only used for wheel scrolls. We use the same bubbling |
2482 // behavior as ScrollBy to determine which layer to animate, but we do not | 2391 // behavior as ScrollBy to determine which layer to animate, but we do not |
2483 // do the Android-specific things in ScrollBy like showing top controls. | 2392 // do the Android-specific things in ScrollBy like showing top controls. |
2484 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); | 2393 InputHandler::ScrollStatus scroll_status = ScrollBegin(viewport_point, Wheel); |
2485 if (scroll_status == ScrollStarted) { | 2394 if (scroll_status == ScrollStarted) { |
2486 gfx::Vector2dF pending_delta = scroll_delta; | 2395 gfx::Vector2dF pending_delta = scroll_delta; |
2487 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; | 2396 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); layer_impl; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2621 return false; | 2530 return false; |
2622 | 2531 |
2623 // Always consume if it's in the direction to show the top controls. | 2532 // Always consume if it's in the direction to show the top controls. |
2624 if (scroll_delta.y() < 0) | 2533 if (scroll_delta.y() < 0) |
2625 return true; | 2534 return true; |
2626 | 2535 |
2627 if (CurrentlyScrollingLayer() != InnerViewportScrollLayer() && | 2536 if (CurrentlyScrollingLayer() != InnerViewportScrollLayer() && |
2628 CurrentlyScrollingLayer() != OuterViewportScrollLayer()) | 2537 CurrentlyScrollingLayer() != OuterViewportScrollLayer()) |
2629 return false; | 2538 return false; |
2630 | 2539 |
2631 if (InnerViewportScrollLayer()->MaxScrollOffset().y() > 0) | 2540 if (active_tree()->TotalScrollOffset().y() < |
2632 return true; | 2541 active_tree()->TotalMaxScrollOffset().y()) |
2633 | |
2634 if (OuterViewportScrollLayer() && | |
2635 OuterViewportScrollLayer()->MaxScrollOffset().y() > 0) | |
2636 return true; | 2542 return true; |
2637 | 2543 |
2638 return false; | 2544 return false; |
2639 } | 2545 } |
2640 | 2546 |
2641 bool LayerTreeHostImpl::ScrollBy(const gfx::Point& viewport_point, | 2547 InputHandlerScrollResult LayerTreeHostImpl::ScrollBy( |
2642 const gfx::Vector2dF& scroll_delta) { | 2548 const gfx::Point& viewport_point, |
| 2549 const gfx::Vector2dF& scroll_delta) { |
2643 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); | 2550 TRACE_EVENT0("cc", "LayerTreeHostImpl::ScrollBy"); |
2644 if (!CurrentlyScrollingLayer()) | 2551 if (!CurrentlyScrollingLayer()) |
2645 return false; | 2552 return InputHandlerScrollResult(); |
2646 | 2553 |
2647 gfx::Vector2dF pending_delta = scroll_delta; | 2554 gfx::Vector2dF pending_delta = scroll_delta; |
2648 gfx::Vector2dF unused_root_delta; | 2555 gfx::Vector2dF unused_root_delta; |
2649 bool did_scroll_x = false; | 2556 bool did_scroll_x = false; |
2650 bool did_scroll_y = false; | 2557 bool did_scroll_y = false; |
2651 bool did_scroll_top_controls = false; | 2558 bool did_scroll_top_controls = false; |
2652 | 2559 |
2653 bool consume_by_top_controls = ShouldTopControlsConsumeScroll(scroll_delta); | 2560 bool consume_by_top_controls = ShouldTopControlsConsumeScroll(scroll_delta); |
2654 | 2561 |
2655 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); | 2562 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2756 client_->SetNeedsCommitOnImplThread(); | 2663 client_->SetNeedsCommitOnImplThread(); |
2757 SetNeedsRedraw(); | 2664 SetNeedsRedraw(); |
2758 client_->RenewTreePriority(); | 2665 client_->RenewTreePriority(); |
2759 } | 2666 } |
2760 | 2667 |
2761 // Scrolling along an axis resets accumulated root overscroll for that axis. | 2668 // Scrolling along an axis resets accumulated root overscroll for that axis. |
2762 if (did_scroll_x) | 2669 if (did_scroll_x) |
2763 accumulated_root_overscroll_.set_x(0); | 2670 accumulated_root_overscroll_.set_x(0); |
2764 if (did_scroll_y) | 2671 if (did_scroll_y) |
2765 accumulated_root_overscroll_.set_y(0); | 2672 accumulated_root_overscroll_.set_y(0); |
| 2673 accumulated_root_overscroll_ += unused_root_delta; |
2766 | 2674 |
2767 accumulated_root_overscroll_ += unused_root_delta; | 2675 InputHandlerScrollResult scroll_result; |
2768 bool did_overscroll = !unused_root_delta.IsZero(); | 2676 scroll_result.did_scroll = did_scroll_content || did_scroll_top_controls; |
2769 if (did_overscroll && input_handler_client_) { | 2677 scroll_result.did_overscroll_root = !unused_root_delta.IsZero(); |
2770 input_handler_client_->DidOverscroll( | 2678 scroll_result.accumulated_root_overscroll = accumulated_root_overscroll_; |
2771 viewport_point, accumulated_root_overscroll_, unused_root_delta); | 2679 scroll_result.unused_scroll_delta = unused_root_delta; |
2772 } | 2680 return scroll_result; |
2773 | |
2774 return did_scroll_content || did_scroll_top_controls; | |
2775 } | 2681 } |
2776 | 2682 |
2777 // This implements scrolling by page as described here: | 2683 // This implements scrolling by page as described here: |
2778 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms645601(v=vs.85).asp
x#_win32_The_Mouse_Wheel | 2684 // http://msdn.microsoft.com/en-us/library/windows/desktop/ms645601(v=vs.85).asp
x#_win32_The_Mouse_Wheel |
2779 // for events with WHEEL_PAGESCROLL set. | 2685 // for events with WHEEL_PAGESCROLL set. |
2780 bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, | 2686 bool LayerTreeHostImpl::ScrollVerticallyByPage(const gfx::Point& viewport_point, |
2781 ScrollDirection direction) { | 2687 ScrollDirection direction) { |
2782 DCHECK(wheel_scrolling_); | 2688 DCHECK(wheel_scrolling_); |
2783 | 2689 |
2784 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); | 2690 for (LayerImpl* layer_impl = CurrentlyScrollingLayer(); |
(...skipping 405 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3190 !active_tree_->root_layer()) | 3096 !active_tree_->root_layer()) |
3191 return; | 3097 return; |
3192 | 3098 |
3193 TRACE_EVENT0("cc", "LayerTreeHostImpl::ActivateAnimations"); | 3099 TRACE_EVENT0("cc", "LayerTreeHostImpl::ActivateAnimations"); |
3194 AnimationRegistrar::AnimationControllerMap copy = | 3100 AnimationRegistrar::AnimationControllerMap copy = |
3195 animation_registrar_->active_animation_controllers(); | 3101 animation_registrar_->active_animation_controllers(); |
3196 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); | 3102 for (AnimationRegistrar::AnimationControllerMap::iterator iter = copy.begin(); |
3197 iter != copy.end(); | 3103 iter != copy.end(); |
3198 ++iter) | 3104 ++iter) |
3199 (*iter).second->ActivateAnimations(); | 3105 (*iter).second->ActivateAnimations(); |
3200 } | |
3201 | 3106 |
3202 base::TimeDelta LayerTreeHostImpl::LowFrequencyAnimationInterval() const { | 3107 SetNeedsAnimate(); |
3203 return base::TimeDelta::FromSeconds(1); | |
3204 } | 3108 } |
3205 | 3109 |
3206 std::string LayerTreeHostImpl::LayerTreeAsJson() const { | 3110 std::string LayerTreeHostImpl::LayerTreeAsJson() const { |
3207 std::string str; | 3111 std::string str; |
3208 if (active_tree_->root_layer()) { | 3112 if (active_tree_->root_layer()) { |
3209 scoped_ptr<base::Value> json(active_tree_->root_layer()->LayerTreeAsJson()); | 3113 scoped_ptr<base::Value> json(active_tree_->root_layer()->LayerTreeAsJson()); |
3210 base::JSONWriter::WriteWithOptions( | 3114 base::JSONWriter::WriteWithOptions( |
3211 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); | 3115 json.get(), base::JSONWriter::OPTIONS_PRETTY_PRINT, &str); |
3212 } | 3116 } |
3213 return str; | 3117 return str; |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3280 // Try to use the current frame time to keep animations non-jittery. But if | 3184 // Try to use the current frame time to keep animations non-jittery. But if |
3281 // we're not in a frame (because this is during an input event or a delayed | 3185 // we're not in a frame (because this is during an input event or a delayed |
3282 // task), fall back to physical time. This should still be monotonic. | 3186 // task), fall back to physical time. This should still be monotonic. |
3283 if (current_begin_frame_args_.IsValid()) | 3187 if (current_begin_frame_args_.IsValid()) |
3284 return current_begin_frame_args_; | 3188 return current_begin_frame_args_; |
3285 return BeginFrameArgs::Create(gfx::FrameTime::Now(), | 3189 return BeginFrameArgs::Create(gfx::FrameTime::Now(), |
3286 base::TimeTicks(), | 3190 base::TimeTicks(), |
3287 BeginFrameArgs::DefaultInterval()); | 3191 BeginFrameArgs::DefaultInterval()); |
3288 } | 3192 } |
3289 | 3193 |
3290 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const { | |
3291 return AsValueWithFrameInto(NULL, value); | |
3292 } | |
3293 | |
3294 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3194 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3295 LayerTreeHostImpl::AsValue() const { | 3195 LayerTreeHostImpl::AsValue() const { |
3296 return AsValueWithFrame(NULL); | 3196 return AsValueWithFrame(NULL); |
3297 } | 3197 } |
3298 | 3198 |
3299 scoped_refptr<base::debug::ConvertableToTraceFormat> | 3199 scoped_refptr<base::debug::ConvertableToTraceFormat> |
3300 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { | 3200 LayerTreeHostImpl::AsValueWithFrame(FrameData* frame) const { |
3301 scoped_refptr<base::debug::TracedValue> state = | 3201 scoped_refptr<base::debug::TracedValue> state = |
3302 new base::debug::TracedValue(); | 3202 new base::debug::TracedValue(); |
3303 AsValueWithFrameInto(frame, state.get()); | 3203 AsValueWithFrameInto(frame, state.get()); |
3304 return state; | 3204 return state; |
3305 } | 3205 } |
3306 | 3206 |
| 3207 void LayerTreeHostImpl::AsValueInto(base::debug::TracedValue* value) const { |
| 3208 return AsValueWithFrameInto(NULL, value); |
| 3209 } |
| 3210 |
3307 void LayerTreeHostImpl::AsValueWithFrameInto( | 3211 void LayerTreeHostImpl::AsValueWithFrameInto( |
3308 FrameData* frame, | 3212 FrameData* frame, |
3309 base::debug::TracedValue* state) const { | 3213 base::debug::TracedValue* state) const { |
3310 if (this->pending_tree_) { | 3214 if (this->pending_tree_) { |
3311 state->BeginDictionary("activation_state"); | 3215 state->BeginDictionary("activation_state"); |
3312 ActivationStateAsValueInto(state); | 3216 ActivationStateAsValueInto(state); |
3313 state->EndDictionary(); | 3217 state->EndDictionary(); |
3314 } | 3218 } |
3315 state->BeginDictionary("device_viewport_size"); | 3219 state->BeginDictionary("device_viewport_size"); |
3316 MathUtil::AddToTracedValue(device_viewport_size_, state); | 3220 MathUtil::AddToTracedValue(device_viewport_size_, state); |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3522 } | 3426 } |
3523 | 3427 |
3524 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { | 3428 void LayerTreeHostImpl::UnregisterPictureLayerImpl(PictureLayerImpl* layer) { |
3525 std::vector<PictureLayerImpl*>::iterator it = | 3429 std::vector<PictureLayerImpl*>::iterator it = |
3526 std::find(picture_layers_.begin(), picture_layers_.end(), layer); | 3430 std::find(picture_layers_.begin(), picture_layers_.end(), layer); |
3527 DCHECK(it != picture_layers_.end()); | 3431 DCHECK(it != picture_layers_.end()); |
3528 picture_layers_.erase(it); | 3432 picture_layers_.erase(it); |
3529 } | 3433 } |
3530 | 3434 |
3531 } // namespace cc | 3435 } // namespace cc |
OLD | NEW |