| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <algorithm> | 10 #include <algorithm> |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 154 } else { | 154 } else { |
| 155 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorTouchScrollUpdateThread", | 155 UMA_HISTOGRAM_BOOLEAN("Renderer4.CompositorTouchScrollUpdateThread", |
| 156 scroll_on_main_thread); | 156 scroll_on_main_thread); |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace | 160 } // namespace |
| 161 | 161 |
| 162 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, | 162 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeDurationHistogramTimer, |
| 163 "Scheduling.%s.PendingTreeDuration"); | 163 "Scheduling.%s.PendingTreeDuration"); |
| 164 DEFINE_SCOPED_UMA_HISTOGRAM_TIMER(PendingTreeRasterDurationHistogramTimer, |
| 165 "Scheduling.%s.PendingTreeRasterDuration"); |
| 164 | 166 |
| 165 LayerTreeHostImpl::FrameData::FrameData() | 167 LayerTreeHostImpl::FrameData::FrameData() |
| 166 : render_surface_list(nullptr), | 168 : render_surface_list(nullptr), |
| 167 has_no_damage(false), | 169 has_no_damage(false), |
| 168 may_contain_video(false) {} | 170 may_contain_video(false) {} |
| 169 | 171 |
| 170 LayerTreeHostImpl::FrameData::~FrameData() {} | 172 LayerTreeHostImpl::FrameData::~FrameData() {} |
| 171 | 173 |
| 172 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( | 174 std::unique_ptr<LayerTreeHostImpl> LayerTreeHostImpl::Create( |
| 173 const LayerTreeSettings& settings, | 175 const LayerTreeSettings& settings, |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 bool did_prepare_tiles = PrepareTiles(); | 382 bool did_prepare_tiles = PrepareTiles(); |
| 381 if (!did_prepare_tiles) { | 383 if (!did_prepare_tiles) { |
| 382 NotifyReadyToActivate(); | 384 NotifyReadyToActivate(); |
| 383 | 385 |
| 384 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This | 386 // Ensure we get ReadyToDraw signal even when PrepareTiles not run. This |
| 385 // is important for SingleThreadProxy and impl-side painting case. For | 387 // is important for SingleThreadProxy and impl-side painting case. For |
| 386 // STP, we commit to active tree and RequiresHighResToDraw, and set | 388 // STP, we commit to active tree and RequiresHighResToDraw, and set |
| 387 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. | 389 // Scheduler to wait for ReadyToDraw signal to avoid Checkerboard. |
| 388 if (CommitToActiveTree()) | 390 if (CommitToActiveTree()) |
| 389 NotifyReadyToDraw(); | 391 NotifyReadyToDraw(); |
| 392 } else if (!CommitToActiveTree()) { |
| 393 DCHECK(!pending_tree_raster_duration_timer_); |
| 394 pending_tree_raster_duration_timer_ = |
| 395 base::MakeUnique<PendingTreeRasterDurationHistogramTimer>(); |
| 390 } | 396 } |
| 391 } | 397 } |
| 392 | 398 |
| 393 bool LayerTreeHostImpl::CanDraw() const { | 399 bool LayerTreeHostImpl::CanDraw() const { |
| 394 // Note: If you are changing this function or any other function that might | 400 // Note: If you are changing this function or any other function that might |
| 395 // affect the result of CanDraw, make sure to call | 401 // affect the result of CanDraw, make sure to call |
| 396 // client_->OnCanDrawStateChanged in the proper places and update the | 402 // client_->OnCanDrawStateChanged in the proper places and update the |
| 397 // NotifyIfCanDrawChanged test. | 403 // NotifyIfCanDrawChanged test. |
| 398 | 404 |
| 399 if (!layer_tree_frame_sink_) { | 405 if (!layer_tree_frame_sink_) { |
| (...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 if (!result.IsValid()) | 1375 if (!result.IsValid()) |
| 1370 result = gfx::ColorSpace::CreateSRGB(); | 1376 result = gfx::ColorSpace::CreateSRGB(); |
| 1371 return result; | 1377 return result; |
| 1372 } | 1378 } |
| 1373 | 1379 |
| 1374 void LayerTreeHostImpl::RequestImplSideInvalidation() { | 1380 void LayerTreeHostImpl::RequestImplSideInvalidation() { |
| 1375 client_->NeedsImplSideInvalidation(); | 1381 client_->NeedsImplSideInvalidation(); |
| 1376 } | 1382 } |
| 1377 | 1383 |
| 1378 void LayerTreeHostImpl::NotifyReadyToActivate() { | 1384 void LayerTreeHostImpl::NotifyReadyToActivate() { |
| 1385 pending_tree_raster_duration_timer_.reset(); |
| 1379 client_->NotifyReadyToActivate(); | 1386 client_->NotifyReadyToActivate(); |
| 1380 } | 1387 } |
| 1381 | 1388 |
| 1382 void LayerTreeHostImpl::NotifyReadyToDraw() { | 1389 void LayerTreeHostImpl::NotifyReadyToDraw() { |
| 1383 // Tiles that are ready will cause NotifyTileStateChanged() to be called so we | 1390 // Tiles that are ready will cause NotifyTileStateChanged() to be called so we |
| 1384 // don't need to schedule a draw here. Just stop WillBeginImplFrame() from | 1391 // don't need to schedule a draw here. Just stop WillBeginImplFrame() from |
| 1385 // causing optimistic requests to draw a frame. | 1392 // causing optimistic requests to draw a frame. |
| 1386 is_likely_to_require_a_draw_ = false; | 1393 is_likely_to_require_a_draw_ = false; |
| 1387 | 1394 |
| 1388 client_->NotifyReadyToDraw(); | 1395 client_->NotifyReadyToDraw(); |
| (...skipping 2925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4314 | 4321 |
| 4315 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { | 4322 void LayerTreeHostImpl::ShowScrollbarsForImplScroll(ElementId element_id) { |
| 4316 if (!element_id) | 4323 if (!element_id) |
| 4317 return; | 4324 return; |
| 4318 if (ScrollbarAnimationController* animation_controller = | 4325 if (ScrollbarAnimationController* animation_controller = |
| 4319 ScrollbarAnimationControllerForElementId(element_id)) | 4326 ScrollbarAnimationControllerForElementId(element_id)) |
| 4320 animation_controller->DidScrollUpdate(); | 4327 animation_controller->DidScrollUpdate(); |
| 4321 } | 4328 } |
| 4322 | 4329 |
| 4323 } // namespace cc | 4330 } // namespace cc |
| OLD | NEW |