| 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 d525462ee2ab28b0ab892fc5520086d7e1ffcada..f3f1b63c0985325d86af7c510f89f68050025406 100644
|
| --- a/content/browser/dom_storage/dom_storage_context_impl.cc
|
| +++ b/content/browser/dom_storage/dom_storage_context_impl.cc
|
| @@ -6,6 +6,7 @@
|
|
|
| #include "base/bind.h"
|
| #include "base/bind_helpers.h"
|
| +#include "base/command_line.h"
|
| #include "base/file_path.h"
|
| #include "base/message_loop_proxy.h"
|
| #include "content/browser/dom_storage/session_storage_namespace_impl.h"
|
| @@ -24,6 +25,7 @@ using dom_storage::DomStorageWorkerPoolTaskRunner;
|
| namespace {
|
|
|
| const char kLocalStorageDirectory[] = "Local Storage";
|
| +const char kSessionStorageDirectory[] = "Session Storage";
|
|
|
| void InvokeUsageInfoCallbackHelper(
|
| const DOMStorageContext::GetUsageInfoCallback& callback,
|
| @@ -50,12 +52,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) ?
|
| + FilePath() : data_path.AppendASCII(kSessionStorageDirectory),
|
| special_storage_policy,
|
| new DomStorageWorkerPoolTaskRunner(
|
| worker_pool,
|
| @@ -92,6 +98,10 @@ DOMStorageContextImpl::RecreateSessionStorage(
|
| new SessionStorageNamespaceImpl(this, persistent_id));
|
| }
|
|
|
| +void DOMStorageContextImpl::StartScavengingUnusedSessionStorage() {
|
| + context_->StartScavengingUnusedSessionStorage();
|
| +}
|
| +
|
| void DOMStorageContextImpl::PurgeMemory() {
|
| DCHECK(context_);
|
| context_->task_runner()->PostShutdownBlockingTask(
|
|
|