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

Unified Diff: content/browser/quota_dispatcher_host.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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/webui/quota_internals/quota_internals_types.cc ('k') | content/child/quota_dispatcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/quota_dispatcher_host.cc
diff --git a/content/browser/quota_dispatcher_host.cc b/content/browser/quota_dispatcher_host.cc
index 3cbfee2c24dcd5c3910d6fd7f14b1a4a29a0812c..cd830203f1d044cf9a2ba041e41e67f09486ad04 100644
--- a/content/browser/quota_dispatcher_host.cc
+++ b/content/browser/quota_dispatcher_host.cc
@@ -83,6 +83,7 @@ class QuotaDispatcherHost::QueryUsageAndQuotaDispatcher
if (!dispatcher_host())
return;
if (status != storage::kQuotaStatusOk) {
+ LOG(ERROR) << "Sending DidFail";
dispatcher_host()->Send(new QuotaMsg_DidFail(request_id(), status));
} else {
dispatcher_host()->Send(new QuotaMsg_DidQueryStorageUsageAndQuota(
@@ -118,13 +119,20 @@ class QuotaDispatcherHost::RequestQuotaDispatcher
DCHECK(dispatcher_host());
DCHECK(params_.storage_type == storage::kStorageTypeTemporary ||
- params_.storage_type == storage::kStorageTypePersistent);
+ params_.storage_type == storage::kStorageTypePersistent ||
+ params_.storage_type == storage::kStorageTypeDurable);
if (params_.storage_type == storage::kStorageTypePersistent) {
quota_manager()->GetUsageAndQuotaForWebApps(
params_.origin_url, params_.storage_type,
base::Bind(&self_type::DidGetPersistentUsageAndQuota,
weak_factory_.GetWeakPtr()));
+ } else if (params_.storage_type == storage::kStorageTypeDurable) {
+ quota_manager()->GetDurability(
+ params_.origin_url,
+ base::Bind(&self_type::DidGetDurable,
+ weak_factory_.GetWeakPtr()));
} else {
+ LOG(ERROR) << "Got here A";
quota_manager()->GetUsageAndQuotaForWebApps(
params_.origin_url, params_.storage_type,
base::Bind(&self_type::DidGetTemporaryUsageAndQuota,
@@ -133,6 +141,29 @@ class QuotaDispatcherHost::RequestQuotaDispatcher
}
private:
+
+ void DidGetDurable(QuotaStatusCode status, bool durable) {
+ LOG(ERROR) << "Inside DidGetDurable = " << status << ":" << durable;
+ if (!dispatcher_host())
+ return;
+ if (status != storage::kQuotaStatusOk) {
+ DidFinish(status, 0, 0);
+ return;
+ }
+
+ if (quota_manager()->IsStorageUnlimited(params_.origin_url,
+ params_.storage_type)) {
+ // Seems like we can just let it go.
+ DidFinish(storage::kQuotaStatusOk, 0, 0);
+ return;
+ }
+ if (durable) {
+ DidFinish(status, 0, 0);
+ return;
+ }
+ LOG(ERROR) << "Need to ask for permission.";
+ }
+
void DidGetPersistentUsageAndQuota(QuotaStatusCode status,
int64 usage,
int64 quota) {
@@ -156,6 +187,7 @@ class QuotaDispatcherHost::RequestQuotaDispatcher
// Otherwise we need to consult with the permission context and
// possibly show a prompt.
DCHECK(permission_context());
+ LOG(ERROR) << "About to RequestQuotaPermission";
permission_context()->RequestQuotaPermission(params_, render_process_id(),
base::Bind(&self_type::DidGetPermissionResponse,
weak_factory_.GetWeakPtr()));
@@ -191,8 +223,8 @@ class QuotaDispatcherHost::RequestQuotaDispatcher
int64 granted_quota) {
if (!dispatcher_host())
return;
- DCHECK(dispatcher_host());
if (status != storage::kQuotaStatusOk) {
+ LOG(ERROR) << "Sending DidFail, status = " << status;
dispatcher_host()->Send(new QuotaMsg_DidFail(request_id(), status));
} else {
dispatcher_host()->Send(new QuotaMsg_DidGrantStorageQuota(
@@ -244,9 +276,14 @@ void QuotaDispatcherHost::OnQueryStorageUsageAndQuota(
void QuotaDispatcherHost::OnRequestStorageQuota(
const StorageQuotaParams& params) {
+ LOG(ERROR)
+ << "Got into QuotaDispatcherHost::OnRequestStorageQuota storage_type = "
+ << params.storage_type;
if (params.storage_type != storage::kStorageTypeTemporary &&
+ params.storage_type != storage::kStorageTypeDurable &&
params.storage_type != storage::kStorageTypePersistent) {
// Unsupported storage types.
+ LOG(ERROR) << "Sending DidFail";
Send(new QuotaMsg_DidFail(params.request_id,
storage::kQuotaErrorNotSupported));
return;
« no previous file with comments | « chrome/browser/ui/webui/quota_internals/quota_internals_types.cc ('k') | content/child/quota_dispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698