| OLD | NEW |
| 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 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| 11 #include <set> | 11 #include <set> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 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_ptr.h" | 20 #include "base/memory/scoped_ptr.h" |
| 21 #include "base/memory/weak_ptr.h" | 21 #include "base/memory/weak_ptr.h" |
| 22 #include "base/sequenced_task_runner_helpers.h" | 22 #include "base/sequenced_task_runner_helpers.h" |
| 23 #include "webkit/quota/quota_client.h" | 23 #include "webkit/quota/quota_client.h" |
| 24 #include "webkit/quota/quota_database.h" | 24 #include "webkit/quota/quota_database.h" |
| 25 #include "webkit/quota/quota_task.h" | 25 #include "webkit/quota/quota_task.h" |
| 26 #include "webkit/quota/special_storage_policy.h" | 26 #include "webkit/quota/special_storage_policy.h" |
| 27 #include "webkit/storage/webkit_storage_export.h" | 27 #include "webkit/storage/webkit_storage_export.h" |
| 28 | 28 |
| 29 namespace base { |
| 29 class FilePath; | 30 class FilePath; |
| 30 | |
| 31 namespace base { | |
| 32 class SequencedTaskRunner; | 31 class SequencedTaskRunner; |
| 33 class SingleThreadTaskRunner; | 32 class SingleThreadTaskRunner; |
| 34 } | 33 } |
| 35 | 34 |
| 36 namespace quota_internals { | 35 namespace quota_internals { |
| 37 class QuotaInternalsProxy; | 36 class QuotaInternalsProxy; |
| 38 } | 37 } |
| 39 | 38 |
| 40 namespace quota { | 39 namespace quota { |
| 41 | 40 |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 public QuotaEvictionHandler, | 98 public QuotaEvictionHandler, |
| 100 public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { | 99 public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { |
| 101 public: | 100 public: |
| 102 typedef base::Callback<void(QuotaStatusCode, | 101 typedef base::Callback<void(QuotaStatusCode, |
| 103 int64 /* usage */, | 102 int64 /* usage */, |
| 104 int64 /* quota */)> | 103 int64 /* quota */)> |
| 105 GetUsageAndQuotaCallback; | 104 GetUsageAndQuotaCallback; |
| 106 static const int64 kNoLimit; | 105 static const int64 kNoLimit; |
| 107 | 106 |
| 108 QuotaManager(bool is_incognito, | 107 QuotaManager(bool is_incognito, |
| 109 const FilePath& profile_path, | 108 const base::FilePath& profile_path, |
| 110 base::SingleThreadTaskRunner* io_thread, | 109 base::SingleThreadTaskRunner* io_thread, |
| 111 base::SequencedTaskRunner* db_thread, | 110 base::SequencedTaskRunner* db_thread, |
| 112 SpecialStoragePolicy* special_storage_policy); | 111 SpecialStoragePolicy* special_storage_policy); |
| 113 | 112 |
| 114 // Returns a proxy object that can be used on any thread. | 113 // Returns a proxy object that can be used on any thread. |
| 115 QuotaManagerProxy* proxy() { return proxy_.get(); } | 114 QuotaManagerProxy* proxy() { return proxy_.get(); } |
| 116 | 115 |
| 117 // Called by clients or webapps. Returns usage per host. | 116 // Called by clients or webapps. Returns usage per host. |
| 118 void GetUsageInfo(const GetUsageInfoCallback& callback); | 117 void GetUsageInfo(const GetUsageInfoCallback& callback); |
| 119 | 118 |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 239 class DumpQuotaTableHelper; | 238 class DumpQuotaTableHelper; |
| 240 class DumpOriginInfoTableHelper; | 239 class DumpOriginInfoTableHelper; |
| 241 | 240 |
| 242 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; | 241 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; |
| 243 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; | 242 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; |
| 244 typedef std::vector<QuotaTableEntry> QuotaTableEntries; | 243 typedef std::vector<QuotaTableEntry> QuotaTableEntries; |
| 245 typedef std::vector<OriginInfoTableEntry> OriginInfoTableEntries; | 244 typedef std::vector<OriginInfoTableEntry> OriginInfoTableEntries; |
| 246 | 245 |
| 247 // Function pointer type used to store the function which returns the | 246 // Function pointer type used to store the function which returns the |
| 248 // available disk space for the disk containing the given FilePath. | 247 // available disk space for the disk containing the given FilePath. |
| 249 typedef int64 (*GetAvailableDiskSpaceFn)(const FilePath&); | 248 typedef int64 (*GetAvailableDiskSpaceFn)(const base::FilePath&); |
| 250 | 249 |
| 251 typedef base::Callback<void(const QuotaTableEntries&)> | 250 typedef base::Callback<void(const QuotaTableEntries&)> |
| 252 DumpQuotaTableCallback; | 251 DumpQuotaTableCallback; |
| 253 typedef base::Callback<void(const OriginInfoTableEntries&)> | 252 typedef base::Callback<void(const OriginInfoTableEntries&)> |
| 254 DumpOriginInfoTableCallback; | 253 DumpOriginInfoTableCallback; |
| 255 | 254 |
| 256 struct EvictionContext { | 255 struct EvictionContext { |
| 257 EvictionContext(); | 256 EvictionContext(); |
| 258 virtual ~EvictionContext(); | 257 virtual ~EvictionContext(); |
| 259 GURL evicted_origin; | 258 GURL evicted_origin; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 358 void DidDatabaseWork(bool success); | 357 void DidDatabaseWork(bool success); |
| 359 | 358 |
| 360 void DeleteOnCorrectThread() const; | 359 void DeleteOnCorrectThread() const; |
| 361 | 360 |
| 362 void PostTaskAndReplyWithResultForDBThread( | 361 void PostTaskAndReplyWithResultForDBThread( |
| 363 const tracked_objects::Location& from_here, | 362 const tracked_objects::Location& from_here, |
| 364 const base::Callback<bool(QuotaDatabase*)>& task, | 363 const base::Callback<bool(QuotaDatabase*)>& task, |
| 365 const base::Callback<void(bool)>& reply); | 364 const base::Callback<void(bool)>& reply); |
| 366 | 365 |
| 367 const bool is_incognito_; | 366 const bool is_incognito_; |
| 368 const FilePath profile_path_; | 367 const base::FilePath profile_path_; |
| 369 | 368 |
| 370 scoped_refptr<QuotaManagerProxy> proxy_; | 369 scoped_refptr<QuotaManagerProxy> proxy_; |
| 371 bool db_disabled_; | 370 bool db_disabled_; |
| 372 bool eviction_disabled_; | 371 bool eviction_disabled_; |
| 373 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | 372 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; |
| 374 scoped_refptr<base::SequencedTaskRunner> db_thread_; | 373 scoped_refptr<base::SequencedTaskRunner> db_thread_; |
| 375 mutable scoped_ptr<QuotaDatabase> database_; | 374 mutable scoped_ptr<QuotaDatabase> database_; |
| 376 | 375 |
| 377 GetLRUOriginCallback lru_origin_callback_; | 376 GetLRUOriginCallback lru_origin_callback_; |
| 378 std::set<GURL> access_notified_origins_; | 377 std::set<GURL> access_notified_origins_; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 448 | 447 |
| 449 QuotaManager* manager_; // only accessed on the io thread | 448 QuotaManager* manager_; // only accessed on the io thread |
| 450 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | 449 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; |
| 451 | 450 |
| 452 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); | 451 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); |
| 453 }; | 452 }; |
| 454 | 453 |
| 455 } // namespace quota | 454 } // namespace quota |
| 456 | 455 |
| 457 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ | 456 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ |
| OLD | NEW |