| 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_TILE_MANAGER_H_ | 5 #ifndef CC_TILE_MANAGER_H_ |
| 6 #define CC_TILE_MANAGER_H_ | 6 #define CC_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/values.h" |
| 11 #include "cc/tile_priority.h" |
| 12 |
| 10 namespace cc { | 13 namespace cc { |
| 11 | 14 |
| 12 class Tile; | 15 class Tile; |
| 16 class TileVersion; |
| 13 class ResourceProvider; | 17 class ResourceProvider; |
| 14 | 18 |
| 15 class TileManagerClient { | 19 class TileManagerClient { |
| 16 public: | 20 public: |
| 17 virtual void ScheduleManage() = 0; | 21 virtual void ScheduleManageTiles() = 0; |
| 18 | 22 |
| 19 protected: | 23 protected: |
| 20 ~TileManagerClient() { } | 24 ~TileManagerClient() { } |
| 21 }; | 25 }; |
| 22 | 26 |
| 23 // This class manages tiles, deciding which should get rasterized and which | 27 // This class manages tiles, deciding which should get rasterized and which |
| 24 // should no longer have any memory assigned to them. Tile objects are "owned" | 28 // should no longer have any memory assigned to them. Tile objects are "owned" |
| 25 // by layers; they automatically register with the manager when they are | 29 // by layers; they automatically register with the manager when they are |
| 26 // created, and unregister from the manager when they are deleted. | 30 // created, and unregister from the manager when they are deleted. |
| 27 class TileManager { | 31 class TileManager { |
| 28 public: | 32 public: |
| 29 TileManager(TileManagerClient* client); | 33 TileManager(TileManagerClient* client); |
| 30 ~TileManager(); | 34 ~TileManager(); |
| 31 void Manage() { } | 35 |
| 36 void SetGlobalState(const GlobalStateThatImpactsTilePriority& state); |
| 37 void ManageTiles(); |
| 32 | 38 |
| 33 protected: | 39 protected: |
| 34 // Methods called by Tile | 40 // Methods called by Tile |
| 35 void RegisterTile(Tile*); | 41 void DidCreateTileVersion(TileVersion*); |
| 36 void UnregisterTile(Tile*); | 42 void WillModifyTileVersionPriority(TileVersion*, const TilePriority& new_prior
ity); |
| 43 void DidDeleteTileVersion(TileVersion*); |
| 37 | 44 |
| 38 private: | 45 private: |
| 39 friend class Tile; | 46 friend class Tile; |
| 47 void ScheduleManageTiles(); |
| 40 | 48 |
| 41 TileManagerClient* client_; | 49 TileManagerClient* client_; |
| 42 std::vector<Tile*> registered_tiles_; | 50 bool manage_tiles_pending_; |
| 51 |
| 52 GlobalStateThatImpactsTilePriority global_state_; |
| 53 std::vector<TileVersion*> tile_versions_; |
| 43 }; | 54 }; |
| 44 | 55 |
| 45 } | 56 } |
| 46 | 57 |
| 47 #endif | 58 #endif |
| OLD | NEW |