| 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> |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 #include "cc/resources/resource_pool.h" | 23 #include "cc/resources/resource_pool.h" |
| 24 #include "cc/resources/tile.h" | 24 #include "cc/resources/tile.h" |
| 25 #include "cc/resources/tile_draw_info.h" | 25 #include "cc/resources/tile_draw_info.h" |
| 26 #include "cc/resources/tile_task_runner.h" | 26 #include "cc/resources/tile_task_runner.h" |
| 27 | 27 |
| 28 namespace base { | 28 namespace base { |
| 29 namespace trace_event { | 29 namespace trace_event { |
| 30 class ConvertableToTraceFormat; | 30 class ConvertableToTraceFormat; |
| 31 class TracedValue; | 31 class TracedValue; |
| 32 } | 32 } |
| 33 | |
| 34 // TODO(ssid): remove these aliases after the tracing clients are moved to the | |
| 35 // new trace_event namespace. See crbug.com/451032. ETA: March 2015 | |
| 36 namespace debug { | |
| 37 using ::base::trace_event::ConvertableToTraceFormat; | |
| 38 using ::base::trace_event::TracedValue; | |
| 39 } | 33 } |
| 40 } // namespace base | |
| 41 | 34 |
| 42 namespace cc { | 35 namespace cc { |
| 43 class PictureLayerImpl; | 36 class PictureLayerImpl; |
| 44 class Rasterizer; | 37 class Rasterizer; |
| 45 class ResourceProvider; | 38 class ResourceProvider; |
| 46 | 39 |
| 47 class CC_EXPORT TileManagerClient { | 40 class CC_EXPORT TileManagerClient { |
| 48 public: | 41 public: |
| 49 // Called when all tiles marked as required for activation are ready to draw. | 42 // Called when all tiles marked as required for activation are ready to draw. |
| 50 virtual void NotifyReadyToActivate() = 0; | 43 virtual void NotifyReadyToActivate() = 0; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 80 protected: | 73 protected: |
| 81 virtual ~TileManagerClient() {} | 74 virtual ~TileManagerClient() {} |
| 82 }; | 75 }; |
| 83 | 76 |
| 84 struct RasterTaskCompletionStats { | 77 struct RasterTaskCompletionStats { |
| 85 RasterTaskCompletionStats(); | 78 RasterTaskCompletionStats(); |
| 86 | 79 |
| 87 size_t completed_count; | 80 size_t completed_count; |
| 88 size_t canceled_count; | 81 size_t canceled_count; |
| 89 }; | 82 }; |
| 90 scoped_refptr<base::debug::ConvertableToTraceFormat> | 83 scoped_refptr<base::trace_event::ConvertableToTraceFormat> |
| 91 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); | 84 RasterTaskCompletionStatsAsValue(const RasterTaskCompletionStats& stats); |
| 92 | 85 |
| 93 // This class manages tiles, deciding which should get rasterized and which | 86 // This class manages tiles, deciding which should get rasterized and which |
| 94 // should no longer have any memory assigned to them. Tile objects are "owned" | 87 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 95 // by layers; they automatically register with the manager when they are | 88 // by layers; they automatically register with the manager when they are |
| 96 // created, and unregister from the manager when they are deleted. | 89 // created, and unregister from the manager when they are deleted. |
| 97 class CC_EXPORT TileManager : public TileTaskRunnerClient, | 90 class CC_EXPORT TileManager : public TileTaskRunnerClient, |
| 98 public RefCountedManager<Tile> { | 91 public RefCountedManager<Tile> { |
| 99 public: | 92 public: |
| 100 enum NamedTaskSet { | 93 enum NamedTaskSet { |
| 101 REQUIRED_FOR_ACTIVATION, | 94 REQUIRED_FOR_ACTIVATION, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 128 void UpdateVisibleTiles(const GlobalStateThatImpactsTilePriority& state); | 121 void UpdateVisibleTiles(const GlobalStateThatImpactsTilePriority& state); |
| 129 | 122 |
| 130 scoped_refptr<Tile> CreateTile(RasterSource* raster_source, | 123 scoped_refptr<Tile> CreateTile(RasterSource* raster_source, |
| 131 const gfx::Size& desired_texture_size, | 124 const gfx::Size& desired_texture_size, |
| 132 const gfx::Rect& content_rect, | 125 const gfx::Rect& content_rect, |
| 133 float contents_scale, | 126 float contents_scale, |
| 134 int layer_id, | 127 int layer_id, |
| 135 int source_frame_number, | 128 int source_frame_number, |
| 136 int flags); | 129 int flags); |
| 137 | 130 |
| 138 scoped_refptr<base::debug::ConvertableToTraceFormat> BasicStateAsValue() | 131 scoped_refptr<base::trace_event::ConvertableToTraceFormat> BasicStateAsValue() |
| 139 const; | 132 const; |
| 140 void BasicStateAsValueInto(base::debug::TracedValue* dict) const; | 133 void BasicStateAsValueInto(base::trace_event::TracedValue* dict) const; |
| 141 const MemoryHistory::Entry& memory_stats_from_last_assign() const { | 134 const MemoryHistory::Entry& memory_stats_from_last_assign() const { |
| 142 return memory_stats_from_last_assign_; | 135 return memory_stats_from_last_assign_; |
| 143 } | 136 } |
| 144 | 137 |
| 145 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { | 138 void InitializeTilesWithResourcesForTesting(const std::vector<Tile*>& tiles) { |
| 146 for (size_t i = 0; i < tiles.size(); ++i) { | 139 for (size_t i = 0; i < tiles.size(); ++i) { |
| 147 TileDrawInfo& draw_info = tiles[i]->draw_info(); | 140 TileDrawInfo& draw_info = tiles[i]->draw_info(); |
| 148 draw_info.resource_ = resource_pool_->AcquireResource( | 141 draw_info.resource_ = resource_pool_->AcquireResource( |
| 149 tiles[i]->desired_texture_size(), | 142 tiles[i]->desired_texture_size(), |
| 150 tile_task_runner_->GetResourceFormat()); | 143 tile_task_runner_->GetResourceFormat()); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 | 311 |
| 319 bool did_notify_ready_to_activate_; | 312 bool did_notify_ready_to_activate_; |
| 320 bool did_notify_ready_to_draw_; | 313 bool did_notify_ready_to_draw_; |
| 321 | 314 |
| 322 DISALLOW_COPY_AND_ASSIGN(TileManager); | 315 DISALLOW_COPY_AND_ASSIGN(TileManager); |
| 323 }; | 316 }; |
| 324 | 317 |
| 325 } // namespace cc | 318 } // namespace cc |
| 326 | 319 |
| 327 #endif // CC_RESOURCES_TILE_MANAGER_H_ | 320 #endif // CC_RESOURCES_TILE_MANAGER_H_ |
| OLD | NEW |