Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(231)

Side by Side Diff: webkit/fileapi/file_system_quota_client.h

Issue 10197007: Change webkit/{fileapi,quota} code to use TaskRunner. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fix Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_CLIENT_H_ 5 #ifndef WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_
6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ 6 #define WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_
7 7
8 #include <set> 8 #include <set>
9 #include <string> 9 #include <string>
10 #include <utility> 10 #include <utility>
11 11
12 #include "base/basictypes.h" 12 #include "base/basictypes.h"
13 #include "base/file_path.h" 13 #include "base/file_path.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "webkit/fileapi/file_system_quota_util.h" 15 #include "webkit/fileapi/file_system_quota_util.h"
16 #include "webkit/fileapi/file_system_types.h" 16 #include "webkit/fileapi/file_system_types.h"
17 #include "webkit/quota/quota_client.h" 17 #include "webkit/quota/quota_client.h"
18 #include "webkit/quota/quota_task.h" 18 #include "webkit/quota/quota_task.h"
19 19
20 namespace base {
21 class TaskRunner;
22 }
23
20 namespace fileapi { 24 namespace fileapi {
21 25
22 class FileSystemContext; 26 class FileSystemContext;
23 27
24 // An instance of this class is created per-profile. This class 28 // An instance of this class is created per-profile. This class
25 // is self-destructed and will delete itself when OnQuotaManagerDestroyed 29 // is self-destructed and will delete itself when OnQuotaManagerDestroyed
26 // is called. 30 // is called.
27 // All of the public methods of this class are called by the quota manager 31 // All of the public methods of this class are called by the quota manager
28 // (except for the constructor/destructor). 32 // (except for the constructor/destructor).
29 class FileSystemQuotaClient : public quota::QuotaClient, 33 class FileSystemQuotaClient : public quota::QuotaClient,
30 public quota::QuotaTaskObserver { 34 public quota::QuotaTaskObserver {
31 public: 35 public:
32 FileSystemQuotaClient( 36 FileSystemQuotaClient(
33 scoped_refptr<base::MessageLoopProxy> file_message_loop, 37 base::TaskRunner* file_task_runner,
michaeln 2012/04/27 01:04:03 i think since the QuotaManager wants operations to
kinuko 2012/04/27 10:10:29 Done.
34 FileSystemContext* file_system_context, 38 FileSystemContext* file_system_context,
35 bool is_incognito); 39 bool is_incognito);
36 virtual ~FileSystemQuotaClient(); 40 virtual ~FileSystemQuotaClient();
37 41
38 // QuotaClient methods. 42 // QuotaClient methods.
39 virtual quota::QuotaClient::ID id() const OVERRIDE; 43 virtual quota::QuotaClient::ID id() const OVERRIDE;
40 virtual void OnQuotaManagerDestroyed() OVERRIDE; 44 virtual void OnQuotaManagerDestroyed() OVERRIDE;
41 virtual void GetOriginUsage(const GURL& origin_url, 45 virtual void GetOriginUsage(const GURL& origin_url,
42 quota::StorageType type, 46 quota::StorageType type,
43 const GetUsageCallback& callback) OVERRIDE; 47 const GetUsageCallback& callback) OVERRIDE;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 quota::StorageType 80 quota::StorageType
77 > OriginsForHostCallbackMap; 81 > OriginsForHostCallbackMap;
78 82
79 void DidGetOriginUsage(fileapi::FileSystemType type, 83 void DidGetOriginUsage(fileapi::FileSystemType type,
80 const GURL& origin, int64 usage); 84 const GURL& origin, int64 usage);
81 void DidGetOriginsForType(fileapi::FileSystemType type, 85 void DidGetOriginsForType(fileapi::FileSystemType type,
82 const std::set<GURL>& origins); 86 const std::set<GURL>& origins);
83 void DidGetOriginsForHost(const TypeAndHostOrOrigin& type_and_host, 87 void DidGetOriginsForHost(const TypeAndHostOrOrigin& type_and_host,
84 const std::set<GURL>& origins); 88 const std::set<GURL>& origins);
85 89
86 scoped_refptr<base::MessageLoopProxy> file_message_loop_; 90 scoped_refptr<base::TaskRunner> file_task_runner_;
87 scoped_refptr<FileSystemContext> file_system_context_; 91 scoped_refptr<FileSystemContext> file_system_context_;
88 92
89 bool is_incognito_; 93 bool is_incognito_;
90 94
91 // Pending callbacks. 95 // Pending callbacks.
92 UsageCallbackMap pending_usage_callbacks_; 96 UsageCallbackMap pending_usage_callbacks_;
93 OriginsForTypeCallbackMap pending_origins_for_type_callbacks_; 97 OriginsForTypeCallbackMap pending_origins_for_type_callbacks_;
94 OriginsForHostCallbackMap pending_origins_for_host_callbacks_; 98 OriginsForHostCallbackMap pending_origins_for_host_callbacks_;
95 99
96 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClient); 100 DISALLOW_COPY_AND_ASSIGN(FileSystemQuotaClient);
97 }; 101 };
98 102
99 } // namespace fileapi 103 } // namespace fileapi
100 104
101 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_ 105 #endif // WEBKIT_FILEAPI_FILE_SYSTEM_QUOTA_CLIENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698