| 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_TILE_MANAGER_H_ | 5 #ifndef CC_RESOURCES_TILE_MANAGER_H_ |
| 6 #define CC_RESOURCES_TILE_MANAGER_H_ | 6 #define CC_RESOURCES_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | 10 #include <set> |
| 11 #include <utility> | 11 #include <utility> |
| 12 #include <vector> | 12 #include <vector> |
| 13 | 13 |
| 14 #include "base/containers/hash_tables.h" | 14 #include "base/containers/hash_tables.h" |
| 15 #include "base/memory/scoped_ptr.h" | 15 #include "base/memory/scoped_ptr.h" |
| 16 #include "base/values.h" | 16 #include "base/values.h" |
| 17 #include "cc/base/ref_counted_managed.h" | 17 #include "cc/base/ref_counted_managed.h" |
| 18 #include "cc/base/unique_notifier.h" | 18 #include "cc/base/unique_notifier.h" |
| 19 #include "cc/debug/rendering_stats_instrumentation.h" | 19 #include "cc/debug/rendering_stats_instrumentation.h" |
| 20 #include "cc/resources/eviction_tile_priority_queue.h" | 20 #include "cc/resources/eviction_tile_priority_queue.h" |
| 21 #include "cc/resources/managed_tile_state.h" | 21 #include "cc/resources/managed_tile_state.h" |
| 22 #include "cc/resources/memory_history.h" | 22 #include "cc/resources/memory_history.h" |
| 23 #include "cc/resources/picture_pile_impl.h" | 23 #include "cc/resources/picture_pile_impl.h" |
| 24 #include "cc/resources/prioritized_tile_set.h" | 24 #include "cc/resources/prioritized_tile_set.h" |
| 25 #include "cc/resources/raster_tile_priority_queue.h" | 25 #include "cc/resources/raster_tile_priority_queue.h" |
| 26 #include "cc/resources/rasterizer.h" | 26 #include "cc/resources/rasterizer.h" |
| 27 #include "cc/resources/resource_pool.h" | 27 #include "cc/resources/resource_pool.h" |
| 28 #include "cc/resources/tile.h" | 28 #include "cc/resources/tile.h" |
| 29 | 29 |
| 30 namespace base { |
| 31 namespace debug { |
| 32 class ConvertableToTraceFormat; |
| 33 class TracedValue; |
| 34 } |
| 35 } |
| 36 |
| 30 namespace cc { | 37 namespace cc { |
| 31 class PictureLayerImpl; | 38 class PictureLayerImpl; |
| 32 class ResourceProvider; | 39 class ResourceProvider; |
| 33 | 40 |
| 34 class CC_EXPORT TileManagerClient { | 41 class CC_EXPORT TileManagerClient { |
| 35 public: | 42 public: |
| 36 // Returns the set of layers that the tile manager should consider for raster. | 43 // Returns the set of layers that the tile manager should consider for raster. |
| 37 // TODO(vmpstr): Change the way we determine if we are ready to activate, so | 44 // TODO(vmpstr): Change the way we determine if we are ready to activate, so |
| 38 // that this can be removed. | 45 // that this can be removed. |
| 39 virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() const = 0; | 46 virtual const std::vector<PictureLayerImpl*>& GetPictureLayers() const = 0; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 63 protected: | 70 protected: |
| 64 virtual ~TileManagerClient() {} | 71 virtual ~TileManagerClient() {} |
| 65 }; | 72 }; |
| 66 | 73 |
| 67 struct RasterTaskCompletionStats { | 74 struct RasterTaskCompletionStats { |
| 68 RasterTaskCompletionStats(); | 75 RasterTaskCompletionStats(); |
| 69 | 76 |
| 70 size_t completed_count; | 77 size_t completed_count; |
| 71 size_t canceled_count; | 78 size_t canceled_count; |
| 72 }; | 79 }; |
| 73 scoped_ptr<base::Value> RasterTaskCompletionStatsAsValue( | 80 scoped_refptr<base::debug::ConvertableToTraceFormat> |
| 74 const RasterTaskCompletionStats& stats); | 81 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
| 75 | 82 |
| 76 // This class manages tiles, deciding which should get rasterized and which | 83 // This class manages tiles, deciding which should get rasterized and which |
| 77 // should no longer have any memory assigned to them. Tile objects are "owned" | 84 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 78 // by layers; they automatically register with the manager when they are | 85 // by layers; they automatically register with the manager when they are |
| 79 // created, and unregister from the manager when they are deleted. | 86 // created, and unregister from the manager when they are deleted. |
| 80 class CC_EXPORT TileManager : public RasterizerClient, | 87 class CC_EXPORT TileManager : public RasterizerClient, |
| 81 public RefCountedManager<Tile> { | 88 public RefCountedManager<Tile> { |
| 82 public: | 89 public: |
| 83 static scoped_ptr<TileManager> Create( | 90 static scoped_ptr<TileManager> Create( |
| 84 TileManagerClient* client, | 91 TileManagerClient* client, |
| (...skipping 10 matching lines...) Expand all Loading... |
| 95 | 102 |
| 96 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, | 103 scoped_refptr<Tile> CreateTile(PicturePileImpl* picture_pile, |
| 97 const gfx::Size& tile_size, | 104 const gfx::Size& tile_size, |
| 98 const gfx::Rect& content_rect, | 105 const gfx::Rect& content_rect, |
| 99 const gfx::Rect& opaque_rect, | 106 const gfx::Rect& opaque_rect, |
| 100 float contents_scale, | 107 float contents_scale, |
| 101 int layer_id, | 108 int layer_id, |
| 102 int source_frame_number, | 109 int source_frame_number, |
| 103 int flags); | 110 int flags); |
| 104 | 111 |
| 105 scoped_ptr<base::Value> BasicStateAsValue() const; | 112 scoped_refptr<base::debug::ConvertableToTraceFormat> BasicStateAsValue() |
| 106 scoped_ptr<base::Value> AllTilesAsValue() const; | 113 const; |
| 114 void BasicStateAsValueInto(base::debug::TracedValue* dict) const; |
| 115 void AllTilesAsValueInto(base::debug::TracedValue* array) const; |
| 107 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 116 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
| 108 return memory_stats_from_last_assign_; | 117 return memory_stats_from_last_assign_; |
| 109 } | 118 } |
| 110 | 119 |
| 111 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 120 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 112 for (size_t i = 0; i < tiles.size(); ++i) { | 121 for (size_t i = 0; i < tiles.size(); ++i) { |
| 113 ManagedTileState& mts = tiles[i]->managed_state(); | 122 ManagedTileState& mts = tiles[i]->managed_state(); |
| 114 ManagedTileState::TileVersion& tile_version = | 123 ManagedTileState::TileVersion& tile_version = |
| 115 mts.tile_versions[HIGH_QUALITY_RASTER_MODE]; | 124 mts.tile_versions[HIGH_QUALITY_RASTER_MODE]; |
| 116 | 125 |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; | 258 std::vector<scoped_refptr<RasterTask> > orphan_raster_tasks_; |
| 250 | 259 |
| 251 UniqueNotifier ready_to_activate_check_notifier_; | 260 UniqueNotifier ready_to_activate_check_notifier_; |
| 252 | 261 |
| 253 DISALLOW_COPY_AND_ASSIGN(TileManager); | 262 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 254 }; | 263 }; |
| 255 | 264 |
| 256 } // namespace cc | 265 } // namespace cc |
| 257 | 266 |
| 258 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 267 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |