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_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "googleurl/src/gurl.h" | 13 #include "googleurl/src/gurl.h" |
14 #include "webkit/fileapi/file_system_types.h" | 14 #include "webkit/fileapi/file_system_types.h" |
15 | 15 |
16 namespace base { | 16 namespace base { |
17 class SequencedTaskRunner; | 17 class SequencedTaskRunner; |
18 } | 18 } |
19 | 19 |
20 namespace quota { | 20 namespace quota { |
21 class QuotaManagerProxy; | 21 class QuotaManagerProxy; |
22 } | 22 } |
23 | 23 |
24 namespace fileapi { | 24 namespace fileapi { |
25 | 25 |
| 26 class FileSystemContext; |
| 27 |
26 // An abstract interface that provides common quota-related utility functions | 28 // An abstract interface that provides common quota-related utility functions |
27 // for internal filesystem modules. The main consumer of this class is | 29 // for internal filesystem modules. The main consumer of this class is |
28 // file_system_quota_client and quota_file_util. | 30 // file_system_quota_client and quota_file_util. |
29 // All the methods of this class are synchronous and need to be called on | 31 // All the methods of this class are synchronous and need to be called on |
30 // the thread that the method name implies. | 32 // the thread that the method name implies. |
31 class FileSystemQuotaUtil { | 33 class FileSystemQuotaUtil { |
32 public: | 34 public: |
33 // Methods of this class can be called on any thread. | 35 // Methods of this class can be called on any thread. |
34 class Proxy : public base::RefCountedThreadSafe<Proxy> { | 36 class Proxy : public base::RefCountedThreadSafe<Proxy> { |
35 public: | 37 public: |
(...skipping 24 matching lines...) Expand all Loading... |
60 virtual void GetOriginsForTypeOnFileThread(fileapi::FileSystemType type, | 62 virtual void GetOriginsForTypeOnFileThread(fileapi::FileSystemType type, |
61 std::set<GURL>* origins) = 0; | 63 std::set<GURL>* origins) = 0; |
62 | 64 |
63 // Called by quota client. | 65 // Called by quota client. |
64 virtual void GetOriginsForHostOnFileThread(fileapi::FileSystemType type, | 66 virtual void GetOriginsForHostOnFileThread(fileapi::FileSystemType type, |
65 const std::string& host, | 67 const std::string& host, |
66 std::set<GURL>* origins) = 0; | 68 std::set<GURL>* origins) = 0; |
67 | 69 |
68 // Called by quota client. | 70 // Called by quota client. |
69 // Returns the amount of data used for the origin for usage tracking. | 71 // Returns the amount of data used for the origin for usage tracking. |
70 virtual int64 GetOriginUsageOnFileThread(const GURL& origin_url, | 72 virtual int64 GetOriginUsageOnFileThread( |
71 fileapi::FileSystemType type) = 0; | 73 fileapi::FileSystemContext* file_system_context, |
| 74 const GURL& origin_url, |
| 75 fileapi::FileSystemType type) = 0; |
72 | 76 |
73 // Called by quota file util. | 77 // Called by quota file util. |
74 virtual void UpdateOriginUsageOnFileThread(quota::QuotaManagerProxy* proxy, | 78 virtual void UpdateOriginUsageOnFileThread(quota::QuotaManagerProxy* proxy, |
75 const GURL& origin_url, | 79 const GURL& origin_url, |
76 fileapi::FileSystemType type, | 80 fileapi::FileSystemType type, |
77 int64 delta) = 0; | 81 int64 delta) = 0; |
78 | 82 |
79 // Called by file_system_operation. | 83 // Called by file_system_operation. |
80 // Called when a read operation accesses the origin's storage data. | 84 // Called when a read operation accesses the origin's storage data. |
81 virtual void NotifyOriginWasAccessedOnIOThread( | 85 virtual void NotifyOriginWasAccessedOnIOThread( |
(...skipping 19 matching lines...) Expand all Loading... |
101 protected: | 105 protected: |
102 explicit FileSystemQuotaUtil(base::SequencedTaskRunner* file_task_runner); | 106 explicit FileSystemQuotaUtil(base::SequencedTaskRunner* file_task_runner); |
103 | 107 |
104 private: | 108 private: |
105 scoped_refptr<Proxy> proxy_; | 109 scoped_refptr<Proxy> proxy_; |
106 }; | 110 }; |
107 | 111 |
108 } // namespace fileapi | 112 } // namespace fileapi |
109 | 113 |
110 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 114 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
OLD | NEW |