| 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_LAYERS_PICTURE_LAYER_IMPL_H_ | 5 #ifndef CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 6 #define CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "cc/base/cc_export.h" | 12 #include "cc/base/cc_export.h" |
| 13 #include "cc/base/scoped_ptr_vector.h" | 13 #include "cc/base/scoped_ptr_vector.h" |
| 14 #include "cc/layers/layer_impl.h" | 14 #include "cc/layers/layer_impl.h" |
| 15 #include "cc/resources/picture_layer_tiling.h" | 15 #include "cc/resources/picture_layer_tiling.h" |
| 16 #include "cc/resources/picture_layer_tiling_set.h" | 16 #include "cc/resources/picture_layer_tiling_set.h" |
| 17 #include "cc/resources/picture_pile_impl.h" | 17 #include "cc/resources/picture_pile_impl.h" |
| 18 #include "cc/resources/tiling_set_eviction_queue.h" |
| 18 #include "skia/ext/refptr.h" | 19 #include "skia/ext/refptr.h" |
| 19 #include "third_party/skia/include/core/SkPicture.h" | 20 #include "third_party/skia/include/core/SkPicture.h" |
| 20 | 21 |
| 21 namespace cc { | 22 namespace cc { |
| 22 | 23 |
| 23 struct AppendQuadsData; | 24 struct AppendQuadsData; |
| 24 class MicroBenchmarkImpl; | 25 class MicroBenchmarkImpl; |
| 25 class Tile; | 26 class Tile; |
| 26 | 27 |
| 27 class CC_EXPORT PictureLayerImpl | 28 class CC_EXPORT PictureLayerImpl |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 TilePriority::PriorityBin tile_type; | 61 TilePriority::PriorityBin tile_type; |
| 61 }; | 62 }; |
| 62 | 63 |
| 63 size_t current_stage_; | 64 size_t current_stage_; |
| 64 | 65 |
| 65 // One low res stage, and three high res stages. | 66 // One low res stage, and three high res stages. |
| 66 IterationStage stages_[4]; | 67 IterationStage stages_[4]; |
| 67 PictureLayerTiling::TilingRasterTileIterator iterators_[NUM_ITERATORS]; | 68 PictureLayerTiling::TilingRasterTileIterator iterators_[NUM_ITERATORS]; |
| 68 }; | 69 }; |
| 69 | 70 |
| 70 class CC_EXPORT LayerEvictionTileIterator { | |
| 71 public: | |
| 72 LayerEvictionTileIterator(); | |
| 73 LayerEvictionTileIterator(PictureLayerImpl* layer, | |
| 74 TreePriority tree_priority); | |
| 75 ~LayerEvictionTileIterator(); | |
| 76 | |
| 77 Tile* operator*(); | |
| 78 const Tile* operator*() const; | |
| 79 LayerEvictionTileIterator& operator++(); | |
| 80 operator bool() const; | |
| 81 | |
| 82 private: | |
| 83 bool AdvanceToNextCategory(); | |
| 84 bool AdvanceToNextTilingRangeType(); | |
| 85 bool AdvanceToNextTiling(); | |
| 86 | |
| 87 PictureLayerTilingSet::TilingRange CurrentTilingRange() const; | |
| 88 size_t CurrentTilingIndex() const; | |
| 89 | |
| 90 PictureLayerImpl* layer_; | |
| 91 TreePriority tree_priority_; | |
| 92 | |
| 93 PictureLayerTiling::EvictionCategory current_category_; | |
| 94 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_; | |
| 95 size_t current_tiling_; | |
| 96 PictureLayerTiling::TilingEvictionTileIterator current_iterator_; | |
| 97 }; | |
| 98 | |
| 99 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 71 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 100 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); | 72 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); |
| 101 } | 73 } |
| 102 ~PictureLayerImpl() override; | 74 ~PictureLayerImpl() override; |
| 103 | 75 |
| 76 scoped_ptr<TilingSetEvictionQueue> CreateEvictionQueue( |
| 77 TreePriority tree_priority); |
| 78 |
| 104 // LayerImpl overrides. | 79 // LayerImpl overrides. |
| 105 const char* LayerTypeAsString() const override; | 80 const char* LayerTypeAsString() const override; |
| 106 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; | 81 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 107 void PushPropertiesTo(LayerImpl* layer) override; | 82 void PushPropertiesTo(LayerImpl* layer) override; |
| 108 void AppendQuads(RenderPass* render_pass, | 83 void AppendQuads(RenderPass* render_pass, |
| 109 const Occlusion& occlusion_in_content_space, | 84 const Occlusion& occlusion_in_content_space, |
| 110 AppendQuadsData* append_quads_data) override; | 85 AppendQuadsData* append_quads_data) override; |
| 111 void UpdateTiles(const Occlusion& occlusion_in_content_space, | 86 void UpdateTiles(const Occlusion& occlusion_in_content_space, |
| 112 bool resourceless_software_draw) override; | 87 bool resourceless_software_draw) override; |
| 113 void NotifyTileStateChanged(const Tile* tile) override; | 88 void NotifyTileStateChanged(const Tile* tile) override; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 bool CanHaveTilings() const; | 122 bool CanHaveTilings() const; |
| 148 | 123 |
| 149 // Functions used by tile manager. | 124 // Functions used by tile manager. |
| 150 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 125 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
| 151 bool IsOnActiveOrPendingTree() const; | 126 bool IsOnActiveOrPendingTree() const; |
| 152 // Virtual for testing. | 127 // Virtual for testing. |
| 153 virtual bool HasValidTilePriorities() const; | 128 virtual bool HasValidTilePriorities() const; |
| 154 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 129 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
| 155 bool AllTilesRequiredForDrawAreReadyToDraw() const; | 130 bool AllTilesRequiredForDrawAreReadyToDraw() const; |
| 156 | 131 |
| 132 // Used for benchmarking |
| 133 const RasterSource* GetRasterSource() const { return raster_source_.get(); } |
| 134 |
| 157 protected: | 135 protected: |
| 158 friend class LayerRasterTileIterator; | 136 friend class LayerRasterTileIterator; |
| 159 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; | 137 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
| 160 | 138 |
| 161 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 139 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 162 PictureLayerTiling* AddTiling(float contents_scale); | 140 PictureLayerTiling* AddTiling(float contents_scale); |
| 163 void RemoveAllTilings(); | 141 void RemoveAllTilings(); |
| 164 void SyncFromActiveLayer(const PictureLayerImpl* other); | 142 void SyncFromActiveLayer(const PictureLayerImpl* other); |
| 165 void AddTilingsForRasterScale(); | 143 void AddTilingsForRasterScale(); |
| 166 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 144 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 // frame that has a valid viewport for prioritizing tiles. | 209 // frame that has a valid viewport for prioritizing tiles. |
| 232 gfx::Rect visible_rect_for_tile_priority_; | 210 gfx::Rect visible_rect_for_tile_priority_; |
| 233 | 211 |
| 234 friend class PictureLayer; | 212 friend class PictureLayer; |
| 235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 213 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 236 }; | 214 }; |
| 237 | 215 |
| 238 } // namespace cc | 216 } // namespace cc |
| 239 | 217 |
| 240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 218 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |