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 void SetTileLimit(size_t num_tiles_limit); | 32 void SetTileLimit(size_t num_tiles_limit); |
33 | 33 |
34 // Requests the |num_of_tiles| from the available global pool. Calls | 34 // Requests the |new_num_of_tiles| from the available global pool. Calls |
35 // GlobalTileManagerClient.SetNumTiles after the manager determines how many | 35 // GlobalTileManagerClient.SetNumTiles after the manager determines how many |
36 // tiles are available for the client. If the number of tiles left is not | 36 // tiles are available for the client. If the number of tiles left is not |
37 // enough to satisfy the request, the manager will evict tiles allocated to | 37 // enough to satisfy the request, the manager will evict tiles allocated to |
38 // other clients. | 38 // other clients. |
39 void RequestTiles(size_t new_num_of_tiles, Key key); | 39 void RequestTiles(size_t new_num_of_tiles, Key key); |
40 | 40 |
41 Key PushBack(GlobalTileManagerClient* client); | 41 Key PushBack(GlobalTileManagerClient* client); |
42 | 42 |
43 // |key| must be already in manager. Move the tile manager client | 43 // |key| must be already in manager. Move the tile manager client |
44 // corresponding to |key| to most recent. This function should be called after | 44 // corresponding to |key| to most recent. This function should be called after |
(...skipping 23 matching lines...) Expand all Loading... |
68 size_t total_allocated_tiles_; | 68 size_t total_allocated_tiles_; |
69 ListType mru_list_; | 69 ListType mru_list_; |
70 base::SequenceChecker sequence_checker_; | 70 base::SequenceChecker sequence_checker_; |
71 | 71 |
72 DISALLOW_COPY_AND_ASSIGN(GlobalTileManager); | 72 DISALLOW_COPY_AND_ASSIGN(GlobalTileManager); |
73 }; | 73 }; |
74 | 74 |
75 } // namespace android_webview | 75 } // namespace android_webview |
76 | 76 |
77 #endif // ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ | 77 #endif // ANDROID_WEBVIEW_BROWSER_GLOBAL_TILE_MANAGER_H_ |
OLD | NEW |