| 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 11 matching lines...) Expand all Loading... |
| 22 namespace cc { | 22 namespace cc { |
| 23 | 23 |
| 24 struct AppendQuadsData; | 24 struct AppendQuadsData; |
| 25 class MicroBenchmarkImpl; | 25 class MicroBenchmarkImpl; |
| 26 class Tile; | 26 class Tile; |
| 27 | 27 |
| 28 class CC_EXPORT PictureLayerImpl | 28 class CC_EXPORT PictureLayerImpl |
| 29 : public LayerImpl, | 29 : public LayerImpl, |
| 30 NON_EXPORTED_BASE(public PictureLayerTilingClient) { | 30 NON_EXPORTED_BASE(public PictureLayerTilingClient) { |
| 31 public: | 31 public: |
| 32 struct CC_EXPORT Pair { | |
| 33 Pair(); | |
| 34 Pair(PictureLayerImpl* active_layer, PictureLayerImpl* pending_layer); | |
| 35 ~Pair(); | |
| 36 | |
| 37 PictureLayerImpl* active; | |
| 38 PictureLayerImpl* pending; | |
| 39 }; | |
| 40 | |
| 41 static scoped_ptr<PictureLayerImpl> Create( | 32 static scoped_ptr<PictureLayerImpl> Create( |
| 42 LayerTreeImpl* tree_impl, | 33 LayerTreeImpl* tree_impl, |
| 43 int id, | 34 int id, |
| 44 bool is_mask, | 35 bool is_mask, |
| 45 scoped_refptr<SyncedScrollOffset> scroll_offset) { | 36 scoped_refptr<SyncedScrollOffset> scroll_offset) { |
| 46 return make_scoped_ptr( | 37 return make_scoped_ptr( |
| 47 new PictureLayerImpl(tree_impl, id, is_mask, scroll_offset)); | 38 new PictureLayerImpl(tree_impl, id, is_mask, scroll_offset)); |
| 48 } | 39 } |
| 49 ~PictureLayerImpl() override; | 40 ~PictureLayerImpl() override; |
| 50 | 41 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 const gfx::Rect& content_rect) override; | 61 const gfx::Rect& content_rect) override; |
| 71 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; | 62 gfx::Size CalculateTileSize(const gfx::Size& content_bounds) const override; |
| 72 const Region* GetPendingInvalidation() override; | 63 const Region* GetPendingInvalidation() override; |
| 73 const PictureLayerTiling* GetPendingOrActiveTwinTiling( | 64 const PictureLayerTiling* GetPendingOrActiveTwinTiling( |
| 74 const PictureLayerTiling* tiling) const override; | 65 const PictureLayerTiling* tiling) const override; |
| 75 PictureLayerTiling* GetRecycledTwinTiling( | 66 PictureLayerTiling* GetRecycledTwinTiling( |
| 76 const PictureLayerTiling* tiling) override; | 67 const PictureLayerTiling* tiling) override; |
| 77 TilePriority::PriorityBin GetMaxTilePriorityBin() const override; | 68 TilePriority::PriorityBin GetMaxTilePriorityBin() const override; |
| 78 WhichTree GetTree() const override; | 69 WhichTree GetTree() const override; |
| 79 bool RequiresHighResToDraw() const override; | 70 bool RequiresHighResToDraw() const override; |
| 71 bool HasValidTilePriorities() const override; |
| 80 | 72 |
| 81 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source, | 73 void UpdateRasterSource(scoped_refptr<RasterSource> raster_source, |
| 82 Region* new_invalidation, | 74 Region* new_invalidation, |
| 83 const PictureLayerTilingSet* pending_set); | 75 const PictureLayerTilingSet* pending_set); |
| 84 | 76 |
| 85 // Mask-related functions. | 77 // Mask-related functions. |
| 86 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, | 78 void GetContentsResourceId(ResourceProvider::ResourceId* resource_id, |
| 87 gfx::Size* resource_size) const override; | 79 gfx::Size* resource_size) const override; |
| 88 | 80 |
| 89 void SetNearestNeighbor(bool nearest_neighbor); | 81 void SetNearestNeighbor(bool nearest_neighbor); |
| 90 | 82 |
| 91 size_t GPUMemoryUsageInBytes() const override; | 83 size_t GPUMemoryUsageInBytes() const override; |
| 92 | 84 |
| 93 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; | 85 void RunMicroBenchmark(MicroBenchmarkImpl* benchmark) override; |
| 94 | 86 |
| 95 bool CanHaveTilings() const; | 87 bool CanHaveTilings() const; |
| 96 | 88 |
| 97 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } | 89 PictureLayerTilingSet* picture_layer_tiling_set() { return tilings_.get(); } |
| 98 | 90 |
| 99 // Functions used by tile manager. | 91 // Functions used by tile manager. |
| 100 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; | 92 PictureLayerImpl* GetPendingOrActiveTwinLayer() const; |
| 101 bool IsOnActiveOrPendingTree() const; | 93 bool IsOnActiveOrPendingTree() const; |
| 102 // Virtual for testing. | |
| 103 virtual bool HasValidTilePriorities() const; | |
| 104 | 94 |
| 105 // Used for benchmarking | 95 // Used for benchmarking |
| 106 RasterSource* GetRasterSource() const { return raster_source_.get(); } | 96 RasterSource* GetRasterSource() const { return raster_source_.get(); } |
| 107 | 97 |
| 108 protected: | 98 protected: |
| 109 friend class LayerRasterTileIterator; | 99 friend class LayerRasterTileIterator; |
| 110 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; | 100 using TileRequirementCheck = bool (PictureLayerTiling::*)(const Tile*) const; |
| 111 | 101 |
| 112 PictureLayerImpl(LayerTreeImpl* tree_impl, | 102 PictureLayerImpl(LayerTreeImpl* tree_impl, |
| 113 int id, | 103 int id, |
| (...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 // of comparing pointers, since objects pointed to are not guaranteed to | 167 // of comparing pointers, since objects pointed to are not guaranteed to |
| 178 // exist. | 168 // exist. |
| 179 std::vector<PictureLayerTiling*> last_append_quads_tilings_; | 169 std::vector<PictureLayerTiling*> last_append_quads_tilings_; |
| 180 | 170 |
| 181 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); | 171 DISALLOW_COPY_AND_ASSIGN(PictureLayerImpl); |
| 182 }; | 172 }; |
| 183 | 173 |
| 184 } // namespace cc | 174 } // namespace cc |
| 185 | 175 |
| 186 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ | 176 #endif // CC_LAYERS_PICTURE_LAYER_IMPL_H_ |
| OLD | NEW |