| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| 6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <list> | 9 #include <list> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 132 GetUsageAndQuotaCallback; | 132 GetUsageAndQuotaCallback; |
| 133 | 133 |
| 134 static const int64 kIncognitoDefaultQuotaLimit; | 134 static const int64 kIncognitoDefaultQuotaLimit; |
| 135 static const int64 kNoLimit; | 135 static const int64 kNoLimit; |
| 136 | 136 |
| 137 QuotaManager( | 137 QuotaManager( |
| 138 bool is_incognito, | 138 bool is_incognito, |
| 139 const base::FilePath& profile_path, | 139 const base::FilePath& profile_path, |
| 140 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, | 140 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread, |
| 141 const scoped_refptr<base::SequencedTaskRunner>& db_thread, | 141 const scoped_refptr<base::SequencedTaskRunner>& db_thread, |
| 142 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy); | 142 const scoped_refptr<SpecialStoragePolicy>& special_storage_policy, |
| 143 QuotaEvictionPolicy* temporary_storage_eviction_policy); |
| 144 |
| 145 void set_temporary_storage_eviction_policy(QuotaEvictionPolicy* policy) { |
| 146 temporary_storage_eviction_policy_ = policy; |
| 147 } |
| 143 | 148 |
| 144 // Returns a proxy object that can be used on any thread. | 149 // Returns a proxy object that can be used on any thread. |
| 145 QuotaManagerProxy* proxy() { return proxy_.get(); } | 150 QuotaManagerProxy* proxy() { return proxy_.get(); } |
| 146 | 151 |
| 147 // Called by clients or webapps. Returns usage per host. | 152 // Called by clients or webapps. Returns usage per host. |
| 148 void GetUsageInfo(const GetUsageInfoCallback& callback); | 153 void GetUsageInfo(const GetUsageInfoCallback& callback); |
| 149 | 154 |
| 150 // Called by Web Apps. | 155 // Called by Web Apps. |
| 151 // This method is declared as virtual to allow test code to override it. | 156 // This method is declared as virtual to allow test code to override it. |
| 152 virtual void GetUsageAndQuotaForWebApps( | 157 virtual void GetUsageAndQuotaForWebApps( |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 friend class content::QuotaManagerTest; | 286 friend class content::QuotaManagerTest; |
| 282 friend class content::StorageMonitorTest; | 287 friend class content::StorageMonitorTest; |
| 283 friend class content::MockQuotaManager; | 288 friend class content::MockQuotaManager; |
| 284 friend class content::MockStorageClient; | 289 friend class content::MockStorageClient; |
| 285 friend class quota_internals::QuotaInternalsProxy; | 290 friend class quota_internals::QuotaInternalsProxy; |
| 286 friend class QuotaManagerProxy; | 291 friend class QuotaManagerProxy; |
| 287 friend class QuotaTemporaryStorageEvictor; | 292 friend class QuotaTemporaryStorageEvictor; |
| 288 friend struct QuotaManagerDeleter; | 293 friend struct QuotaManagerDeleter; |
| 289 | 294 |
| 290 class GetUsageInfoTask; | 295 class GetUsageInfoTask; |
| 296 class GetTemporaryEvictionOriginTask; |
| 291 | 297 |
| 292 class OriginDataDeleter; | 298 class OriginDataDeleter; |
| 293 class HostDataDeleter; | 299 class HostDataDeleter; |
| 294 | 300 |
| 295 class GetModifiedSinceHelper; | 301 class GetModifiedSinceHelper; |
| 296 class DumpQuotaTableHelper; | 302 class DumpQuotaTableHelper; |
| 297 class DumpOriginInfoTableHelper; | 303 class DumpOriginInfoTableHelper; |
| 298 | 304 |
| 299 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; | 305 typedef QuotaDatabase::QuotaTableEntry QuotaTableEntry; |
| 300 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; | 306 typedef QuotaDatabase::OriginInfoTableEntry OriginInfoTableEntry; |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 std::set<GURL> access_notified_origins_; | 432 std::set<GURL> access_notified_origins_; |
| 427 | 433 |
| 428 QuotaClientList clients_; | 434 QuotaClientList clients_; |
| 429 | 435 |
| 430 scoped_ptr<UsageTracker> temporary_usage_tracker_; | 436 scoped_ptr<UsageTracker> temporary_usage_tracker_; |
| 431 scoped_ptr<UsageTracker> persistent_usage_tracker_; | 437 scoped_ptr<UsageTracker> persistent_usage_tracker_; |
| 432 scoped_ptr<UsageTracker> syncable_usage_tracker_; | 438 scoped_ptr<UsageTracker> syncable_usage_tracker_; |
| 433 // TODO(michaeln): Need a way to clear the cache, drop and | 439 // TODO(michaeln): Need a way to clear the cache, drop and |
| 434 // reinstantiate the trackers when they're not handling requests. | 440 // reinstantiate the trackers when they're not handling requests. |
| 435 | 441 |
| 442 QuotaEvictionPolicy* temporary_storage_eviction_policy_; |
| 436 scoped_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; | 443 scoped_ptr<QuotaTemporaryStorageEvictor> temporary_storage_evictor_; |
| 437 EvictionContext eviction_context_; | 444 EvictionContext eviction_context_; |
| 438 | 445 |
| 439 ClosureQueue db_initialization_callbacks_; | 446 ClosureQueue db_initialization_callbacks_; |
| 440 AvailableSpaceCallbackQueue available_space_callbacks_; | 447 AvailableSpaceCallbackQueue available_space_callbacks_; |
| 441 HostQuotaCallbackMap persistent_host_quota_callbacks_; | 448 HostQuotaCallbackMap persistent_host_quota_callbacks_; |
| 442 | 449 |
| 443 bool temporary_quota_initialized_; | 450 bool temporary_quota_initialized_; |
| 444 int64 temporary_quota_override_; | 451 int64 temporary_quota_override_; |
| 445 | 452 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 468 | 475 |
| 469 struct QuotaManagerDeleter { | 476 struct QuotaManagerDeleter { |
| 470 static void Destruct(const QuotaManager* manager) { | 477 static void Destruct(const QuotaManager* manager) { |
| 471 manager->DeleteOnCorrectThread(); | 478 manager->DeleteOnCorrectThread(); |
| 472 } | 479 } |
| 473 }; | 480 }; |
| 474 | 481 |
| 475 } // namespace storage | 482 } // namespace storage |
| 476 | 483 |
| 477 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 484 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| OLD | NEW |