summaryrefslogtreecommitdiffstats
path: root/chrome/browser/in_process_webkit
diff options
context:
space:
mode:
authorjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-03 06:51:15 +0000
committerjorlow@chromium.org <jorlow@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-03 06:51:15 +0000
commit75c91e64b82abaa843d9327f7b57cc9a0abe1696 (patch)
tree28e9093690edc475c7a7d69b21a90facef3d2641 /chrome/browser/in_process_webkit
parent8922e1ff7ac33a3f88079e1e6d3ae8671602a952 (diff)
downloadchromium_src-75c91e64b82abaa843d9327f7b57cc9a0abe1696.zip
chromium_src-75c91e64b82abaa843d9327f7b57cc9a0abe1696.tar.gz
chromium_src-75c91e64b82abaa843d9327f7b57cc9a0abe1696.tar.bz2
Add quota support.
Add a 5mb quota to DOM Storage. Most of the details are in an upstream patch (https://bugs.webkit.org/show_bug.cgi?id=29991 ). BUG=16876 TEST=I added a layout test upstream and it works. Review URL: http://codereview.chromium.org/255050 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27942 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/in_process_webkit')
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc11
-rw-r--r--chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h2
-rw-r--r--chrome/browser/in_process_webkit/storage_namespace.cc3
-rw-r--r--chrome/browser/in_process_webkit/storage_namespace.h3
4 files changed, 12 insertions, 7 deletions
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
index ac39acb..1e144ce 100644
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
+++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.cc
@@ -79,7 +79,7 @@ bool DOMStorageDispatcherHost::OnMessageReceived(
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageLength, OnLength)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageKey, OnKey)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageGetItem, OnGetItem)
- IPC_MESSAGE_HANDLER(ViewHostMsg_DOMStorageSetItem, OnSetItem)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(ViewHostMsg_DOMStorageSetItem, OnSetItem)
IPC_MESSAGE_HANDLER(ViewHostMsg_DOMStorageRemoveItem, OnRemoveItem)
IPC_MESSAGE_HANDLER(ViewHostMsg_DOMStorageClear, OnClear)
IPC_MESSAGE_UNHANDLED(handled = false)
@@ -254,13 +254,13 @@ void DOMStorageDispatcherHost::OnGetItem(int64 storage_area_id,
}
void DOMStorageDispatcherHost::OnSetItem(int64 storage_area_id,
- const string16& key,
- const string16& value) {
+ const string16& key, const string16& value, IPC::Message* reply_msg) {
DCHECK(!shutdown_);
if (ChromeThread::CurrentlyOn(ChromeThread::IO)) {
MessageLoop* webkit_loop = webkit_thread_->GetMessageLoop();
webkit_loop->PostTask(FROM_HERE, NewRunnableMethod(this,
- &DOMStorageDispatcherHost::OnSetItem, storage_area_id, key, value));
+ &DOMStorageDispatcherHost::OnSetItem, storage_area_id, key, value,
+ reply_msg));
return;
}
@@ -273,7 +273,8 @@ void DOMStorageDispatcherHost::OnSetItem(int64 storage_area_id,
return;
}
storage_area->SetItem(key, value, &quota_exception);
- DCHECK(!quota_exception); // This is tracked by the renderer.
+ ViewHostMsg_DOMStorageSetItem::WriteReplyParams(reply_msg, quota_exception);
+ Send(reply_msg);
}
void DOMStorageDispatcherHost::OnRemoveItem(int64 storage_area_id,
diff --git a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
index a0d3d77..2e6ee96 100644
--- a/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
+++ b/chrome/browser/in_process_webkit/dom_storage_dispatcher_host.h
@@ -51,7 +51,7 @@ class DOMStorageDispatcherHost :
void OnGetItem(int64 storage_area_id, const string16& key,
IPC::Message* reply_msg);
void OnSetItem(int64 storage_area_id, const string16& key,
- const string16& value);
+ const string16& value, IPC::Message* reply_msg);
void OnRemoveItem(int64 storage_area_id, const string16& key);
void OnClear(int64 storage_area_id);
diff --git a/chrome/browser/in_process_webkit/storage_namespace.cc b/chrome/browser/in_process_webkit/storage_namespace.cc
index fa2c74a..6629f22 100644
--- a/chrome/browser/in_process_webkit/storage_namespace.cc
+++ b/chrome/browser/in_process_webkit/storage_namespace.cc
@@ -24,7 +24,8 @@ StorageNamespace* StorageNamespace::CreateLocalStorageNamespace(
DCHECK(!dom_storage_context->GetStorageNamespace(id));
WebString path = webkit_glue::FilePathToWebString(dir_path);
WebStorageNamespace* web_storage_namespace =
- WebStorageNamespace::createLocalStorageNamespace(path);
+ WebStorageNamespace::createLocalStorageNamespace(path,
+ kLocalStorageQuota);
return new StorageNamespace(dom_storage_context, web_storage_namespace, id,
DOM_STORAGE_LOCAL);
}
diff --git a/chrome/browser/in_process_webkit/storage_namespace.h b/chrome/browser/in_process_webkit/storage_namespace.h
index 91e0ae6..712dd41 100644
--- a/chrome/browser/in_process_webkit/storage_namespace.h
+++ b/chrome/browser/in_process_webkit/storage_namespace.h
@@ -55,6 +55,9 @@ class StorageNamespace {
// SessionStorage vs. LocalStorage.
const DOMStorageType storage_type_;
+ // The quota for each storage area. Suggested by the spec.
+ static const unsigned kLocalStorageQuota = 5 * 1024 * 1024;
+
DISALLOW_IMPLICIT_CONSTRUCTORS(StorageNamespace);
};