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

Side by Side Diff: webkit/quota/quota_manager.h

Issue 7129018: Time-based removal of temporary file systems via BrowsingDataRemover (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixing race condition. Created 9 years, 5 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 | Annotate | Revision Log
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 #ifndef WEBKIT_QUOTA_QUOTA_MANAGER_H_ 5 #ifndef WEBKIT_QUOTA_QUOTA_MANAGER_H_
6 #define WEBKIT_QUOTA_QUOTA_MANAGER_H_ 6 #define WEBKIT_QUOTA_QUOTA_MANAGER_H_
7 #pragma once 7 #pragma once
8 8
9 #include <deque> 9 #include <deque>
10 #include <list> 10 #include <list>
11 #include <map> 11 #include <map>
12 #include <set> 12 #include <set>
13 #include <string> 13 #include <string>
14 #include <vector> 14 #include <vector>
15 15
16 #include "base/basictypes.h" 16 #include "base/basictypes.h"
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/file_path.h" 18 #include "base/file_path.h"
19 #include "base/memory/ref_counted.h" 19 #include "base/memory/ref_counted.h"
20 #include "base/memory/scoped_callback_factory.h" 20 #include "base/memory/scoped_callback_factory.h"
21 #include "base/memory/scoped_ptr.h" 21 #include "base/memory/scoped_ptr.h"
22 #include "webkit/quota/quota_database.h" 22 #include "webkit/quota/quota_database.h"
23 #include "webkit/quota/quota_client.h" 23 #include "webkit/quota/quota_client.h"
24 #include "webkit/quota/quota_task.h" 24 #include "webkit/quota/quota_task.h"
25 #include "webkit/quota/quota_types.h" 25 #include "webkit/quota/quota_types.h"
26 #include "webkit/quota/special_storage_policy.h" 26 #include "webkit/quota/special_storage_policy.h"
27 27
28 class FilePath;
29
28 namespace base { 30 namespace base {
29 class MessageLoopProxy; 31 class MessageLoopProxy;
30 } 32 }
31 class FilePath;
32 33
33 namespace quota_internals { 34 namespace quota_internals {
34 class QuotaInternalsProxy; 35 class QuotaInternalsProxy;
35 } 36 }
36 37
37 namespace quota { 38 namespace quota {
38 39
39 struct QuotaManagerDeleter; 40 struct QuotaManagerDeleter;
40 41
41 class QuotaDatabase; 42 class QuotaDatabase;
42 class QuotaManagerProxy; 43 class QuotaManagerProxy;
43 class QuotaTemporaryStorageEvictor; 44 class QuotaTemporaryStorageEvictor;
44 class UsageTracker; 45 class UsageTracker;
46 class MockQuotaManager;
45 47
46 // An interface called by QuotaTemporaryStorageEvictor. 48 // An interface called by QuotaTemporaryStorageEvictor.
47 class QuotaEvictionHandler { 49 class QuotaEvictionHandler {
48 public: 50 public:
49 virtual ~QuotaEvictionHandler() {} 51 virtual ~QuotaEvictionHandler() {}
50 52
51 typedef Callback1<const GURL&>::Type GetLRUOriginCallback; 53 typedef Callback1<const GURL&>::Type GetLRUOriginCallback;
52 typedef StatusCallback EvictOriginDataCallback; 54 typedef StatusCallback EvictOriginDataCallback;
53 typedef Callback5<QuotaStatusCode, 55 typedef Callback5<QuotaStatusCode,
54 int64 /* usage */, 56 int64 /* usage */,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // Used to avoid evicting origins with open pages. 121 // Used to avoid evicting origins with open pages.
120 // A call to NotifyOriginInUse must be balanced by a later call 122 // A call to NotifyOriginInUse must be balanced by a later call
121 // to NotifyOriginNoLongerInUse. 123 // to NotifyOriginNoLongerInUse.
122 void NotifyOriginInUse(const GURL& origin); 124 void NotifyOriginInUse(const GURL& origin);
123 void NotifyOriginNoLongerInUse(const GURL& origin); 125 void NotifyOriginNoLongerInUse(const GURL& origin);
124 bool IsOriginInUse(const GURL& origin) const { 126 bool IsOriginInUse(const GURL& origin) const {
125 return origins_in_use_.find(origin) != origins_in_use_.end(); 127 return origins_in_use_.find(origin) != origins_in_use_.end();
126 } 128 }
127 129
128 // Called by UI. 130 // Called by UI.
129 void DeleteOriginData(const GURL& origin, 131 virtual void DeleteOriginData(const GURL& origin,
130 StorageType type, 132 StorageType type,
131 StatusCallback* callback); 133 StatusCallback* callback);
132 134
133 // Called by UI and internal modules. 135 // Called by UI and internal modules.
134 void GetAvailableSpace(AvailableSpaceCallback* callback); 136 void GetAvailableSpace(AvailableSpaceCallback* callback);
135 void GetTemporaryGlobalQuota(QuotaCallback* callback); 137 void GetTemporaryGlobalQuota(QuotaCallback* callback);
136 void SetTemporaryGlobalQuota(int64 new_quota, QuotaCallback* callback); 138 void SetTemporaryGlobalQuota(int64 new_quota, QuotaCallback* callback);
137 void GetPersistentHostQuota(const std::string& host, 139 void GetPersistentHostQuota(const std::string& host,
138 HostQuotaCallback* callback); 140 HostQuotaCallback* callback);
139 void SetPersistentHostQuota(const std::string& host, 141 void SetPersistentHostQuota(const std::string& host,
140 int64 new_quota, 142 int64 new_quota,
141 HostQuotaCallback* callback); 143 HostQuotaCallback* callback);
142 void GetGlobalUsage(StorageType type, GlobalUsageCallback* callback); 144 void GetGlobalUsage(StorageType type, GlobalUsageCallback* callback);
143 void GetHostUsage(const std::string& host, StorageType type, 145 void GetHostUsage(const std::string& host, StorageType type,
144 HostUsageCallback* callback); 146 HostUsageCallback* callback);
145 147
146 void GetStatistics(std::map<std::string, std::string>* statistics); 148 void GetStatistics(std::map<std::string, std::string>* statistics);
147 149
148 bool IsStorageUnlimited(const GURL& origin) const { 150 bool IsStorageUnlimited(const GURL& origin) const {
149 return special_storage_policy_.get() && 151 return special_storage_policy_.get() &&
150 special_storage_policy_->IsStorageUnlimited(origin); 152 special_storage_policy_->IsStorageUnlimited(origin);
151 } 153 }
152 154
153 void GetOriginsModifiedSince( 155 virtual void GetOriginsModifiedSince(StorageType type,
154 StorageType type, 156 base::Time modified_since,
155 base::Time modified_since, 157 GetOriginsCallback* callback);
156 GetOriginsCallback* callback);
157 158
158 bool ResetUsageTracker(StorageType type); 159 bool ResetUsageTracker(StorageType type);
159 160
160 // Used to determine the total size of the temp pool. 161 // Used to determine the total size of the temp pool.
161 static const int64 kTemporaryStorageQuotaDefaultSize; 162 static const int64 kTemporaryStorageQuotaDefaultSize;
162 static const int64 kTemporaryStorageQuotaMaxSize; 163 static const int64 kTemporaryStorageQuotaMaxSize;
163 static const int64 kIncognitoDefaultTemporaryQuota; 164 static const int64 kIncognitoDefaultTemporaryQuota;
164 165
165 // Determines the portion of the temp pool that can be 166 // Determines the portion of the temp pool that can be
166 // utilized by a single host (ie. 5 for 20%). 167 // utilized by a single host (ie. 5 for 20%).
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
228 typedef std::pair<std::string, StorageType> HostAndType; 229 typedef std::pair<std::string, StorageType> HostAndType;
229 typedef std::map<HostAndType, UsageAndQuotaDispatcherTask*> 230 typedef std::map<HostAndType, UsageAndQuotaDispatcherTask*>
230 UsageAndQuotaDispatcherTaskMap; 231 UsageAndQuotaDispatcherTaskMap;
231 232
232 friend class quota_internals::QuotaInternalsProxy; 233 friend class quota_internals::QuotaInternalsProxy;
233 friend struct QuotaManagerDeleter; 234 friend struct QuotaManagerDeleter;
234 friend class MockStorageClient; 235 friend class MockStorageClient;
235 friend class QuotaManagerProxy; 236 friend class QuotaManagerProxy;
236 friend class QuotaManagerTest; 237 friend class QuotaManagerTest;
237 friend class QuotaTemporaryStorageEvictor; 238 friend class QuotaTemporaryStorageEvictor;
239 friend class MockQuotaManager;
238 240
239 // This initialization method is lazily called on the IO thread 241 // This initialization method is lazily called on the IO thread
240 // when the first quota manager API is called. 242 // when the first quota manager API is called.
241 // Initialize must be called after all quota clients are added to the 243 // Initialize must be called after all quota clients are added to the
242 // manager by RegisterStorage. 244 // manager by RegisterStorage.
243 void LazyInitialize(); 245 void LazyInitialize();
244 246
245 // Called by clients via proxy. 247 // Called by clients via proxy.
246 // Registers a quota client to the manager. 248 // Registers a quota client to the manager.
247 // The client must remain valid until OnQuotaManagerDestored is called. 249 // The client must remain valid until OnQuotaManagerDestored is called.
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 389
388 QuotaManager* manager_; // only accessed on the io thread 390 QuotaManager* manager_; // only accessed on the io thread
389 scoped_refptr<base::MessageLoopProxy> io_thread_; 391 scoped_refptr<base::MessageLoopProxy> io_thread_;
390 392
391 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); 393 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy);
392 }; 394 };
393 395
394 } // namespace quota 396 } // namespace quota
395 397
396 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ 398 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698