| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_PROXY_H_ | 5 #ifndef STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ |
| 6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ | 6 #define STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 class SequencedTaskRunner; | 27 class SequencedTaskRunner; |
| 28 class SingleThreadTaskRunner; | 28 class SingleThreadTaskRunner; |
| 29 } | 29 } |
| 30 | 30 |
| 31 namespace storage { | 31 namespace storage { |
| 32 | 32 |
| 33 // The proxy may be called and finally released on any thread. | 33 // The proxy may be called and finally released on any thread. |
| 34 class STORAGE_EXPORT QuotaManagerProxy | 34 class STORAGE_EXPORT QuotaManagerProxy |
| 35 : public base::RefCountedThreadSafe<QuotaManagerProxy> { | 35 : public base::RefCountedThreadSafe<QuotaManagerProxy> { |
| 36 public: | 36 public: |
| 37 typedef QuotaManager::GetUsageAndQuotaCallback | 37 typedef QuotaManager::UsageAndQuotaCallback UsageAndQuotaCallback; |
| 38 GetUsageAndQuotaCallback; | |
| 39 | 38 |
| 40 virtual void RegisterClient(QuotaClient* client); | 39 virtual void RegisterClient(QuotaClient* client); |
| 41 virtual void NotifyStorageAccessed(QuotaClient::ID client_id, | 40 virtual void NotifyStorageAccessed(QuotaClient::ID client_id, |
| 42 const GURL& origin, | 41 const GURL& origin, |
| 43 StorageType type); | 42 StorageType type); |
| 44 virtual void NotifyStorageModified(QuotaClient::ID client_id, | 43 virtual void NotifyStorageModified(QuotaClient::ID client_id, |
| 45 const GURL& origin, | 44 const GURL& origin, |
| 46 StorageType type, | 45 StorageType type, |
| 47 int64_t delta); | 46 int64_t delta); |
| 48 virtual void NotifyOriginInUse(const GURL& origin); | 47 virtual void NotifyOriginInUse(const GURL& origin); |
| 49 virtual void NotifyOriginNoLongerInUse(const GURL& origin); | 48 virtual void NotifyOriginNoLongerInUse(const GURL& origin); |
| 50 | 49 |
| 51 virtual void SetUsageCacheEnabled(QuotaClient::ID client_id, | 50 virtual void SetUsageCacheEnabled(QuotaClient::ID client_id, |
| 52 const GURL& origin, | 51 const GURL& origin, |
| 53 StorageType type, | 52 StorageType type, |
| 54 bool enabled); | 53 bool enabled); |
| 55 virtual void GetUsageAndQuota( | 54 virtual void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, |
| 56 base::SequencedTaskRunner* original_task_runner, | 55 const GURL& origin, |
| 57 const GURL& origin, | 56 StorageType type, |
| 58 StorageType type, | 57 const UsageAndQuotaCallback& callback); |
| 59 const GetUsageAndQuotaCallback& callback); | |
| 60 | 58 |
| 61 // This method may only be called on the IO thread. | 59 // This method may only be called on the IO thread. |
| 62 // It may return NULL if the manager has already been deleted. | 60 // It may return NULL if the manager has already been deleted. |
| 63 QuotaManager* quota_manager() const; | 61 QuotaManager* quota_manager() const; |
| 64 | 62 |
| 65 protected: | 63 protected: |
| 66 friend class QuotaManager; | 64 friend class QuotaManager; |
| 67 friend class base::RefCountedThreadSafe<QuotaManagerProxy>; | 65 friend class base::RefCountedThreadSafe<QuotaManagerProxy>; |
| 68 | 66 |
| 69 QuotaManagerProxy( | 67 QuotaManagerProxy( |
| 70 QuotaManager* manager, | 68 QuotaManager* manager, |
| 71 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread); | 69 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread); |
| 72 virtual ~QuotaManagerProxy(); | 70 virtual ~QuotaManagerProxy(); |
| 73 | 71 |
| 74 QuotaManager* manager_; // only accessed on the io thread | 72 QuotaManager* manager_; // only accessed on the io thread |
| 75 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | 73 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; |
| 76 | 74 |
| 77 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); | 75 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); |
| 78 }; | 76 }; |
| 79 | 77 |
| 80 } // namespace storage | 78 } // namespace storage |
| 81 | 79 |
| 82 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ | 80 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ |
| OLD | NEW |