OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // This is the browser side of the cache manager, it tracks the activity of the | 5 // This is the browser side of the cache manager, it tracks the activity of the |
6 // render processes and allocates available memory cache resources. | 6 // render processes and allocates available memory cache resources. |
7 | 7 |
8 #ifndef CHROME_BROWSER_CACHE_MANAGER_HOST_H__ | 8 #ifndef CHROME_BROWSER_CACHE_MANAGER_HOST_H__ |
9 #define CHROME_BROWSER_CACHE_MANAGER_HOST_H__ | 9 #define CHROME_BROWSER_CACHE_MANAGER_HOST_H__ |
10 | 10 |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 | 61 |
62 // Sets the global size limit, forcing a recalculation of cache allocations. | 62 // Sets the global size limit, forcing a recalculation of cache allocations. |
63 void SetGlobalSizeLimit(size_t bytes); | 63 void SetGlobalSizeLimit(size_t bytes); |
64 | 64 |
65 // Gets the default global size limit. This interrogates system metrics to | 65 // Gets the default global size limit. This interrogates system metrics to |
66 // tune the default size to the current system. | 66 // tune the default size to the current system. |
67 static size_t GetDefaultGlobalSizeLimit(); | 67 static size_t GetDefaultGlobalSizeLimit(); |
68 | 68 |
69 protected: | 69 protected: |
70 // The amount of idle time before we consider a tab to be "inactive" | 70 // The amount of idle time before we consider a tab to be "inactive" |
71 static const TimeDelta kRendererInactiveThreshold; | 71 static const base::TimeDelta kRendererInactiveThreshold; |
72 | 72 |
73 // Keep track of some renderer information. | 73 // Keep track of some renderer information. |
74 struct RendererInfo : CacheManager::UsageStats { | 74 struct RendererInfo : CacheManager::UsageStats { |
75 // The access time for this renderer. | 75 // The access time for this renderer. |
76 Time access; | 76 base::Time access; |
77 }; | 77 }; |
78 | 78 |
79 typedef std::map<int, RendererInfo> StatsMap; | 79 typedef std::map<int, RendererInfo> StatsMap; |
80 | 80 |
81 // An allocation is the number of bytes a specific renderer should use for | 81 // An allocation is the number of bytes a specific renderer should use for |
82 // its cache. | 82 // its cache. |
83 typedef std::pair<int,size_t> Allocation; | 83 typedef std::pair<int,size_t> Allocation; |
84 | 84 |
85 // An allocation strategy is a list of allocations specifying the resources | 85 // An allocation strategy is a list of allocations specifying the resources |
86 // each renderer is permitted to consume for its cache. | 86 // each renderer is permitted to consume for its cache. |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 // recently than they have been active. | 184 // recently than they have been active. |
185 std::set<int> inactive_renderers_; | 185 std::set<int> inactive_renderers_; |
186 | 186 |
187 ScopedRunnableMethodFactory<CacheManagerHost> revise_allocation_factory_; | 187 ScopedRunnableMethodFactory<CacheManagerHost> revise_allocation_factory_; |
188 | 188 |
189 DISALLOW_EVIL_CONSTRUCTORS(CacheManagerHost); | 189 DISALLOW_EVIL_CONSTRUCTORS(CacheManagerHost); |
190 }; | 190 }; |
191 | 191 |
192 #endif // CHROME_BROWSER_CACHE_MANAGER_HOST_H__ | 192 #endif // CHROME_BROWSER_CACHE_MANAGER_HOST_H__ |
193 | 193 |
OLD | NEW |