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

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

Issue 1102353009: WIP Durable storage, chrome side (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 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
« no previous file with comments | « content/child/quota_dispatcher.h ('k') | content/renderer/render_frame_impl.h » ('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 #include "content/child/quota_dispatcher.h" 5 #include "content/child/quota_dispatcher.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/threading/thread_local.h" 9 #include "base/threading/thread_local.h"
10 #include "content/child/quota_message_filter.h" 10 #include "content/child/quota_message_filter.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 params.render_view_id = render_view_id; 131 params.render_view_id = render_view_id;
132 params.request_id = request_id; 132 params.request_id = request_id;
133 params.origin_url = origin_url; 133 params.origin_url = origin_url;
134 params.storage_type = type; 134 params.storage_type = type;
135 params.requested_size = requested_size; 135 params.requested_size = requested_size;
136 params.user_gesture = 136 params.user_gesture =
137 blink::WebUserGestureIndicator::isProcessingUserGesture(); 137 blink::WebUserGestureIndicator::isProcessingUserGesture();
138 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(params)); 138 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(params));
139 } 139 }
140 140
141 void QuotaDispatcher::RequestDurability(
142 int render_view_id,
143 const GURL& origin_url,
144 Callback* callback) {
145 DCHECK(callback);
146 DCHECK(CurrentWorkerId() == 0);
147 int request_id = quota_message_filter_->GenerateRequestID(CurrentWorkerId());
148 LOG(ERROR) << "Got into QuotaDispatcher::RequestDurability request_id = "
149 << request_id;
150 pending_quota_callbacks_.AddWithID(callback, request_id);
151
152 StorageQuotaParams params;
153 params.render_view_id = render_view_id;
154 params.request_id = request_id;
155 params.origin_url = origin_url;
156 params.storage_type = storage::kStorageTypeDurable;
157 params.user_gesture =
158 blink::WebUserGestureIndicator::isProcessingUserGesture();
159 thread_safe_sender_->Send(new QuotaHostMsg_RequestStorageQuota(params));
160 }
161
141 // static 162 // static
142 QuotaDispatcher::Callback* 163 QuotaDispatcher::Callback*
143 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper( 164 QuotaDispatcher::CreateWebStorageQuotaCallbacksWrapper(
144 blink::WebStorageQuotaCallbacks callbacks) { 165 blink::WebStorageQuotaCallbacks callbacks) {
145 return new WebStorageQuotaDispatcherCallback(callbacks); 166 return new WebStorageQuotaDispatcherCallback(callbacks);
146 } 167 }
147 168
148 void QuotaDispatcher::DidGrantStorageQuota( 169 void QuotaDispatcher::DidGrantStorageQuota(
149 int request_id, 170 int request_id,
150 int64 current_usage, 171 int64 current_usage,
(...skipping 12 matching lines...) Expand all
163 DCHECK(callback); 184 DCHECK(callback);
164 callback->DidQueryStorageUsageAndQuota(current_usage, current_quota); 185 callback->DidQueryStorageUsageAndQuota(current_usage, current_quota);
165 pending_quota_callbacks_.Remove(request_id); 186 pending_quota_callbacks_.Remove(request_id);
166 } 187 }
167 188
168 void QuotaDispatcher::DidFail( 189 void QuotaDispatcher::DidFail(
169 int request_id, 190 int request_id,
170 QuotaStatusCode error) { 191 QuotaStatusCode error) {
171 Callback* callback = pending_quota_callbacks_.Lookup(request_id); 192 Callback* callback = pending_quota_callbacks_.Lookup(request_id);
172 DCHECK(callback); 193 DCHECK(callback);
194 LOG(ERROR) << "Got a DidFail error for request_id " << request_id;
173 callback->DidFail(error); 195 callback->DidFail(error);
174 pending_quota_callbacks_.Remove(request_id); 196 pending_quota_callbacks_.Remove(request_id);
175 } 197 }
176 198
177 static_assert(int(blink::WebStorageQuotaTypeTemporary) == 199 static_assert(int(blink::WebStorageQuotaTypeTemporary) ==
178 int(storage::kStorageTypeTemporary), 200 int(storage::kStorageTypeTemporary),
179 "mismatching enums: kStorageTypeTemporary"); 201 "mismatching enums: kStorageTypeTemporary");
180 static_assert(int(blink::WebStorageQuotaTypePersistent) == 202 static_assert(int(blink::WebStorageQuotaTypePersistent) ==
181 int(storage::kStorageTypePersistent), 203 int(storage::kStorageTypePersistent),
182 "mismatching enums: kStorageTypePersistent"); 204 "mismatching enums: kStorageTypePersistent");
183 205
184 static_assert(int(blink::WebStorageQuotaErrorNotSupported) == 206 static_assert(int(blink::WebStorageQuotaErrorNotSupported) ==
185 int(storage::kQuotaErrorNotSupported), 207 int(storage::kQuotaErrorNotSupported),
186 "mismatching enums: kQuotaErrorNotSupported"); 208 "mismatching enums: kQuotaErrorNotSupported");
187 static_assert(int(blink::WebStorageQuotaErrorAbort) == 209 static_assert(int(blink::WebStorageQuotaErrorAbort) ==
188 int(storage::kQuotaErrorAbort), 210 int(storage::kQuotaErrorAbort),
189 "mismatching enums: kQuotaErrorAbort"); 211 "mismatching enums: kQuotaErrorAbort");
190 212
191 } // namespace content 213 } // namespace content
OLDNEW
« no previous file with comments | « content/child/quota_dispatcher.h ('k') | content/renderer/render_frame_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698