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