| 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 WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 5 #ifndef WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| 6 #define WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 6 #define WEBKIT_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> |
| 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/files/file_path.h" | 18 #include "base/files/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/browser/quota/quota_callbacks.h" | 23 #include "webkit/browser/quota/quota_callbacks.h" |
| 24 #include "webkit/browser/quota/quota_client.h" | 24 #include "webkit/browser/quota/quota_client.h" |
| 25 #include "webkit/browser/quota/quota_database.h" | 25 #include "webkit/browser/quota/quota_database.h" |
| 26 #include "webkit/browser/quota/quota_task.h" | 26 #include "webkit/browser/quota/quota_task.h" |
| 27 #include "webkit/browser/quota/special_storage_policy.h" | 27 #include "webkit/browser/quota/special_storage_policy.h" |
| 28 #include "webkit/browser/quota/storage_observer.h" | 28 #include "webkit/browser/quota/storage_observer.h" |
| 29 #include "webkit/browser/webkit_storage_browser_export.h" | 29 #include "webkit/browser/storage_export.h" |
| 30 | 30 |
| 31 namespace base { | 31 namespace base { |
| 32 class FilePath; | 32 class FilePath; |
| 33 class SequencedTaskRunner; | 33 class SequencedTaskRunner; |
| 34 class SingleThreadTaskRunner; | 34 class SingleThreadTaskRunner; |
| 35 } | 35 } |
| 36 | 36 |
| 37 namespace quota_internals { | 37 namespace quota_internals { |
| 38 class QuotaInternalsProxy; | 38 class QuotaInternalsProxy; |
| 39 } | 39 } |
| 40 | 40 |
| 41 namespace content { | 41 namespace content { |
| 42 class MockQuotaManager; | 42 class MockQuotaManager; |
| 43 class MockStorageClient; | 43 class MockStorageClient; |
| 44 class QuotaManagerTest; | 44 class QuotaManagerTest; |
| 45 class StorageMonitorTest; | 45 class StorageMonitorTest; |
| 46 | 46 |
| 47 } | 47 } |
| 48 | 48 |
| 49 namespace storage { | 49 namespace storage { |
| 50 | 50 |
| 51 class QuotaDatabase; | 51 class QuotaDatabase; |
| 52 class QuotaManagerProxy; | 52 class QuotaManagerProxy; |
| 53 class QuotaTemporaryStorageEvictor; | 53 class QuotaTemporaryStorageEvictor; |
| 54 class StorageMonitor; | 54 class StorageMonitor; |
| 55 class UsageTracker; | 55 class UsageTracker; |
| 56 | 56 |
| 57 struct QuotaManagerDeleter; | 57 struct QuotaManagerDeleter; |
| 58 | 58 |
| 59 struct WEBKIT_STORAGE_BROWSER_EXPORT UsageAndQuota { | 59 struct STORAGE_EXPORT UsageAndQuota { |
| 60 int64 usage; | 60 int64 usage; |
| 61 int64 global_limited_usage; | 61 int64 global_limited_usage; |
| 62 int64 quota; | 62 int64 quota; |
| 63 int64 available_disk_space; | 63 int64 available_disk_space; |
| 64 | 64 |
| 65 UsageAndQuota(); | 65 UsageAndQuota(); |
| 66 UsageAndQuota(int64 usage, | 66 UsageAndQuota(int64 usage, |
| 67 int64 global_limited_usage, | 67 int64 global_limited_usage, |
| 68 int64 quota, | 68 int64 quota, |
| 69 int64 available_disk_space); | 69 int64 available_disk_space); |
| 70 }; | 70 }; |
| 71 | 71 |
| 72 // An interface called by QuotaTemporaryStorageEvictor. | 72 // An interface called by QuotaTemporaryStorageEvictor. |
| 73 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaEvictionHandler { | 73 class STORAGE_EXPORT QuotaEvictionHandler { |
| 74 public: | 74 public: |
| 75 typedef base::Callback<void(const GURL&)> GetLRUOriginCallback; | 75 typedef base::Callback<void(const GURL&)> GetLRUOriginCallback; |
| 76 typedef StatusCallback EvictOriginDataCallback; | 76 typedef StatusCallback EvictOriginDataCallback; |
| 77 typedef base::Callback<void(QuotaStatusCode status, | 77 typedef base::Callback<void(QuotaStatusCode status, |
| 78 const UsageAndQuota& usage_and_quota)> | 78 const UsageAndQuota& usage_and_quota)> |
| 79 UsageAndQuotaCallback; | 79 UsageAndQuotaCallback; |
| 80 | 80 |
| 81 // Returns the least recently used origin. It might return empty | 81 // Returns the least recently used origin. It might return empty |
| 82 // GURL when there are no evictable origins. | 82 // GURL when there are no evictable origins. |
| 83 virtual void GetLRUOrigin( | 83 virtual void GetLRUOrigin( |
| (...skipping 18 matching lines...) Expand all Loading... |
| 102 type(type), | 102 type(type), |
| 103 usage(usage) {} | 103 usage(usage) {} |
| 104 std::string host; | 104 std::string host; |
| 105 StorageType type; | 105 StorageType type; |
| 106 int64 usage; | 106 int64 usage; |
| 107 }; | 107 }; |
| 108 | 108 |
| 109 // The quota manager class. This class is instantiated per profile and | 109 // The quota manager class. This class is instantiated per profile and |
| 110 // held by the profile. With the exception of the constructor and the | 110 // held by the profile. With the exception of the constructor and the |
| 111 // proxy() method, all methods should only be called on the IO thread. | 111 // proxy() method, all methods should only be called on the IO thread. |
| 112 class WEBKIT_STORAGE_BROWSER_EXPORT QuotaManager | 112 class STORAGE_EXPORT QuotaManager |
| 113 : public QuotaTaskObserver, | 113 : public QuotaTaskObserver, |
| 114 public QuotaEvictionHandler, | 114 public QuotaEvictionHandler, |
| 115 public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { | 115 public base::RefCountedThreadSafe<QuotaManager, QuotaManagerDeleter> { |
| 116 public: | 116 public: |
| 117 typedef base::Callback<void(QuotaStatusCode, | 117 typedef base::Callback<void(QuotaStatusCode, |
| 118 int64 /* usage */, | 118 int64 /* usage */, |
| 119 int64 /* quota */)> | 119 int64 /* quota */)> |
| 120 GetUsageAndQuotaCallback; | 120 GetUsageAndQuotaCallback; |
| 121 | 121 |
| 122 static const int64 kIncognitoDefaultQuotaLimit; | 122 static const int64 kIncognitoDefaultQuotaLimit; |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 450 | 450 |
| 451 struct QuotaManagerDeleter { | 451 struct QuotaManagerDeleter { |
| 452 static void Destruct(const QuotaManager* manager) { | 452 static void Destruct(const QuotaManager* manager) { |
| 453 manager->DeleteOnCorrectThread(); | 453 manager->DeleteOnCorrectThread(); |
| 454 } | 454 } |
| 455 }; | 455 }; |
| 456 | 456 |
| 457 } // namespace storage | 457 } // namespace storage |
| 458 | 458 |
| 459 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ | 459 #endif // WEBKIT_BROWSER_QUOTA_QUOTA_MANAGER_H_ |
| OLD | NEW |