Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 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/layers/picture_layer_impl.h" | 5 #include "cc/layers/picture_layer_impl.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <limits> | 8 #include <limits> |
| 9 | 9 |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 57 ideal_contents_scale_(0.f), | 57 ideal_contents_scale_(0.f), |
| 58 raster_page_scale_(0.f), | 58 raster_page_scale_(0.f), |
| 59 raster_device_scale_(0.f), | 59 raster_device_scale_(0.f), |
| 60 raster_source_scale_(0.f), | 60 raster_source_scale_(0.f), |
| 61 raster_contents_scale_(0.f), | 61 raster_contents_scale_(0.f), |
| 62 low_res_raster_contents_scale_(0.f), | 62 low_res_raster_contents_scale_(0.f), |
| 63 raster_source_scale_is_fixed_(false), | 63 raster_source_scale_is_fixed_(false), |
| 64 was_animating_transform_to_screen_(false), | 64 was_animating_transform_to_screen_(false), |
| 65 is_using_lcd_text_(tree_impl->settings().can_use_lcd_text), | 65 is_using_lcd_text_(tree_impl->settings().can_use_lcd_text), |
| 66 needs_post_commit_initialization_(true), | 66 needs_post_commit_initialization_(true), |
| 67 should_update_tile_priorities_(false), | 67 should_update_tile_priorities_(false) { |
| 68 layer_needs_to_register_itself_(true) { | 68 layer_tree_impl()->RegisterPictureLayerImpl(this); |
| 69 } | 69 } |
| 70 | 70 |
| 71 PictureLayerImpl::~PictureLayerImpl() { | 71 PictureLayerImpl::~PictureLayerImpl() { |
| 72 if (!layer_needs_to_register_itself_) | 72 layer_tree_impl()->UnregisterPictureLayerImpl(this); |
| 73 layer_tree_impl()->tile_manager()->UnregisterPictureLayerImpl(this); | |
| 74 } | 73 } |
| 75 | 74 |
| 76 const char* PictureLayerImpl::LayerTypeAsString() const { | 75 const char* PictureLayerImpl::LayerTypeAsString() const { |
| 77 return "cc::PictureLayerImpl"; | 76 return "cc::PictureLayerImpl"; |
| 78 } | 77 } |
| 79 | 78 |
| 80 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( | 79 scoped_ptr<LayerImpl> PictureLayerImpl::CreateLayerImpl( |
| 81 LayerTreeImpl* tree_impl) { | 80 LayerTreeImpl* tree_impl) { |
| 82 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); | 81 return PictureLayerImpl::Create(tree_impl, id()).PassAs<LayerImpl>(); |
| 83 } | 82 } |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 366 on_demand_missing_tile_count); | 365 on_demand_missing_tile_count); |
| 367 } | 366 } |
| 368 | 367 |
| 369 // Aggressively remove any tilings that are not seen to save memory. Note | 368 // Aggressively remove any tilings that are not seen to save memory. Note |
| 370 // that this is at the expense of doing cause more frequent re-painting. A | 369 // that this is at the expense of doing cause more frequent re-painting. A |
| 371 // better scheme would be to maintain a tighter visible_content_rect for the | 370 // better scheme would be to maintain a tighter visible_content_rect for the |
| 372 // finer tilings. | 371 // finer tilings. |
| 373 CleanUpTilingsOnActiveLayer(seen_tilings); | 372 CleanUpTilingsOnActiveLayer(seen_tilings); |
| 374 } | 373 } |
| 375 | 374 |
| 376 void PictureLayerImpl::DidUnregisterLayer() { | |
| 377 TRACE_EVENT0("cc", "PictureLayerImpl::DidUnregisterLayer"); | |
| 378 | |
| 379 layer_needs_to_register_itself_ = true; | |
| 380 } | |
| 381 | |
| 382 void PictureLayerImpl::UpdateTilePriorities() { | 375 void PictureLayerImpl::UpdateTilePriorities() { |
| 383 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); | 376 TRACE_EVENT0("cc", "PictureLayerImpl::UpdateTilePriorities"); |
| 384 | 377 |
| 385 DCHECK(!needs_post_commit_initialization_); | 378 DCHECK(!needs_post_commit_initialization_); |
| 386 CHECK(should_update_tile_priorities_); | 379 CHECK(should_update_tile_priorities_); |
| 387 | 380 |
| 388 if (layer_needs_to_register_itself_) { | |
| 389 layer_tree_impl()->tile_manager()->RegisterPictureLayerImpl(this); | |
| 390 layer_needs_to_register_itself_ = false; | |
| 391 } | |
| 392 | |
| 393 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { | 381 if (layer_tree_impl()->device_viewport_valid_for_tile_management()) { |
| 394 visible_rect_for_tile_priority_ = visible_content_rect(); | 382 visible_rect_for_tile_priority_ = visible_content_rect(); |
| 395 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); | 383 viewport_size_for_tile_priority_ = layer_tree_impl()->DrawViewportSize(); |
| 396 screen_space_transform_for_tile_priority_ = screen_space_transform(); | 384 screen_space_transform_for_tile_priority_ = screen_space_transform(); |
| 397 } | 385 } |
| 398 | 386 |
| 399 if (!tilings_->num_tilings()) | 387 if (!tilings_->num_tilings()) |
| 400 return; | 388 return; |
| 401 | 389 |
| 402 double current_frame_time_in_seconds = | 390 double current_frame_time_in_seconds = |
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1385 } | 1373 } |
| 1386 | 1374 |
| 1387 WhichTree PictureLayerImpl::GetTree() const { | 1375 WhichTree PictureLayerImpl::GetTree() const { |
| 1388 return layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; | 1376 return layer_tree_impl()->IsActiveTree() ? ACTIVE_TREE : PENDING_TREE; |
| 1389 } | 1377 } |
| 1390 | 1378 |
| 1391 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { | 1379 bool PictureLayerImpl::IsOnActiveOrPendingTree() const { |
| 1392 return !layer_tree_impl()->IsRecycleTree(); | 1380 return !layer_tree_impl()->IsRecycleTree(); |
| 1393 } | 1381 } |
| 1394 | 1382 |
| 1383 bool PictureLayerImpl::IsViableSourceOfRasterAndEvictionTiles() const { | |
|
reveman
2014/06/05 22:15:18
What else is needed here? Does UpdateTilePrioritie
vmpstr
2014/06/05 22:38:01
IsDrawnRenderSurfaceLayerListMember being true imp
reveman
2014/06/06 17:27:24
We'll handle that as discussed. Renamed this funct
| |
| 1384 return IsOnActiveOrPendingTree() && IsDrawnRenderSurfaceLayerListMember(); | |
| 1385 } | |
| 1386 | |
| 1395 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { | 1387 bool PictureLayerImpl::AllTilesRequiredForActivationAreReadyToDraw() const { |
| 1396 if (!layer_tree_impl()->IsPendingTree()) | 1388 if (!layer_tree_impl()->IsPendingTree()) |
| 1397 return true; | 1389 return true; |
| 1398 | 1390 |
| 1399 if (!tilings_) | 1391 if (!tilings_) |
| 1400 return true; | 1392 return true; |
| 1401 | 1393 |
| 1402 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { | 1394 for (size_t i = 0; i < tilings_->num_tilings(); ++i) { |
| 1403 PictureLayerTiling* tiling = tilings_->tiling_at(i); | 1395 PictureLayerTiling* tiling = tilings_->tiling_at(i); |
| 1404 if (tiling->resolution() != HIGH_RESOLUTION && | 1396 if (tiling->resolution() != HIGH_RESOLUTION && |
| (...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1639 return iterator_index_ < iterators_.size(); | 1631 return iterator_index_ < iterators_.size(); |
| 1640 } | 1632 } |
| 1641 | 1633 |
| 1642 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( | 1634 bool PictureLayerImpl::LayerEvictionTileIterator::IsCorrectType( |
| 1643 PictureLayerTiling::TilingEvictionTileIterator* it) const { | 1635 PictureLayerTiling::TilingEvictionTileIterator* it) const { |
| 1644 return it->get_type() == iteration_stage_ && | 1636 return it->get_type() == iteration_stage_ && |
| 1645 (**it)->required_for_activation() == required_for_activation_; | 1637 (**it)->required_for_activation() == required_for_activation_; |
| 1646 } | 1638 } |
| 1647 | 1639 |
| 1648 } // namespace cc | 1640 } // namespace cc |
| OLD | NEW |