| 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 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 5 #ifndef CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
| 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 6 #define CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <vector> |
| 9 | 10 |
| 10 #include "cc/base/region.h" | 11 #include "cc/base/region.h" |
| 11 #include "cc/base/scoped_ptr_vector.h" | 12 #include "cc/base/scoped_ptr_vector.h" |
| 12 #include "cc/resources/picture_layer_tiling.h" | 13 #include "cc/resources/picture_layer_tiling.h" |
| 13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
| 14 | 15 |
| 15 namespace base { | 16 namespace base { |
| 16 namespace debug { | 17 namespace debug { |
| 17 class TracedValue; | 18 class TracedValue; |
| 18 } | 19 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 38 | 39 |
| 39 static scoped_ptr<PictureLayerTilingSet> Create( | 40 static scoped_ptr<PictureLayerTilingSet> Create( |
| 40 PictureLayerTilingClient* client); | 41 PictureLayerTilingClient* client); |
| 41 | 42 |
| 42 ~PictureLayerTilingSet(); | 43 ~PictureLayerTilingSet(); |
| 43 | 44 |
| 44 void SetClient(PictureLayerTilingClient* client); | 45 void SetClient(PictureLayerTilingClient* client); |
| 45 const PictureLayerTilingClient* client() const { return client_; } | 46 const PictureLayerTilingClient* client() const { return client_; } |
| 46 | 47 |
| 47 void RemoveTilesInRegion(const Region& region); | 48 void RemoveTilesInRegion(const Region& region); |
| 49 void CleanUpTilings(float min_acceptable_high_res_scale, |
| 50 float max_acceptable_high_res_scale, |
| 51 const std::vector<PictureLayerTiling*>& needed_tilings, |
| 52 bool should_have_low_res, |
| 53 PictureLayerTilingSet* twin_set, |
| 54 PictureLayerTilingSet* recycled_twin_set); |
| 48 | 55 |
| 49 // Make this set of tilings match the same set of content scales from |other|. | 56 // Make this set of tilings match the same set of content scales from |other|. |
| 50 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate | 57 // Delete any tilings that don't meet |minimum_contents_scale|. Recreate |
| 51 // any tiles that intersect |layer_invalidation|. Update the size of all | 58 // any tiles that intersect |layer_invalidation|. Update the size of all |
| 52 // tilings to |new_layer_bounds|. | 59 // tilings to |new_layer_bounds|. |
| 53 // Returns true if we had at least one high res tiling synced. | 60 // Returns true if we had at least one high res tiling synced. |
| 54 bool SyncTilings(const PictureLayerTilingSet& other, | 61 bool SyncTilings(const PictureLayerTilingSet& other, |
| 55 const gfx::Size& new_layer_bounds, | 62 const gfx::Size& new_layer_bounds, |
| 56 const Region& layer_invalidation, | 63 const Region& layer_invalidation, |
| 57 float minimum_contents_scale, | 64 float minimum_contents_scale, |
| (...skipping 20 matching lines...) Expand all Loading... |
| 78 float GetSnappedContentsScale(float start_scale, | 85 float GetSnappedContentsScale(float start_scale, |
| 79 float snap_to_existing_tiling_ratio) const; | 86 float snap_to_existing_tiling_ratio) const; |
| 80 | 87 |
| 81 // Returns the maximum contents scale of all tilings, or 0 if no tilings | 88 // Returns the maximum contents scale of all tilings, or 0 if no tilings |
| 82 // exist. | 89 // exist. |
| 83 float GetMaximumContentsScale() const; | 90 float GetMaximumContentsScale() const; |
| 84 | 91 |
| 85 // Remove all tilings. | 92 // Remove all tilings. |
| 86 void RemoveAllTilings(); | 93 void RemoveAllTilings(); |
| 87 | 94 |
| 88 // Remove one tiling. | |
| 89 void Remove(PictureLayerTiling* tiling); | |
| 90 void RemoveTilingWithScale(float scale); | |
| 91 | |
| 92 // Remove all tiles; keep all tilings. | 95 // Remove all tiles; keep all tilings. |
| 93 void RemoveAllTiles(); | 96 void RemoveAllTiles(); |
| 94 | 97 |
| 95 // Update the rects and priorities for tiles based on the given information. | 98 // Update the rects and priorities for tiles based on the given information. |
| 96 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, | 99 bool UpdateTilePriorities(const gfx::Rect& required_rect_in_layer_space, |
| 97 float ideal_contents_scale, | 100 float ideal_contents_scale, |
| 98 double current_frame_time_in_seconds, | 101 double current_frame_time_in_seconds, |
| 99 const Occlusion& occlusion_in_layer_space, | 102 const Occlusion& occlusion_in_layer_space, |
| 100 bool can_require_tiles_for_activation); | 103 bool can_require_tiles_for_activation); |
| 101 | 104 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 }; | 150 }; |
| 148 | 151 |
| 149 void AsValueInto(base::debug::TracedValue* array) const; | 152 void AsValueInto(base::debug::TracedValue* array) const; |
| 150 size_t GPUMemoryUsageInBytes() const; | 153 size_t GPUMemoryUsageInBytes() const; |
| 151 | 154 |
| 152 TilingRange GetTilingRange(TilingRangeType type) const; | 155 TilingRange GetTilingRange(TilingRangeType type) const; |
| 153 | 156 |
| 154 private: | 157 private: |
| 155 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); | 158 explicit PictureLayerTilingSet(PictureLayerTilingClient* client); |
| 156 | 159 |
| 160 // Remove one tiling. |
| 161 void Remove(PictureLayerTiling* tiling); |
| 162 |
| 157 PictureLayerTilingClient* client_; | 163 PictureLayerTilingClient* client_; |
| 158 ScopedPtrVector<PictureLayerTiling> tilings_; | 164 ScopedPtrVector<PictureLayerTiling> tilings_; |
| 159 | 165 |
| 160 friend class Iterator; | 166 friend class Iterator; |
| 161 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); | 167 DISALLOW_COPY_AND_ASSIGN(PictureLayerTilingSet); |
| 162 }; | 168 }; |
| 163 | 169 |
| 164 } // namespace cc | 170 } // namespace cc |
| 165 | 171 |
| 166 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ | 172 #endif // CC_RESOURCES_PICTURE_LAYER_TILING_SET_H_ |
| OLD | NEW |