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::UsageAndQuotaCallback UsageAndQuotaCallback; | 37 typedef QuotaManager::GetUsageAndQuotaCallback |
| 38 GetUsageAndQuotaCallback; |
38 | 39 |
39 virtual void RegisterClient(QuotaClient* client); | 40 virtual void RegisterClient(QuotaClient* client); |
40 virtual void NotifyStorageAccessed(QuotaClient::ID client_id, | 41 virtual void NotifyStorageAccessed(QuotaClient::ID client_id, |
41 const GURL& origin, | 42 const GURL& origin, |
42 StorageType type); | 43 StorageType type); |
43 virtual void NotifyStorageModified(QuotaClient::ID client_id, | 44 virtual void NotifyStorageModified(QuotaClient::ID client_id, |
44 const GURL& origin, | 45 const GURL& origin, |
45 StorageType type, | 46 StorageType type, |
46 int64_t delta); | 47 int64_t delta); |
47 virtual void NotifyOriginInUse(const GURL& origin); | 48 virtual void NotifyOriginInUse(const GURL& origin); |
48 virtual void NotifyOriginNoLongerInUse(const GURL& origin); | 49 virtual void NotifyOriginNoLongerInUse(const GURL& origin); |
49 | 50 |
50 virtual void SetUsageCacheEnabled(QuotaClient::ID client_id, | 51 virtual void SetUsageCacheEnabled(QuotaClient::ID client_id, |
51 const GURL& origin, | 52 const GURL& origin, |
52 StorageType type, | 53 StorageType type, |
53 bool enabled); | 54 bool enabled); |
54 virtual void GetUsageAndQuota(base::SequencedTaskRunner* original_task_runner, | 55 virtual void GetUsageAndQuota( |
55 const GURL& origin, | 56 base::SequencedTaskRunner* original_task_runner, |
56 StorageType type, | 57 const GURL& origin, |
57 const UsageAndQuotaCallback& callback); | 58 StorageType type, |
| 59 const GetUsageAndQuotaCallback& callback); |
58 | 60 |
59 // This method may only be called on the IO thread. | 61 // This method may only be called on the IO thread. |
60 // It may return NULL if the manager has already been deleted. | 62 // It may return NULL if the manager has already been deleted. |
61 QuotaManager* quota_manager() const; | 63 QuotaManager* quota_manager() const; |
62 | 64 |
63 protected: | 65 protected: |
64 friend class QuotaManager; | 66 friend class QuotaManager; |
65 friend class base::RefCountedThreadSafe<QuotaManagerProxy>; | 67 friend class base::RefCountedThreadSafe<QuotaManagerProxy>; |
66 | 68 |
67 QuotaManagerProxy( | 69 QuotaManagerProxy( |
68 QuotaManager* manager, | 70 QuotaManager* manager, |
69 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread); | 71 const scoped_refptr<base::SingleThreadTaskRunner>& io_thread); |
70 virtual ~QuotaManagerProxy(); | 72 virtual ~QuotaManagerProxy(); |
71 | 73 |
72 QuotaManager* manager_; // only accessed on the io thread | 74 QuotaManager* manager_; // only accessed on the io thread |
73 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; | 75 scoped_refptr<base::SingleThreadTaskRunner> io_thread_; |
74 | 76 |
75 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); | 77 DISALLOW_COPY_AND_ASSIGN(QuotaManagerProxy); |
76 }; | 78 }; |
77 | 79 |
78 } // namespace storage | 80 } // namespace storage |
79 | 81 |
80 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ | 82 #endif // STORAGE_BROWSER_QUOTA_QUOTA_MANAGER_PROXY_H_ |
OLD | NEW |