| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ | 5 #ifndef ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ |
| 6 #define ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ | 6 #define ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 class GlobalTileManager { | 24 class GlobalTileManager { |
| 25 private: | 25 private: |
| 26 typedef std::list<GlobalTileManagerClient*> ListType; | 26 typedef std::list<GlobalTileManagerClient*> ListType; |
| 27 | 27 |
| 28 public: | 28 public: |
| 29 typedef ListType::iterator Key; | 29 typedef ListType::iterator Key; |
| 30 static GlobalTileManager* GetInstance(); | 30 static GlobalTileManager* GetInstance(); |
| 31 | 31 |
| 32 // Requests the |num_of_tiles| from the available global pool. Calls | 32 // Requests the |num_of_tiles| from the available global pool. Calls |
| 33 // GlobalTileManagerClient.SetNumTiles after the manager determines how many | 33 // GlobalTileManagerClient.SetNumTiles after the manager determines how many |
| 34 // tiles are available for the client. The tile policy on the clients are not | 34 // tiles are available for the client. If the number of tiles left is not |
| 35 // immediately enforced, unless |effective_immediately| is true. If the | 35 // enough to satisfy the request, the manager will evict tiles allocated to |
| 36 // number of tiles left are not enough to satisfy the request, the manager | 36 // other clients. |
| 37 // will evict tiles allocated to other clients. | |
| 38 void RequestTiles(size_t new_num_of_tiles, Key key); | 37 void RequestTiles(size_t new_num_of_tiles, Key key); |
| 39 | 38 |
| 40 Key PushBack(GlobalTileManagerClient* client); | 39 Key PushBack(GlobalTileManagerClient* client); |
| 41 | 40 |
| 42 // |key| must be already in manager. Move the tile manager client | 41 // |key| must be already in manager. Move the tile manager client |
| 43 // corresponding to |key| to most recent. This function should be called after | 42 // corresponding to |key| to most recent. This function should be called after |
| 44 // RequestTiles. | 43 // RequestTiles. |
| 45 void DidUse(Key key); | 44 void DidUse(Key key); |
| 46 | 45 |
| 47 void Remove(Key key); | 46 void Remove(Key key); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 65 size_t total_allocated_tiles_; | 64 size_t total_allocated_tiles_; |
| 66 ListType mru_list_; | 65 ListType mru_list_; |
| 67 base::SequenceChecker sequence_checker_; | 66 base::SequenceChecker sequence_checker_; |
| 68 | 67 |
| 69 DISALLOW_COPY_AND_ASSIGN(GlobalTileManager); | 68 DISALLOW_COPY_AND_ASSIGN(GlobalTileManager); |
| 70 }; | 69 }; |
| 71 | 70 |
| 72 } // namespace android_webview | 71 } // namespace android_webview |
| 73 | 72 |
| 74 #endif // ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ | 73 #endif // ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ |
| OLD | NEW |