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

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

Issue 7084024: Add chrome://quota-internals/ (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Reflect comments, move QuotaInternals{MessageHandler,Proxy} to .cc. Created 9 years, 6 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>
(...skipping 12 matching lines...) Expand all
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 namespace base { 28 namespace base {
29 class MessageLoopProxy; 29 class MessageLoopProxy;
30 } 30 }
31 class FilePath; 31 class FilePath;
32 32
33 namespace quota_internals {
34 class QuotaInternalsProxy;
35 }
36
33 namespace quota { 37 namespace quota {
34 38
35 class QuotaDatabase; 39 class QuotaDatabase;
36 class UsageTracker; 40 class UsageTracker;
37 41
38 struct QuotaManagerDeleter; 42 struct QuotaManagerDeleter;
39 class QuotaManagerProxy; 43 class QuotaManagerProxy;
40 44
41 // An interface called by QuotaTemporaryStorageEvictor. 45 // An interface called by QuotaTemporaryStorageEvictor.
42 class QuotaEvictionHandler { 46 class QuotaEvictionHandler {
(...skipping 23 matching lines...) Expand all
66 virtual void GetUsageAndQuotaForEviction( 70 virtual void GetUsageAndQuotaForEviction(
67 GetUsageAndQuotaForEvictionCallback* callback) = 0; 71 GetUsageAndQuotaForEvictionCallback* callback) = 0;
68 }; 72 };
69 73
70 // The quota manager class. This class is instantiated per profile and 74 // The quota manager class. This class is instantiated per profile and
71 // held by the profile. With the exception of the constructor and the 75 // held by the profile. With the exception of the constructor and the
72 // proxy() method, all methods should only be called on the IO thread. 76 // proxy() method, all methods should only be called on the IO thread.
73 class QuotaManager : public QuotaTaskObserver, 77 class QuotaManager : public QuotaTaskObserver,
74 public QuotaEvictionHandler, 78 public QuotaEvictionHandler,
75 public base::RefCountedThreadSafe< 79 public base::RefCountedThreadSafe<
76 QuotaManager, QuotaManagerDeleter> { 80 QuotaManager, QuotaManagerDeleter>,
81 public base::SupportsWeakPtr<QuotaManager> {
michaeln 2011/05/30 19:36:57 Is this really needed? From the WebUI ctor, it lo
tzik 2011/05/31 04:53:01 I'm sure that we can use scoped_ptr<QuotaManager>
77 public: 82 public:
78 typedef Callback3<QuotaStatusCode, 83 typedef Callback3<QuotaStatusCode,
79 int64 /* usage */, 84 int64 /* usage */,
80 int64 /* quota */>::Type GetUsageAndQuotaCallback; 85 int64 /* quota */>::Type GetUsageAndQuotaCallback;
81 typedef Callback2<QuotaStatusCode, 86 typedef Callback2<QuotaStatusCode,
82 int64 /* granted_quota */>::Type RequestQuotaCallback; 87 int64 /* granted_quota */>::Type RequestQuotaCallback;
83 88
84 QuotaManager(bool is_incognito, 89 QuotaManager(bool is_incognito,
85 const FilePath& profile_path, 90 const FilePath& profile_path,
86 base::MessageLoopProxy* io_thread, 91 base::MessageLoopProxy* io_thread,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 get_usage_and_quota_callback; 209 get_usage_and_quota_callback;
205 int64 usage; 210 int64 usage;
206 int64 unlimited_usage; 211 int64 unlimited_usage;
207 int64 quota; 212 int64 quota;
208 }; 213 };
209 214
210 typedef std::pair<std::string, StorageType> HostAndType; 215 typedef std::pair<std::string, StorageType> HostAndType;
211 typedef std::map<HostAndType, UsageAndQuotaDispatcherTask*> 216 typedef std::map<HostAndType, UsageAndQuotaDispatcherTask*>
212 UsageAndQuotaDispatcherTaskMap; 217 UsageAndQuotaDispatcherTaskMap;
213 218
219 friend class quota_internals::QuotaInternalsProxy;
214 friend struct QuotaManagerDeleter; 220 friend struct QuotaManagerDeleter;
215 friend class QuotaManagerProxy; 221 friend class QuotaManagerProxy;
216 friend class QuotaManagerTest; 222 friend class QuotaManagerTest;
217 223
218 // This initialization method is lazily called on the IO thread 224 // This initialization method is lazily called on the IO thread
219 // when the first quota manager API is called. 225 // when the first quota manager API is called.
220 // Initialize must be called after all quota clients are added to the 226 // Initialize must be called after all quota clients are added to the
221 // manager by RegisterStorage. 227 // manager by RegisterStorage.
222 void LazyInitialize(); 228 void LazyInitialize();
223 229
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 345
340 QuotaManager* manager_; // only accessed on the io thread 346 QuotaManager* manager_; // only accessed on the io thread
341 scoped_refptr<base::MessageLoopProxy> io_thread_; 347 scoped_refptr<base::MessageLoopProxy> io_thread_;
342 348
343 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); 349 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy);
344 }; 350 };
345 351
346 } // namespace quota 352 } // namespace quota
347 353
348 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ 354 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698