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

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.cc

Issue 9963107: Persist sessionStorage on disk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: session only rules Created 8 years, 6 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
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(

Powered by Google App Engine
This is Rietveld 408576698