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

Side by Side Diff: content/child/quota_dispatcher.h

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build Created 6 years, 4 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
« no previous file with comments | « content/child/fileapi/webfilewriter_base.cc ('k') | content/child/quota_dispatcher.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 CONTENT_CHILD_QUOTA_DISPATCHER_H_ 5 #ifndef CONTENT_CHILD_QUOTA_DISPATCHER_H_
6 #define CONTENT_CHILD_QUOTA_DISPATCHER_H_ 6 #define CONTENT_CHILD_QUOTA_DISPATCHER_H_
7 7
8 #include <map> 8 #include <map>
9 #include <set> 9 #include <set>
10 10
(...skipping 22 matching lines...) Expand all
33 // process from/to the main browser process. There is one instance 33 // process from/to the main browser process. There is one instance
34 // per each thread. Thread-specific instance can be obtained by 34 // per each thread. Thread-specific instance can be obtained by
35 // ThreadSpecificInstance(). 35 // ThreadSpecificInstance().
36 class QuotaDispatcher : public WorkerTaskRunner::Observer { 36 class QuotaDispatcher : public WorkerTaskRunner::Observer {
37 public: 37 public:
38 class Callback { 38 class Callback {
39 public: 39 public:
40 virtual ~Callback() {} 40 virtual ~Callback() {}
41 virtual void DidQueryStorageUsageAndQuota(int64 usage, int64 quota) = 0; 41 virtual void DidQueryStorageUsageAndQuota(int64 usage, int64 quota) = 0;
42 virtual void DidGrantStorageQuota(int64 usage, int64 granted_quota) = 0; 42 virtual void DidGrantStorageQuota(int64 usage, int64 granted_quota) = 0;
43 virtual void DidFail(quota::QuotaStatusCode status) = 0; 43 virtual void DidFail(storage::QuotaStatusCode status) = 0;
44 }; 44 };
45 45
46 QuotaDispatcher(ThreadSafeSender* thread_safe_sender, 46 QuotaDispatcher(ThreadSafeSender* thread_safe_sender,
47 QuotaMessageFilter* quota_message_filter); 47 QuotaMessageFilter* quota_message_filter);
48 virtual ~QuotaDispatcher(); 48 virtual ~QuotaDispatcher();
49 49
50 // |thread_safe_sender| and |quota_message_filter| are used if 50 // |thread_safe_sender| and |quota_message_filter| are used if
51 // calling this leads to construction. 51 // calling this leads to construction.
52 static QuotaDispatcher* ThreadSpecificInstance( 52 static QuotaDispatcher* ThreadSpecificInstance(
53 ThreadSafeSender* thread_safe_sender, 53 ThreadSafeSender* thread_safe_sender,
54 QuotaMessageFilter* quota_message_filter); 54 QuotaMessageFilter* quota_message_filter);
55 55
56 // WorkerTaskRunner::Observer implementation. 56 // WorkerTaskRunner::Observer implementation.
57 virtual void OnWorkerRunLoopStopped() OVERRIDE; 57 virtual void OnWorkerRunLoopStopped() OVERRIDE;
58 58
59 void OnMessageReceived(const IPC::Message& msg); 59 void OnMessageReceived(const IPC::Message& msg);
60 60
61 void QueryStorageUsageAndQuota(const GURL& gurl, 61 void QueryStorageUsageAndQuota(const GURL& gurl,
62 quota::StorageType type, 62 storage::StorageType type,
63 Callback* callback); 63 Callback* callback);
64 void RequestStorageQuota(int render_view_id, 64 void RequestStorageQuota(int render_view_id,
65 const GURL& gurl, 65 const GURL& gurl,
66 quota::StorageType type, 66 storage::StorageType type,
67 uint64 requested_size, 67 uint64 requested_size,
68 Callback* callback); 68 Callback* callback);
69 69
70 // Creates a new Callback instance for WebStorageQuotaCallbacks. 70 // Creates a new Callback instance for WebStorageQuotaCallbacks.
71 static Callback* CreateWebStorageQuotaCallbacksWrapper( 71 static Callback* CreateWebStorageQuotaCallbacksWrapper(
72 blink::WebStorageQuotaCallbacks callbacks); 72 blink::WebStorageQuotaCallbacks callbacks);
73 73
74 private: 74 private:
75 // Message handlers. 75 // Message handlers.
76 void DidQueryStorageUsageAndQuota(int request_id, 76 void DidQueryStorageUsageAndQuota(int request_id,
77 int64 current_usage, 77 int64 current_usage,
78 int64 current_quota); 78 int64 current_quota);
79 void DidGrantStorageQuota(int request_id, 79 void DidGrantStorageQuota(int request_id,
80 int64 current_usage, 80 int64 current_usage,
81 int64 granted_quota); 81 int64 granted_quota);
82 void DidFail(int request_id, 82 void DidFail(int request_id, storage::QuotaStatusCode error);
83 quota::QuotaStatusCode error);
84 83
85 IDMap<Callback, IDMapOwnPointer> pending_quota_callbacks_; 84 IDMap<Callback, IDMapOwnPointer> pending_quota_callbacks_;
86 85
87 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 86 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
88 scoped_refptr<QuotaMessageFilter> quota_message_filter_; 87 scoped_refptr<QuotaMessageFilter> quota_message_filter_;
89 88
90 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); 89 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher);
91 }; 90 };
92 91
93 } // namespace content 92 } // namespace content
94 93
95 #endif // CONTENT_CHILD_QUOTA_DISPATCHER_H_ 94 #endif // CONTENT_CHILD_QUOTA_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/child/fileapi/webfilewriter_base.cc ('k') | content/child/quota_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698