| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <list> | 10 #include <list> |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 | 57 |
| 58 // An interface called by QuotaTemporaryStorageEvictor. | 58 // An interface called by QuotaTemporaryStorageEvictor. |
| 59 class QuotaEvictionHandler { | 59 class QuotaEvictionHandler { |
| 60 public: | 60 public: |
| 61 typedef base::Callback<void(const GURL&)> GetLRUOriginCallback; | 61 typedef base::Callback<void(const GURL&)> GetLRUOriginCallback; |
| 62 typedef StatusCallback EvictOriginDataCallback; | 62 typedef StatusCallback EvictOriginDataCallback; |
| 63 typedef base::Callback<void(QuotaStatusCode, | 63 typedef base::Callback<void(QuotaStatusCode, |
| 64 const QuotaAndUsage& quota_and_usage)> | 64 const QuotaAndUsage& quota_and_usage)> |
| 65 GetUsageAndQuotaForEvictionCallback; | 65 GetUsageAndQuotaForEvictionCallback; |
| 66 | 66 |
| 67 virtual ~QuotaEvictionHandler() {} | |
| 68 | |
| 69 // Returns the least recently used origin. It might return empty | 67 // Returns the least recently used origin. It might return empty |
| 70 // GURL when there are no evictable origins. | 68 // GURL when there are no evictable origins. |
| 71 virtual void GetLRUOrigin( | 69 virtual void GetLRUOrigin( |
| 72 StorageType type, | 70 StorageType type, |
| 73 const GetLRUOriginCallback& callback) = 0; | 71 const GetLRUOriginCallback& callback) = 0; |
| 74 | 72 |
| 75 virtual void EvictOriginData( | 73 virtual void EvictOriginData( |
| 76 const GURL& origin, | 74 const GURL& origin, |
| 77 StorageType type, | 75 StorageType type, |
| 78 const EvictOriginDataCallback& callback) = 0; | 76 const EvictOriginDataCallback& callback) = 0; |
| 79 | 77 |
| 80 virtual void GetUsageAndQuotaForEviction( | 78 virtual void GetUsageAndQuotaForEviction( |
| 81 const GetUsageAndQuotaForEvictionCallback& callback) = 0; | 79 const GetUsageAndQuotaForEvictionCallback& callback) = 0; |
| 80 |
| 81 protected: |
| 82 virtual ~QuotaEvictionHandler() {} |
| 82 }; | 83 }; |
| 83 | 84 |
| 84 struct UsageInfo { | 85 struct UsageInfo { |
| 85 UsageInfo(const std::string& host, StorageType type, int64 usage) | 86 UsageInfo(const std::string& host, StorageType type, int64 usage) |
| 86 : host(host), | 87 : host(host), |
| 87 type(type), | 88 type(type), |
| 88 usage(usage) {} | 89 usage(usage) {} |
| 89 std::string host; | 90 std::string host; |
| 90 StorageType type; | 91 StorageType type; |
| 91 int64 usage; | 92 int64 usage; |
| (...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 | 426 |
| 426 QuotaManager* manager_; // only accessed on the io thread | 427 QuotaManager* manager_; // only accessed on the io thread |
| 427 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | 428 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; |
| 428 | 429 |
| 429 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); | 430 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); |
| 430 }; | 431 }; |
| 431 | 432 |
| 432 } // namespace quota | 433 } // namespace quota |
| 433 | 434 |
| 434 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ | 435 #endif // WEBKIT_QUOTA_QUOTA_MANAGER_H_ |
| OLD | NEW |