OLD | NEW |
1 // Copyright (c) 2011 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 MessageLoopProxy; | 17 class SingleThreadTaskRunner; |
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 // An abstract interface that provides common quota-related utility functions | 26 // An abstract interface that provides common quota-related utility functions |
27 // for internal filesystem modules. The main consumer of this class is | 27 // for internal filesystem modules. The main consumer of this class is |
(...skipping 11 matching lines...) Expand all Loading... |
39 int64 delta); | 39 int64 delta); |
40 void StartUpdateOrigin(const GURL& origin_url, | 40 void StartUpdateOrigin(const GURL& origin_url, |
41 fileapi::FileSystemType type); | 41 fileapi::FileSystemType type); |
42 void EndUpdateOrigin(const GURL& origin_url, | 42 void EndUpdateOrigin(const GURL& origin_url, |
43 fileapi::FileSystemType type); | 43 fileapi::FileSystemType type); |
44 | 44 |
45 private: | 45 private: |
46 friend class FileSystemQuotaUtil; | 46 friend class FileSystemQuotaUtil; |
47 friend class base::RefCountedThreadSafe<Proxy>; | 47 friend class base::RefCountedThreadSafe<Proxy>; |
48 Proxy(FileSystemQuotaUtil* quota_handler, | 48 Proxy(FileSystemQuotaUtil* quota_handler, |
49 base::MessageLoopProxy* file_thread); | 49 base::SingleThreadTaskRunner* file_task_runner); |
50 ~Proxy(); | 50 ~Proxy(); |
51 | 51 |
52 FileSystemQuotaUtil* quota_util_; // Accessed only on the FILE thread. | 52 FileSystemQuotaUtil* quota_util_; // Accessed only on the FILE thread. |
53 scoped_refptr<base::MessageLoopProxy> file_thread_; | 53 scoped_refptr<base::SingleThreadTaskRunner> file_task_runner_; |
54 DISALLOW_COPY_AND_ASSIGN(Proxy); | 54 DISALLOW_COPY_AND_ASSIGN(Proxy); |
55 }; | 55 }; |
56 | 56 |
57 // Called by quota client. | 57 // Called by quota client. |
58 virtual void GetOriginsForTypeOnFileThread(fileapi::FileSystemType type, | 58 virtual void GetOriginsForTypeOnFileThread(fileapi::FileSystemType type, |
59 std::set<GURL>* origins) = 0; | 59 std::set<GURL>* origins) = 0; |
60 | 60 |
61 // Called by quota client. | 61 // Called by quota client. |
62 virtual void GetOriginsForHostOnFileThread(fileapi::FileSystemType type, | 62 virtual void GetOriginsForHostOnFileThread(fileapi::FileSystemType type, |
63 const std::string& host, | 63 const std::string& host, |
(...skipping 26 matching lines...) Expand all Loading... |
90 // Called after a write operation modifies the origin's storage data. | 90 // Called after a write operation modifies the origin's storage data. |
91 virtual void EndUpdateOriginOnFileThread(const GURL& origin_url, | 91 virtual void EndUpdateOriginOnFileThread(const GURL& origin_url, |
92 fileapi::FileSystemType type) = 0; | 92 fileapi::FileSystemType type) = 0; |
93 | 93 |
94 virtual void InvalidateUsageCache(const GURL& origin_url, | 94 virtual void InvalidateUsageCache(const GURL& origin_url, |
95 fileapi::FileSystemType type) = 0; | 95 fileapi::FileSystemType type) = 0; |
96 | 96 |
97 Proxy* proxy() { return proxy_.get(); } | 97 Proxy* proxy() { return proxy_.get(); } |
98 | 98 |
99 protected: | 99 protected: |
100 explicit FileSystemQuotaUtil(base::MessageLoopProxy* file_thread); | 100 explicit FileSystemQuotaUtil(base::SingleThreadTaskRunner* file_task_runner); |
101 virtual ~FileSystemQuotaUtil(); | 101 virtual ~FileSystemQuotaUtil(); |
102 | 102 |
103 private: | 103 private: |
104 scoped_refptr<Proxy> proxy_; | 104 scoped_refptr<Proxy> proxy_; |
105 }; | 105 }; |
106 | 106 |
107 } // namespace fileapi | 107 } // namespace fileapi |
108 | 108 |
109 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ | 109 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_UTIL_H_ |
OLD | NEW |