OLD | NEW |
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 CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_ | 8 #ifndef CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_ |
9 #define CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_ | 9 #define CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_ |
10 | 10 |
11 #include <map> | 11 #include <map> |
12 #include <list> | 12 #include <list> |
13 #include <set> | 13 #include <set> |
14 | 14 |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/compiler_specific.h" | 16 #include "base/compiler_specific.h" |
17 #include "base/gtest_prod_util.h" | 17 #include "base/gtest_prod_util.h" |
18 #include "base/memory/weak_ptr.h" | 18 #include "base/memory/weak_ptr.h" |
19 #include "base/time.h" | 19 #include "base/time.h" |
20 #include "content/public/browser/notification_observer.h" | 20 #include "content/public/browser/notification_observer.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" | 22 #include "third_party/WebKit/Source/WebKit/chromium/public/WebCache.h" |
23 | 23 |
24 template<typename Type> | 24 template<typename Type> |
25 struct DefaultSingletonTraits; | 25 struct DefaultSingletonTraits; |
26 class PrefService; | 26 class PrefServiceSimple; |
27 | 27 |
28 class WebCacheManager : public content::NotificationObserver { | 28 class WebCacheManager : public content::NotificationObserver { |
29 friend class WebCacheManagerTest; | 29 friend class WebCacheManagerTest; |
30 FRIEND_TEST_ALL_PREFIXES(WebCacheManagerBrowserTest, CrashOnceOnly); | 30 FRIEND_TEST_ALL_PREFIXES(WebCacheManagerBrowserTest, CrashOnceOnly); |
31 | 31 |
32 public: | 32 public: |
33 static void RegisterPrefs(PrefService* prefs); | 33 static void RegisterPrefs(PrefServiceSimple* prefs); |
34 | 34 |
35 // Gets the singleton WebCacheManager object. The first time this method | 35 // Gets the singleton WebCacheManager object. The first time this method |
36 // is called, a WebCacheManager object is constructed and returned. | 36 // is called, a WebCacheManager object is constructed and returned. |
37 // Subsequent calls will return the same object. | 37 // Subsequent calls will return the same object. |
38 static WebCacheManager* GetInstance(); | 38 static WebCacheManager* GetInstance(); |
39 | 39 |
40 // When a render process is created, it registers itself with the cache | 40 // When a render process is created, it registers itself with the cache |
41 // manager host, causing the renderer to be allocated cache resources. | 41 // manager host, causing the renderer to be allocated cache resources. |
42 void Add(int renderer_id); | 42 void Add(int renderer_id); |
43 | 43 |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 std::set<int> inactive_renderers_; | 213 std::set<int> inactive_renderers_; |
214 | 214 |
215 base::WeakPtrFactory<WebCacheManager> weak_factory_; | 215 base::WeakPtrFactory<WebCacheManager> weak_factory_; |
216 | 216 |
217 content::NotificationRegistrar registrar_; | 217 content::NotificationRegistrar registrar_; |
218 | 218 |
219 DISALLOW_COPY_AND_ASSIGN(WebCacheManager); | 219 DISALLOW_COPY_AND_ASSIGN(WebCacheManager); |
220 }; | 220 }; |
221 | 221 |
222 #endif // CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_ | 222 #endif // CHROME_BROWSER_RENDERER_HOST_WEB_CACHE_MANAGER_H_ |
OLD | NEW |