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

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

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 8 years, 8 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <utility> 14 #include <utility>
15 #include <vector> 15 #include <vector>
16 16
17 #include "base/basictypes.h" 17 #include "base/basictypes.h"
18 #include "base/callback.h" 18 #include "base/callback.h"
19 #include "base/file_path.h" 19 #include "base/file_path.h"
20 #include "base/memory/ref_counted.h" 20 #include "base/memory/ref_counted.h"
21 #include "base/memory/scoped_ptr.h"
21 #include "base/memory/weak_ptr.h" 22 #include "base/memory/weak_ptr.h"
22 #include "base/memory/scoped_ptr.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "webkit/quota/quota_database.h" 24 #include "webkit/quota/quota_database.h"
25 #include "webkit/quota/quota_client.h" 25 #include "webkit/quota/quota_client.h"
26 #include "webkit/quota/quota_task.h" 26 #include "webkit/quota/quota_task.h"
27 #include "webkit/quota/quota_types.h" 27 #include "webkit/quota/quota_types.h"
28 #include "webkit/quota/special_storage_policy.h" 28 #include "webkit/quota/special_storage_policy.h"
29 29
30 class FilePath; 30 class FilePath;
31 31
32 namespace base { 32 namespace base {
33 class MessageLoopProxy; 33 class SequencedTaskRunner;
34 class SingleThreadTaskRunner;
34 } 35 }
35 36
36 namespace quota_internals { 37 namespace quota_internals {
37 class QuotaInternalsProxy; 38 class QuotaInternalsProxy;
38 } 39 }
39 40
40 namespace quota { 41 namespace quota {
41 42
42 struct QuotaManagerDeleter; 43 struct QuotaManagerDeleter;
43 44
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 public base::RefCountedThreadSafe< 99 public base::RefCountedThreadSafe<
99 QuotaManager, QuotaManagerDeleter> { 100 QuotaManager, QuotaManagerDeleter> {
100 public: 101 public:
101 typedef base::Callback<void(QuotaStatusCode, 102 typedef base::Callback<void(QuotaStatusCode,
102 int64 /* usage */, 103 int64 /* usage */,
103 int64 /* quota */)> 104 int64 /* quota */)>
104 GetUsageAndQuotaCallback; 105 GetUsageAndQuotaCallback;
105 106
106 QuotaManager(bool is_incognito, 107 QuotaManager(bool is_incognito,
107 const FilePath& profile_path, 108 const FilePath& profile_path,
108 base::MessageLoopProxy* io_thread, 109 base::SingleThreadTaskRunner* io_thread,
109 base::MessageLoopProxy* db_thread, 110 base::SequencedTaskRunner* db_thread,
michaeln 2012/04/27 01:04:03 Yup... SingleThread for the first, Sequenced for t
110 SpecialStoragePolicy* special_storage_policy); 111 SpecialStoragePolicy* special_storage_policy);
111 112
112 virtual ~QuotaManager(); 113 virtual ~QuotaManager();
113 114
114 // Returns a proxy object that can be used on any thread. 115 // Returns a proxy object that can be used on any thread.
115 QuotaManagerProxy* proxy() { return proxy_.get(); } 116 QuotaManagerProxy* proxy() { return proxy_.get(); }
116 117
117 // Called by clients or webapps. Returns usage per host. 118 // Called by clients or webapps. Returns usage per host.
118 void GetUsageInfo(const GetUsageInfoCallback& callback); 119 void GetUsageInfo(const GetUsageInfoCallback& callback);
119 120
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 void DidGetDatabaseLRUOrigin(const GURL& origin); 343 void DidGetDatabaseLRUOrigin(const GURL& origin);
343 344
344 void DeleteOnCorrectThread() const; 345 void DeleteOnCorrectThread() const;
345 346
346 const bool is_incognito_; 347 const bool is_incognito_;
347 const FilePath profile_path_; 348 const FilePath profile_path_;
348 349
349 scoped_refptr<QuotaManagerProxy> proxy_; 350 scoped_refptr<QuotaManagerProxy> proxy_;
350 bool db_disabled_; 351 bool db_disabled_;
351 bool eviction_disabled_; 352 bool eviction_disabled_;
352 scoped_refptr<base::MessageLoopProxy> io_thread_; 353 scoped_refptr<base::SingleThreadTaskRunner> io_thread_;
353 scoped_refptr<base::MessageLoopProxy> db_thread_; 354 scoped_refptr<base::SequencedTaskRunner> db_thread_;
354 mutable scoped_ptr<QuotaDatabase> database_; 355 mutable scoped_ptr<QuotaDatabase> database_;
355 356
356 GetLRUOriginCallback lru_origin_callback_; 357 GetLRUOriginCallback lru_origin_callback_;
357 std::set<GURL> access_notified_origins_; 358 std::set<GURL> access_notified_origins_;
358 359
359 QuotaClientList clients_; 360 QuotaClientList clients_;
360 361
361 scoped_ptr<UsageTracker> temporary_usage_tracker_; 362 scoped_ptr<UsageTracker> temporary_usage_tracker_;
362 scoped_ptr<UsageTracker> persistent_usage_tracker_; 363 scoped_ptr<UsageTracker> persistent_usage_tracker_;
363 // TODO(michaeln): Need a way to clear the cache, drop and 364 // TODO(michaeln): Need a way to clear the cache, drop and
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 virtual void NotifyOriginNoLongerInUse(const GURL& origin); 409 virtual void NotifyOriginNoLongerInUse(const GURL& origin);
409 410
410 // This method may only be called on the IO thread. 411 // This method may only be called on the IO thread.
411 // It may return NULL if the manager has already been deleted. 412 // It may return NULL if the manager has already been deleted.
412 QuotaManager* quota_manager() const; 413 QuotaManager* quota_manager() const;
413 414
414 protected: 415 protected:
415 friend class QuotaManager; 416 friend class QuotaManager;
416 friend class base::RefCountedThreadSafe<QuotaManagerProxy>; 417 friend class base::RefCountedThreadSafe<QuotaManagerProxy>;
417 418
418 QuotaManagerProxy(QuotaManager* manager, base::MessageLoopProxy* io_thread); 419 QuotaManagerProxy(QuotaManager* manager,
420 base::SingleThreadTaskRunner* io_thread);
419 virtual ~QuotaManagerProxy(); 421 virtual ~QuotaManagerProxy();
420 422
421 QuotaManager* manager_; // only accessed on the io thread 423 QuotaManager* manager_; // only accessed on the io thread
422 scoped_refptr<base::MessageLoopProxy> io_thread_; 424 scoped_refptr<base::SingleThreadTaskRunner> io_thread_;
423 425
424 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); 426 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy);
425 }; 427 };
426 428
427 } // namespace quota 429 } // namespace quota
428 430
429 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ 431 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698