| 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> |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 // PictureLayerTilingClient overrides. | 119 // PictureLayerTilingClient overrides. |
| 120 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, | 120 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, |
| 121 const gfx::Rect& content_rect) override; | 121 const gfx::Rect& content_rect) override; |
| 122 RasterSource* GetRasterSource() override; | 122 RasterSource* GetRasterSource() override; |
| 123 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 123 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
| 124 const Region* GetPendingInvalidation() override; | 124 const Region* GetPendingInvalidation() override; |
| 125 const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 125 const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
| 126 const PictureLayerTiling* tiling) const override; | 126 const PictureLayerTiling* tiling) const override; |
| 127 PictureLayerTiling* GetRecycledTwinTiling( | 127 PictureLayerTiling* GetRecycledTwinTiling( |
| 128 const PictureLayerTiling* tiling) override; | 128 const PictureLayerTiling* tiling) override; |
| 129 TilePriority::PriorityBin GetMaxTilePriorityBin() const override; |
| 129 size_t GetMaxTilesForInterestArea() const override; | 130 size_t GetMaxTilesForInterestArea() const override; |
| 130 float GetSkewportTargetTimeInSeconds() const override; | 131 float GetSkewportTargetTimeInSeconds() const override; |
| 131 int GetSkewportExtrapolationLimitInContentPixels() const override; | 132 int GetSkewportExtrapolationLimitInContentPixels() const override; |
| 132 WhichTree GetTree() const override; | 133 WhichTree GetTree() const override; |
| 133 bool RequiresHighResToDraw() const override; | 134 bool RequiresHighResToDraw() const override; |
| 134 | 135 |
| 135 // PushPropertiesTo active tree => pending tree. | 136 // PushPropertiesTo active tree => pending tree. |
| 136 void SyncTiling(const PictureLayerTiling* tiling); | 137 void SyncTiling(const PictureLayerTiling* tiling); |
| 137 | 138 |
| 138 // Mask-related functions. | 139 // Mask-related functions. |
| 139 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 140 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
| 140 gfx::Size* resource_size) const override; | 141 gfx::Size* resource_size) const override; |
| 141 | 142 |
| 142 size_t GPUMemoryUsageInBytes() const override; | 143 size_t GPUMemoryUsageInBytes() const override; |
| 143 | 144 |
| 144 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 145 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
| 145 | 146 |
| 146 // Functions used by tile manager. | 147 // Functions used by tile manager. |
| 147 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 148 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
| 148 bool IsOnActiveOrPendingTree() const; | 149 bool IsOnActiveOrPendingTree() const; |
| 149 // Virtual for testing. | 150 // Virtual for testing. |
| 150 virtual bool HasValidTilePriorities() const; | 151 virtual bool HasValidTilePriorities() const; |
| 151 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 152 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
| 153 bool AllTilesRequiredForDrawAreReadyToDraw() const; |
| 152 | 154 |
| 153 protected: | 155 protected: |
| 154 friend class LayerRasterTileIterator; | 156 friend class LayerRasterTileIterator; |
| 157 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
| 155 | 158 |
| 156 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); | 159 PictureLayerImpl(LayerTreeImpl* tree_impl, int id); |
| 157 PictureLayerTiling* AddTiling(float contents_scale); | 160 PictureLayerTiling* AddTiling(float contents_scale); |
| 158 void RemoveTiling(float contents_scale); | 161 void RemoveTiling(float contents_scale); |
| 159 void RemoveAllTilings(); | 162 void RemoveAllTilings(); |
| 160 void SyncFromActiveLayer(const PictureLayerImpl* other); | 163 void SyncFromActiveLayer(const PictureLayerImpl* other); |
| 161 void AddTilingsForRasterScale(); | 164 void AddTilingsForRasterScale(); |
| 162 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); | 165 void UpdateTilePriorities(const Occlusion& occlusion_in_content_space); |
| 163 virtual bool ShouldAdjustRasterScale() const; | 166 virtual bool ShouldAdjustRasterScale() const; |
| 164 virtual void RecalculateRasterScales(); | 167 virtual void RecalculateRasterScales(); |
| 165 void CleanUpTilingsOnActiveLayer( | 168 void CleanUpTilingsOnActiveLayer( |
| 166 std::vector<PictureLayerTiling*> used_tilings); | 169 std::vector<PictureLayerTiling*> used_tilings); |
| 167 float MinimumContentsScale() const; | 170 float MinimumContentsScale() const; |
| 168 float SnappedContentsScale(float new_contents_scale); | 171 float SnappedContentsScale(float new_contents_scale); |
| 169 void ResetRasterScale(); | 172 void ResetRasterScale(); |
| 170 gfx::Rect GetViewportForTilePriorityInContentSpace() const; | 173 gfx::Rect GetViewportForTilePriorityInContentSpace() const; |
| 171 PictureLayerImpl* GetRecycledTwinLayer() const; | 174 PictureLayerImpl* GetRecycledTwinLayer() const; |
| 172 void UpdatePile(scoped_refptr<PicturePileImpl> pile); | 175 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source); |
| 173 | 176 |
| 174 void DoPostCommitInitializationIfNeeded() { | 177 void DoPostCommitInitializationIfNeeded() { |
| 175 if (needs_post_commit_initialization_) | 178 if (needs_post_commit_initialization_) |
| 176 DoPostCommitInitialization(); | 179 DoPostCommitInitialization(); |
| 177 } | 180 } |
| 178 void DoPostCommitInitialization(); | 181 void DoPostCommitInitialization(); |
| 179 | 182 |
| 180 bool CanHaveTilings() const; | 183 bool CanHaveTilings() const; |
| 181 bool CanHaveTilingWithScale(float contents_scale) const; | 184 bool CanHaveTilingWithScale(float contents_scale) const; |
| 182 void SanityCheckTilingState() const; | 185 void SanityCheckTilingState() const; |
| 186 // Checks if all tiles required for a certain action (e.g. activation) are |
| 187 // ready to draw. is_tile_required_callback gets called on all candidate |
| 188 // tiles and returns true if the tile is required for the action. |
| 189 bool AllTilesRequiredAreReadyToDraw( |
| 190 TileRequirementCheck is_tile_required_callback) const; |
| 183 | 191 |
| 184 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; | 192 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; |
| 185 | 193 |
| 186 void GetDebugBorderProperties(SkColor* color, float* width) const override; | 194 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
| 187 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const override; | 195 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const override; |
| 188 void AsValueInto(base::debug::TracedValue* dict) const override; | 196 void AsValueInto(base::debug::TracedValue* dict) const override; |
| 189 | 197 |
| 190 virtual void UpdateIdealScales(); | 198 virtual void UpdateIdealScales(); |
| 191 float MaximumTilingContentsScale() const; | 199 float MaximumTilingContentsScale() const; |
| 192 | 200 |
| 193 PictureLayerImpl* twin_layer_; | 201 PictureLayerImpl* twin_layer_; |
| 194 | 202 |
| 195 scoped_ptr<PictureLayerTilingSet> tilings_; | 203 scoped_ptr<PictureLayerTilingSet> tilings_; |
| 196 scoped_refptr<PicturePileImpl> pile_; | 204 scoped_refptr<RasterSource> raster_source_; |
| 197 Region invalidation_; | 205 Region invalidation_; |
| 198 | 206 |
| 199 float ideal_page_scale_; | 207 float ideal_page_scale_; |
| 200 float ideal_device_scale_; | 208 float ideal_device_scale_; |
| 201 float ideal_source_scale_; | 209 float ideal_source_scale_; |
| 202 float ideal_contents_scale_; | 210 float ideal_contents_scale_; |
| 203 | 211 |
| 204 float raster_page_scale_; | 212 float raster_page_scale_; |
| 205 float raster_device_scale_; | 213 float raster_device_scale_; |
| 206 float raster_source_scale_; | 214 float raster_source_scale_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 223 // frame that has a valid viewport for prioritizing tiles. | 231 // frame that has a valid viewport for prioritizing tiles. |
| 224 gfx::Rect visible_rect_for_tile_priority_; | 232 gfx::Rect visible_rect_for_tile_priority_; |
| 225 | 233 |
| 226 friend class PictureLayer; | 234 friend class PictureLayer; |
| 227 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 235 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 228 }; | 236 }; |
| 229 | 237 |
| 230 } // namespace cc | 238 } // namespace cc |
| 231 | 239 |
| 232 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 240 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |