summaryrefslogtreecommitdiffstats
path: root/webkit
diff options
context:
space:
mode:
authormichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 23:53:56 +0000
committermichaeln@google.com <michaeln@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-03-23 23:53:56 +0000
commit92e882e65c73c97f51e1a4ab366ee008257f418b (patch)
tree3387406a60a4cc9dcb69c0aa0398c117c81a3484 /webkit
parentb138785ed15d5fc5b4a071517962a02ddf21710f (diff)
downloadchromium_src-92e882e65c73c97f51e1a4ab366ee008257f418b.zip
chromium_src-92e882e65c73c97f51e1a4ab366ee008257f418b.tar.gz
chromium_src-92e882e65c73c97f51e1a4ab366ee008257f418b.tar.bz2
Be sure to create the 'Local Storage' directory if needed.
Review URL: https://chromiumcodereview.appspot.com/9839078 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@128613 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit')
-rw-r--r--webkit/dom_storage/dom_storage_context.cc7
-rw-r--r--webkit/dom_storage/dom_storage_context.h2
2 files changed, 8 insertions, 1 deletions
diff --git a/webkit/dom_storage/dom_storage_context.cc b/webkit/dom_storage/dom_storage_context.cc
index 5179a0e..78363d4 100644
--- a/webkit/dom_storage/dom_storage_context.cc
+++ b/webkit/dom_storage/dom_storage_context.cc
@@ -48,6 +48,13 @@ DomStorageNamespace* DomStorageContext::GetStorageNamespace(
StorageNamespaceMap::iterator found = namespaces_.find(namespace_id);
if (found == namespaces_.end()) {
if (namespace_id == kLocalStorageNamespaceId) {
+ if (!directory_.empty()) {
+ if (!file_util::CreateDirectory(directory_)) {
+ LOG(ERROR) << "Failed to create 'Local Storage' directory,"
+ " falling back to in-memory only.";
+ directory_ = FilePath();
+ }
+ }
DomStorageNamespace* local =
new DomStorageNamespace(directory_, task_runner_);
namespaces_[kLocalStorageNamespaceId] = local;
diff --git a/webkit/dom_storage/dom_storage_context.h b/webkit/dom_storage/dom_storage_context.h
index 696f69e..ee89e16 100644
--- a/webkit/dom_storage/dom_storage_context.h
+++ b/webkit/dom_storage/dom_storage_context.h
@@ -158,7 +158,7 @@ class DomStorageContext
StorageNamespaceMap namespaces_;
// Where localstorage data is stored, maybe empty for the incognito use case.
- const FilePath directory_;
+ FilePath directory_;
// Used to schedule sequenced background tasks.
scoped_refptr<DomStorageTaskRunner> task_runner_;