Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(51)

Side by Side Diff: components/web_cache/browser/web_cache_manager.h

Issue 666133002: Standardize usage of virtual/override/final in components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 COMPONENTS_WEB_CACHE_BROWSER_WEB_CACHE_MANAGER_H_ 8 #ifndef COMPONENTS_WEB_CACHE_BROWSER_WEB_CACHE_MANAGER_H_
9 #define COMPONENTS_WEB_CACHE_BROWSER_WEB_CACHE_MANAGER_H_ 9 #define COMPONENTS_WEB_CACHE_BROWSER_WEB_CACHE_MANAGER_H_
10 10
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 void SetGlobalSizeLimit(size_t bytes); 84 void SetGlobalSizeLimit(size_t bytes);
85 85
86 // Clears all in-memory caches. 86 // Clears all in-memory caches.
87 void ClearCache(); 87 void ClearCache();
88 88
89 // Clears all in-memory caches when a tab is reloaded or the user navigates 89 // Clears all in-memory caches when a tab is reloaded or the user navigates
90 // to a different website. 90 // to a different website.
91 void ClearCacheOnNavigation(); 91 void ClearCacheOnNavigation();
92 92
93 // content::NotificationObserver implementation: 93 // content::NotificationObserver implementation:
94 virtual void Observe(int type, 94 void Observe(int type,
95 const content::NotificationSource& source, 95 const content::NotificationSource& source,
96 const content::NotificationDetails& details) override; 96 const content::NotificationDetails& details) override;
97 97
98 // Gets the default global size limit. This interrogates system metrics to 98 // Gets the default global size limit. This interrogates system metrics to
99 // tune the default size to the current system. 99 // tune the default size to the current system.
100 static size_t GetDefaultGlobalSizeLimit(); 100 static size_t GetDefaultGlobalSizeLimit();
101 101
102 protected: 102 protected:
103 // The amount of idle time before we consider a tab to be "inactive" 103 // The amount of idle time before we consider a tab to be "inactive"
104 static const int kRendererInactiveThresholdMinutes = 5; 104 static const int kRendererInactiveThresholdMinutes = 5;
105 105
106 // Keep track of some renderer information. 106 // Keep track of some renderer information.
107 struct RendererInfo : blink::WebCache::UsageStats { 107 struct RendererInfo : blink::WebCache::UsageStats {
108 // The access time for this renderer. 108 // The access time for this renderer.
109 base::Time access; 109 base::Time access;
110 }; 110 };
111 111
112 typedef std::map<int, RendererInfo> StatsMap; 112 typedef std::map<int, RendererInfo> StatsMap;
113 113
114 // An allocation is the number of bytes a specific renderer should use for 114 // An allocation is the number of bytes a specific renderer should use for
115 // its cache. 115 // its cache.
116 typedef std::pair<int,size_t> Allocation; 116 typedef std::pair<int,size_t> Allocation;
117 117
118 // An allocation strategy is a list of allocations specifying the resources 118 // An allocation strategy is a list of allocations specifying the resources
119 // each renderer is permitted to consume for its cache. 119 // each renderer is permitted to consume for its cache.
120 typedef std::list<Allocation> AllocationStrategy; 120 typedef std::list<Allocation> AllocationStrategy;
121 121
122 // This class is a singleton. Do not instantiate directly. 122 // This class is a singleton. Do not instantiate directly.
123 WebCacheManager(); 123 WebCacheManager();
124 friend struct DefaultSingletonTraits<WebCacheManager>; 124 friend struct DefaultSingletonTraits<WebCacheManager>;
125 125
126 virtual ~WebCacheManager(); 126 ~WebCacheManager() override;
127 127
128 // Recomputes the allocation of cache resources among the renderers. Also 128 // Recomputes the allocation of cache resources among the renderers. Also
129 // informs the renderers of their new allocation. 129 // informs the renderers of their new allocation.
130 void ReviseAllocationStrategy(); 130 void ReviseAllocationStrategy();
131 131
132 // Schedules a call to ReviseAllocationStrategy after a short delay. 132 // Schedules a call to ReviseAllocationStrategy after a short delay.
133 void ReviseAllocationStrategyLater(); 133 void ReviseAllocationStrategyLater();
134 134
135 // The various tactics used as part of an allocation strategy. To decide 135 // The various tactics used as part of an allocation strategy. To decide
136 // how many resources a given renderer should be allocated, we consider its 136 // how many resources a given renderer should be allocated, we consider its
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 content::NotificationRegistrar registrar_; 232 content::NotificationRegistrar registrar_;
233 233
234 base::WeakPtrFactory<WebCacheManager> weak_factory_; 234 base::WeakPtrFactory<WebCacheManager> weak_factory_;
235 235
236 DISALLOW_COPY_AND_ASSIGN(WebCacheManager); 236 DISALLOW_COPY_AND_ASSIGN(WebCacheManager);
237 }; 237 };
238 238
239 } // namespace web_cache 239 } // namespace web_cache
240 240
241 #endif // COMPONENTS_WEB_CACHE_BROWSER_WEB_CACHE_MANAGER_H_ 241 #endif // COMPONENTS_WEB_CACHE_BROWSER_WEB_CACHE_MANAGER_H_
OLDNEW
« no previous file with comments | « components/visitedlink/test/visitedlink_unittest.cc ('k') | components/web_cache/renderer/web_cache_render_process_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698