| 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 | 92 |
| 93 PictureLayerTiling::EvictionCategory current_category_; | 93 PictureLayerTiling::EvictionCategory current_category_; |
| 94 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_; | 94 PictureLayerTilingSet::TilingRangeType current_tiling_range_type_; |
| 95 size_t current_tiling_; | 95 size_t current_tiling_; |
| 96 PictureLayerTiling::TilingEvictionTileIterator current_iterator_; | 96 PictureLayerTiling::TilingEvictionTileIterator current_iterator_; |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { | 99 static scoped_ptr<PictureLayerImpl> Create(LayerTreeImpl* tree_impl, int id) { |
| 100 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); | 100 return make_scoped_ptr(new PictureLayerImpl(tree_impl, id)); |
| 101 } | 101 } |
| 102 virtual ~PictureLayerImpl(); | 102 ~PictureLayerImpl() override; |
| 103 | 103 |
| 104 // LayerImpl overrides. | 104 // LayerImpl overrides. |
| 105 virtual const char* LayerTypeAsString() const override; | 105 const char* LayerTypeAsString() const override; |
| 106 virtual scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) | 106 scoped_ptr<LayerImpl> CreateLayerImpl(LayerTreeImpl* tree_impl) override; |
| 107 override; | 107 void PushPropertiesTo(LayerImpl* layer) override; |
| 108 virtual void PushPropertiesTo(LayerImpl* layer) override; | 108 void AppendQuads(RenderPass* render_pass, |
| 109 virtual void AppendQuads(RenderPass* render_pass, | 109 const Occlusion& occlusion_in_content_space, |
| 110 const Occlusion& occlusion_in_content_space, | 110 AppendQuadsData* append_quads_data) override; |
| 111 AppendQuadsData* append_quads_data) override; | 111 void UpdateTiles(const Occlusion& occlusion_in_content_space, |
| 112 virtual void UpdateTiles(const Occlusion& occlusion_in_content_space, | 112 bool resourceless_software_draw) override; |
| 113 bool resourceless_software_draw) override; | 113 void NotifyTileStateChanged(const Tile* tile) override; |
| 114 virtual void NotifyTileStateChanged(const Tile* tile) override; | 114 void DidBecomeActive() override; |
| 115 virtual void DidBecomeActive() override; | 115 void DidBeginTracing() override; |
| 116 virtual void DidBeginTracing() override; | 116 void ReleaseResources() override; |
| 117 virtual void ReleaseResources() override; | 117 skia::RefPtr<SkPicture> GetPicture() override; |
| 118 virtual skia::RefPtr<SkPicture> GetPicture() override; | |
| 119 | 118 |
| 120 // PictureLayerTilingClient overrides. | 119 // PictureLayerTilingClient overrides. |
| 121 virtual scoped_refptr<Tile> CreateTile( | 120 scoped_refptr<Tile> CreateTile(PictureLayerTiling* tiling, |
| 122 PictureLayerTiling* tiling, | 121 const gfx::Rect& content_rect) override; |
| 123 const gfx::Rect& content_rect) override; | 122 PicturePileImpl* GetPile() override; |
| 124 virtual PicturePileImpl* GetPile() override; | 123 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
| 125 virtual gfx::Size CalculateTileSize( | 124 const Region* GetInvalidation() override; |
| 126 const gfx::Size& content_bounds) const override; | 125 const PictureLayerTiling* GetTwinTiling( |
| 127 virtual const Region* GetInvalidation() override; | |
| 128 virtual const PictureLayerTiling* GetTwinTiling( | |
| 129 const PictureLayerTiling* tiling) const override; | 126 const PictureLayerTiling* tiling) const override; |
| 130 virtual PictureLayerTiling* GetRecycledTwinTiling( | 127 PictureLayerTiling* GetRecycledTwinTiling( |
| 131 const PictureLayerTiling* tiling) override; | 128 const PictureLayerTiling* tiling) override; |
| 132 virtual size_t GetMaxTilesForInterestArea() const override; | 129 size_t GetMaxTilesForInterestArea() const override; |
| 133 virtual float GetSkewportTargetTimeInSeconds() const override; | 130 float GetSkewportTargetTimeInSeconds() const override; |
| 134 virtual int GetSkewportExtrapolationLimitInContentPixels() const override; | 131 int GetSkewportExtrapolationLimitInContentPixels() const override; |
| 135 virtual WhichTree GetTree() const override; | 132 WhichTree GetTree() const override; |
| 136 virtual bool RequiresHighResToDraw() const override; | 133 bool RequiresHighResToDraw() const override; |
| 137 | 134 |
| 138 // PushPropertiesTo active tree => pending tree. | 135 // PushPropertiesTo active tree => pending tree. |
| 139 void SyncTiling(const PictureLayerTiling* tiling); | 136 void SyncTiling(const PictureLayerTiling* tiling); |
| 140 | 137 |
| 141 // Mask-related functions. | 138 // Mask-related functions. |
| 142 virtual void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 139 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
| 143 gfx::Size* resource_size) const override; | 140 gfx::Size* resource_size) const override; |
| 144 | 141 |
| 145 virtual size_t GPUMemoryUsageInBytes() const override; | 142 size_t GPUMemoryUsageInBytes() const override; |
| 146 | 143 |
| 147 virtual void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 144 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
| 148 | 145 |
| 149 // Functions used by tile manager. | 146 // Functions used by tile manager. |
| 150 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } | 147 PictureLayerImpl* GetTwinLayer() { return twin_layer_; } |
| 151 bool IsOnActiveOrPendingTree() const; | 148 bool IsOnActiveOrPendingTree() const; |
| 152 // Virtual for testing. | 149 // Virtual for testing. |
| 153 virtual bool HasValidTilePriorities() const; | 150 virtual bool HasValidTilePriorities() const; |
| 154 bool AllTilesRequiredForActivationAreReadyToDraw() const; | 151 bool AllTilesRequiredForActivationAreReadyToDraw() const; |
| 155 | 152 |
| 156 protected: | 153 protected: |
| 157 friend class LayerRasterTileIterator; | 154 friend class LayerRasterTileIterator; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 178 DoPostCommitInitialization(); | 175 DoPostCommitInitialization(); |
| 179 } | 176 } |
| 180 void DoPostCommitInitialization(); | 177 void DoPostCommitInitialization(); |
| 181 | 178 |
| 182 bool CanHaveTilings() const; | 179 bool CanHaveTilings() const; |
| 183 bool CanHaveTilingWithScale(float contents_scale) const; | 180 bool CanHaveTilingWithScale(float contents_scale) const; |
| 184 void SanityCheckTilingState() const; | 181 void SanityCheckTilingState() const; |
| 185 | 182 |
| 186 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; | 183 bool ShouldAdjustRasterScaleDuringScaleAnimations() const; |
| 187 | 184 |
| 188 virtual void GetDebugBorderProperties( | 185 void GetDebugBorderProperties(SkColor* color, float* width) const override; |
| 189 SkColor* color, float* width) const override; | 186 void GetAllTilesForTracing(std::set<const Tile*>* tiles) const override; |
| 190 virtual void GetAllTilesForTracing( | 187 void AsValueInto(base::debug::TracedValue* dict) const override; |
| 191 std::set<const Tile*>* tiles) const override; | |
| 192 virtual void AsValueInto(base::debug::TracedValue* dict) const override; | |
| 193 | 188 |
| 194 virtual void UpdateIdealScales(); | 189 virtual void UpdateIdealScales(); |
| 195 float MaximumTilingContentsScale() const; | 190 float MaximumTilingContentsScale() const; |
| 196 | 191 |
| 197 PictureLayerImpl* twin_layer_; | 192 PictureLayerImpl* twin_layer_; |
| 198 | 193 |
| 199 scoped_ptr<PictureLayerTilingSet> tilings_; | 194 scoped_ptr<PictureLayerTilingSet> tilings_; |
| 200 scoped_refptr<PicturePileImpl> pile_; | 195 scoped_refptr<PicturePileImpl> pile_; |
| 201 Region invalidation_; | 196 Region invalidation_; |
| 202 | 197 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 227 // frame that has a valid viewport for prioritizing tiles. | 222 // frame that has a valid viewport for prioritizing tiles. |
| 228 gfx::Rect visible_rect_for_tile_priority_; | 223 gfx::Rect visible_rect_for_tile_priority_; |
| 229 | 224 |
| 230 friend class PictureLayer; | 225 friend class PictureLayer; |
| 231 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 226 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 232 }; | 227 }; |
| 233 | 228 |
| 234 } // namespace cc | 229 } // namespace cc |
| 235 | 230 |
| 236 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 231 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |