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

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

Issue 142903002: Quota: Return a pair of usage and granted_quota on requesting quota. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 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/browser/quota_dispatcher_host.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 21 matching lines...) Expand all
32 // Dispatches and sends quota related messages sent to/from a child 32 // Dispatches and sends quota related messages sent to/from a child
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 webkit_glue::WorkerTaskRunner::Observer { 36 class QuotaDispatcher : public webkit_glue::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 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(quota::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(
(...skipping 17 matching lines...) Expand all
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 granted_quota); 81 int64 granted_quota);
81 void DidFail(int request_id, 82 void DidFail(int request_id,
82 quota::QuotaStatusCode error); 83 quota::QuotaStatusCode error);
83 84
84 IDMap<Callback, IDMapOwnPointer> pending_quota_callbacks_; 85 IDMap<Callback, IDMapOwnPointer> pending_quota_callbacks_;
85 86
86 scoped_refptr<ThreadSafeSender> thread_safe_sender_; 87 scoped_refptr<ThreadSafeSender> thread_safe_sender_;
87 scoped_refptr<QuotaMessageFilter> quota_message_filter_; 88 scoped_refptr<QuotaMessageFilter> quota_message_filter_;
88 89
89 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher); 90 DISALLOW_COPY_AND_ASSIGN(QuotaDispatcher);
90 }; 91 };
91 92
92 } // namespace content 93 } // namespace content
93 94
94 #endif // CONTENT_CHILD_QUOTA_DISPATCHER_H_ 95 #endif // CONTENT_CHILD_QUOTA_DISPATCHER_H_
OLDNEW
« no previous file with comments | « content/browser/quota_dispatcher_host.cc ('k') | content/child/quota_dispatcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698