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 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 | 342 |
343 micro_benchmark_controller_.DidCompleteCommit(); | 343 micro_benchmark_controller_.DidCompleteCommit(); |
344 } | 344 } |
345 | 345 |
346 bool LayerTreeHostImpl::CanDraw() const { | 346 bool LayerTreeHostImpl::CanDraw() const { |
347 // Note: If you are changing this function or any other function that might | 347 // Note: If you are changing this function or any other function that might |
348 // affect the result of CanDraw, make sure to call | 348 // affect the result of CanDraw, make sure to call |
349 // client_->OnCanDrawStateChanged in the proper places and update the | 349 // client_->OnCanDrawStateChanged in the proper places and update the |
350 // NotifyIfCanDrawChanged test. | 350 // NotifyIfCanDrawChanged test. |
351 | 351 |
| 352 DLOG(INFO) << 1; |
| 353 |
352 if (!renderer_) { | 354 if (!renderer_) { |
353 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", | 355 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no renderer", |
354 TRACE_EVENT_SCOPE_THREAD); | 356 TRACE_EVENT_SCOPE_THREAD); |
355 return false; | 357 return false; |
356 } | 358 } |
| 359 DLOG(INFO) << 2; |
357 | 360 |
358 // Must have an OutputSurface if |renderer_| is not NULL. | 361 // Must have an OutputSurface if |renderer_| is not NULL. |
359 DCHECK(output_surface_); | 362 DCHECK(output_surface_); |
360 | 363 |
361 // TODO(boliu): Make draws without root_layer work and move this below | 364 // TODO(boliu): Make draws without root_layer work and move this below |
362 // draw_and_swap_full_viewport_every_frame check. Tracked in crbug.com/264967. | 365 // draw_and_swap_full_viewport_every_frame check. Tracked in crbug.com/264967. |
363 if (!active_tree_->root_layer()) { | 366 if (!active_tree_->root_layer()) { |
364 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", | 367 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw no root layer", |
365 TRACE_EVENT_SCOPE_THREAD); | 368 TRACE_EVENT_SCOPE_THREAD); |
366 return false; | 369 return false; |
367 } | 370 } |
| 371 DLOG(INFO) << 3; |
368 | 372 |
369 if (output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) | 373 if (output_surface_->capabilities().draw_and_swap_full_viewport_every_frame) |
370 return true; | 374 return true; |
| 375 DLOG(INFO) << 4; |
371 | 376 |
372 if (DrawViewportSize().IsEmpty()) { | 377 if (false && DrawViewportSize().IsEmpty()) { |
373 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", | 378 TRACE_EVENT_INSTANT0("cc", "LayerTreeHostImpl::CanDraw empty viewport", |
374 TRACE_EVENT_SCOPE_THREAD); | 379 TRACE_EVENT_SCOPE_THREAD); |
375 return false; | 380 return false; |
376 } | 381 } |
| 382 DLOG(INFO) << 5; |
377 if (active_tree_->ViewportSizeInvalid()) { | 383 if (active_tree_->ViewportSizeInvalid()) { |
378 TRACE_EVENT_INSTANT0( | 384 TRACE_EVENT_INSTANT0( |
379 "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed", | 385 "cc", "LayerTreeHostImpl::CanDraw viewport size recently changed", |
380 TRACE_EVENT_SCOPE_THREAD); | 386 TRACE_EVENT_SCOPE_THREAD); |
381 return false; | 387 return false; |
382 } | 388 } |
| 389 DLOG(INFO) << 6; |
383 if (active_tree_->ContentsTexturesPurged()) { | 390 if (active_tree_->ContentsTexturesPurged()) { |
384 TRACE_EVENT_INSTANT0( | 391 TRACE_EVENT_INSTANT0( |
385 "cc", "LayerTreeHostImpl::CanDraw contents textures purged", | 392 "cc", "LayerTreeHostImpl::CanDraw contents textures purged", |
386 TRACE_EVENT_SCOPE_THREAD); | 393 TRACE_EVENT_SCOPE_THREAD); |
387 return false; | 394 return false; |
388 } | 395 } |
| 396 DLOG(INFO) << 7; |
389 if (EvictedUIResourcesExist()) { | 397 if (EvictedUIResourcesExist()) { |
390 TRACE_EVENT_INSTANT0( | 398 TRACE_EVENT_INSTANT0( |
391 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", | 399 "cc", "LayerTreeHostImpl::CanDraw UI resources evicted not recreated", |
392 TRACE_EVENT_SCOPE_THREAD); | 400 TRACE_EVENT_SCOPE_THREAD); |
393 return false; | 401 return false; |
394 } | 402 } |
| 403 DLOG(INFO) << 8; |
395 return true; | 404 return true; |
396 } | 405 } |
397 | 406 |
398 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { | 407 void LayerTreeHostImpl::Animate(base::TimeTicks monotonic_time) { |
399 if (input_handler_client_) | 408 if (input_handler_client_) |
400 input_handler_client_->Animate(monotonic_time); | 409 input_handler_client_->Animate(monotonic_time); |
401 AnimatePageScale(monotonic_time); | 410 AnimatePageScale(monotonic_time); |
402 AnimateLayers(monotonic_time); | 411 AnimateLayers(monotonic_time); |
403 AnimateScrollbars(monotonic_time); | 412 AnimateScrollbars(monotonic_time); |
404 AnimateTopControls(monotonic_time); | 413 AnimateTopControls(monotonic_time); |
(...skipping 993 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1398 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); | 1407 TRACE_EVENT0("cc", "LayerTreeHostImpl::DrawLayers"); |
1399 DCHECK(CanDraw()); | 1408 DCHECK(CanDraw()); |
1400 | 1409 |
1401 if (frame->has_no_damage) { | 1410 if (frame->has_no_damage) { |
1402 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); | 1411 TRACE_EVENT_INSTANT0("cc", "EarlyOut_NoDamage", TRACE_EVENT_SCOPE_THREAD); |
1403 DCHECK(!output_surface_->capabilities() | 1412 DCHECK(!output_surface_->capabilities() |
1404 .draw_and_swap_full_viewport_every_frame); | 1413 .draw_and_swap_full_viewport_every_frame); |
1405 return; | 1414 return; |
1406 } | 1415 } |
1407 | 1416 |
| 1417 DLOG(INFO) << "DrawLayers"; |
1408 DCHECK(!frame->render_passes.empty()); | 1418 DCHECK(!frame->render_passes.empty()); |
1409 | 1419 |
1410 fps_counter_->SaveTimeStamp(frame_begin_time, | 1420 fps_counter_->SaveTimeStamp(frame_begin_time, |
1411 !output_surface_->context_provider()); | 1421 !output_surface_->context_provider()); |
1412 bool on_main_thread = false; | 1422 bool on_main_thread = false; |
1413 rendering_stats_instrumentation_->IncrementFrameCount( | 1423 rendering_stats_instrumentation_->IncrementFrameCount( |
1414 1, on_main_thread); | 1424 1, on_main_thread); |
1415 | 1425 |
1416 if (tile_manager_) { | 1426 if (tile_manager_) { |
1417 memory_history_->SaveEntry( | 1427 memory_history_->SaveEntry( |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2095 | 2105 |
2096 UpdateInnerViewportContainerSize(); | 2106 UpdateInnerViewportContainerSize(); |
2097 SetFullRootLayerDamage(); | 2107 SetFullRootLayerDamage(); |
2098 } | 2108 } |
2099 | 2109 |
2100 gfx::Size LayerTreeHostImpl::DrawViewportSize() const { | 2110 gfx::Size LayerTreeHostImpl::DrawViewportSize() const { |
2101 return DeviceViewport().size(); | 2111 return DeviceViewport().size(); |
2102 } | 2112 } |
2103 | 2113 |
2104 gfx::Rect LayerTreeHostImpl::DeviceViewport() const { | 2114 gfx::Rect LayerTreeHostImpl::DeviceViewport() const { |
| 2115 DLOG(INFO) << external_viewport_.ToString(); |
2105 if (external_viewport_.IsEmpty()) | 2116 if (external_viewport_.IsEmpty()) |
2106 return gfx::Rect(device_viewport_size_); | 2117 return gfx::Rect(device_viewport_size_); |
2107 | 2118 |
2108 return external_viewport_; | 2119 return external_viewport_; |
2109 } | 2120 } |
2110 | 2121 |
2111 gfx::Rect LayerTreeHostImpl::DeviceClip() const { | 2122 gfx::Rect LayerTreeHostImpl::DeviceClip() const { |
2112 if (external_clip_.IsEmpty()) | 2123 if (external_clip_.IsEmpty()) |
2113 return DeviceViewport(); | 2124 return DeviceViewport(); |
2114 | 2125 |
(...skipping 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3128 swap_promise_monitor_.erase(monitor); | 3139 swap_promise_monitor_.erase(monitor); |
3129 } | 3140 } |
3130 | 3141 |
3131 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { | 3142 void LayerTreeHostImpl::NotifySwapPromiseMonitorsOfSetNeedsRedraw() { |
3132 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); | 3143 std::set<SwapPromiseMonitor*>::iterator it = swap_promise_monitor_.begin(); |
3133 for (; it != swap_promise_monitor_.end(); it++) | 3144 for (; it != swap_promise_monitor_.end(); it++) |
3134 (*it)->OnSetNeedsRedrawOnImpl(); | 3145 (*it)->OnSetNeedsRedrawOnImpl(); |
3135 } | 3146 } |
3136 | 3147 |
3137 } // namespace cc | 3148 } // namespace cc |
OLD | NEW |