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/resources/picture_layer_tiling_set.h" | 5 #include "cc/resources/picture_layer_tiling_set.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <set> | 8 #include <set> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 const PictureLayerTilingSet* twin_set, | 58 const PictureLayerTilingSet* twin_set, |
59 const Region& layer_invalidation, | 59 const Region& layer_invalidation, |
60 float minimum_contents_scale, | 60 float minimum_contents_scale, |
61 float maximum_contents_scale) { | 61 float maximum_contents_scale) { |
62 RemoveTilingsBelowScale(minimum_contents_scale); | 62 RemoveTilingsBelowScale(minimum_contents_scale); |
63 RemoveTilingsAboveScale(maximum_contents_scale); | 63 RemoveTilingsAboveScale(maximum_contents_scale); |
64 | 64 |
65 // Copy over tilings that are shared with the |twin_set| tiling set (if it | 65 // Copy over tilings that are shared with the |twin_set| tiling set (if it |
66 // exists). | 66 // exists). |
67 if (twin_set) { | 67 if (twin_set) { |
| 68 if (twin_set->tilings_.empty()) { |
| 69 // If the twin (pending) tiling set is empty, it was not updated for the |
| 70 // current frame. So we drop tilings from our set as well, instead of |
| 71 // leaving behind unshared tilings that are all non-ideal. |
| 72 RemoveAllTilings(); |
| 73 } |
| 74 |
68 for (PictureLayerTiling* twin_tiling : twin_set->tilings_) { | 75 for (PictureLayerTiling* twin_tiling : twin_set->tilings_) { |
69 float contents_scale = twin_tiling->contents_scale(); | 76 float contents_scale = twin_tiling->contents_scale(); |
70 DCHECK_GE(contents_scale, minimum_contents_scale); | 77 DCHECK_GE(contents_scale, minimum_contents_scale); |
71 DCHECK_LE(contents_scale, maximum_contents_scale); | 78 DCHECK_LE(contents_scale, maximum_contents_scale); |
72 | 79 |
73 PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale); | 80 PictureLayerTiling* this_tiling = FindTilingWithScale(contents_scale); |
74 if (!this_tiling) { | 81 if (!this_tiling) { |
75 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create( | 82 scoped_ptr<PictureLayerTiling> new_tiling = PictureLayerTiling::Create( |
76 contents_scale, raster_source, client_, | 83 contents_scale, raster_source, client_, |
77 max_tiles_for_interest_area_, skewport_target_time_in_seconds_, | 84 max_tiles_for_interest_area_, skewport_target_time_in_seconds_, |
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 } | 479 } |
473 | 480 |
474 return *this; | 481 return *this; |
475 } | 482 } |
476 | 483 |
477 PictureLayerTilingSet::CoverageIterator::operator bool() const { | 484 PictureLayerTilingSet::CoverageIterator::operator bool() const { |
478 return current_tiling_ < static_cast<int>(set_->tilings_.size()) || | 485 return current_tiling_ < static_cast<int>(set_->tilings_.size()) || |
479 region_iter_.has_rect(); | 486 region_iter_.has_rect(); |
480 } | 487 } |
481 | 488 |
482 void PictureLayerTilingSet::AsValueInto(base::debug::TracedValue* state) const { | 489 void PictureLayerTilingSet::AsValueInto( |
| 490 base::trace_event::TracedValue* state) const { |
483 for (size_t i = 0; i < tilings_.size(); ++i) { | 491 for (size_t i = 0; i < tilings_.size(); ++i) { |
484 state->BeginDictionary(); | 492 state->BeginDictionary(); |
485 tilings_[i]->AsValueInto(state); | 493 tilings_[i]->AsValueInto(state); |
486 state->EndDictionary(); | 494 state->EndDictionary(); |
487 } | 495 } |
488 } | 496 } |
489 | 497 |
490 size_t PictureLayerTilingSet::GPUMemoryUsageInBytes() const { | 498 size_t PictureLayerTilingSet::GPUMemoryUsageInBytes() const { |
491 size_t amount = 0; | 499 size_t amount = 0; |
492 for (size_t i = 0; i < tilings_.size(); ++i) | 500 for (size_t i = 0; i < tilings_.size(); ++i) |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
535 case LOWER_THAN_LOW_RES: | 543 case LOWER_THAN_LOW_RES: |
536 range = TilingRange(low_res_range.end, tilings_.size()); | 544 range = TilingRange(low_res_range.end, tilings_.size()); |
537 break; | 545 break; |
538 } | 546 } |
539 | 547 |
540 DCHECK_LE(range.start, range.end); | 548 DCHECK_LE(range.start, range.end); |
541 return range; | 549 return range; |
542 } | 550 } |
543 | 551 |
544 } // namespace cc | 552 } // namespace cc |
OLD | NEW |