Index: content/browser/dom_storage/dom_storage_context_impl.cc |
diff --git a/content/browser/dom_storage/dom_storage_context_impl.cc b/content/browser/dom_storage/dom_storage_context_impl.cc |
index 117c47acfa01762a1e8f4eac24921371946b2075..a9106ba3dbe9a3834c37a915e16fd2bae795c63d 100644 |
--- a/content/browser/dom_storage/dom_storage_context_impl.cc |
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc |
@@ -6,7 +6,9 @@ |
#include "base/bind.h" |
#include "base/bind_helpers.h" |
+#include "base/command_line.h" |
#include "base/message_loop_proxy.h" |
+#include "content/browser/dom_storage/session_storage_namespace_impl.h" |
#include "content/public/browser/browser_thread.h" |
#include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebString.h" |
#include "webkit/database/database_util.h" |
@@ -26,6 +28,7 @@ using webkit_database::DatabaseUtil; |
namespace { |
const char kLocalStorageDirectory[] = "Local Storage"; |
+const char kSessionStorageDirectory[] = "Session Storage"; |
void InvokeUsageInfoCallbackHelper( |
const DOMStorageContext::GetUsageInfoCallback& callback, |
@@ -100,12 +103,16 @@ DOMStorageContextImpl::DOMStorageContextImpl( |
const FilePath& data_path, |
quota::SpecialStoragePolicy* special_storage_policy) { |
base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool(); |
- // TODO(marja): Pass a nonempty session storage directory when session storage |
- // is backed on disk. |
+ // TODO(marja): Remove this as soon as the sessionStorage on disk |
+ // implementation is on by default. |
+ const char kEnableRestoreSessionState[] = "enable-restore-session-state"; |
+ bool session_storage_on_disk = |
+ CommandLine::ForCurrentProcess()->HasSwitch(kEnableRestoreSessionState); |
context_ = new dom_storage::DomStorageContext( |
data_path.empty() ? |
data_path : data_path.AppendASCII(kLocalStorageDirectory), |
- FilePath(), // Empty session storage directory. |
+ (data_path.empty() || !session_storage_on_disk) ? |
+ data_path : data_path.AppendASCII(kSessionStorageDirectory), |
special_storage_policy, |
new DomStorageWorkerPoolTaskRunner( |
worker_pool, |
@@ -170,6 +177,23 @@ void DOMStorageContextImpl::DeleteLocalStorageFile(const FilePath& file_path) { |
FilePathToOrigin(file_path))); |
} |
+void DOMStorageContextImpl::DoomSessionStorage( |
+ const std::string& persistent_namespace_id) { |
+ DCHECK(context_); |
+ context_->task_runner()->PostShutdownBlockingTask( |
+ FROM_HERE, |
+ DomStorageTaskRunner::PRIMARY_SEQUENCE, |
+ base::Bind(&DomStorageContext::DoomSessionStorage, context_, |
+ persistent_namespace_id)); |
+} |
+ |
+scoped_refptr<content::SessionStorageNamespace> |
+DOMStorageContextImpl::RecreateSessionStorage( |
+ const std::string& persistent_id) { |
+ return scoped_refptr<content::SessionStorageNamespace>( |
+ new SessionStorageNamespaceImpl(this, persistent_id)); |
+} |
+ |
void DOMStorageContextImpl::PurgeMemory() { |
DCHECK(context_); |
context_->task_runner()->PostShutdownBlockingTask( |