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