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

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: Code review & fixes. Created 8 years, 5 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..c7ab9fd53444d69e269dafbf1c1b18ed258aeee9 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -24,6 +24,7 @@ using dom_storage::DomStorageWorkerPoolTaskRunner;
namespace {
const char kLocalStorageDirectory[] = "Local Storage";
+const char kSessionStorageDirectory[] = "Session Storage";
void InvokeUsageInfoCallbackHelper(
const DOMStorageContext::GetUsageInfoCallback& callback,
@@ -48,14 +49,14 @@ void GetUsageInfoHelper(
DOMStorageContextImpl::DOMStorageContextImpl(
const FilePath& data_path,
- quota::SpecialStoragePolicy* special_storage_policy) {
+ quota::SpecialStoragePolicy* special_storage_policy,
+ bool save_session_storage_on_disk) {
base::SequencedWorkerPool* worker_pool = BrowserThread::GetBlockingPool();
- // TODO(marja): Pass a nonempty session storage directory when session storage
- // is backed on disk.
context_ = new dom_storage::DomStorageContext(
data_path.empty() ?
data_path : data_path.AppendASCII(kLocalStorageDirectory),
- FilePath(), // Empty session storage directory.
+ (data_path.empty() || !save_session_storage_on_disk) ?
+ FilePath() : data_path.AppendASCII(kSessionStorageDirectory),
special_storage_policy,
new DomStorageWorkerPoolTaskRunner(
worker_pool,
@@ -92,6 +93,15 @@ DOMStorageContextImpl::RecreateSessionStorage(
new SessionStorageNamespaceImpl(this, persistent_id));
}
+void DOMStorageContextImpl::StartScavengingUnusedSessionStorage() {
+ DCHECK(context_);
jam 2012/07/11 15:51:35 nit: dcheck is unnecessary, if it's NULL, the next
marja 2012/07/12 09:22:03 In all other funcs in this file there is DCHECK(co
+ context_->task_runner()->PostShutdownBlockingTask(
+ FROM_HERE,
+ DomStorageTaskRunner::PRIMARY_SEQUENCE,
+ base::Bind(&DomStorageContext::StartScavengingUnusedSessionStorage,
+ context_));
+}
+
void DOMStorageContextImpl::PurgeMemory() {
DCHECK(context_);
context_->task_runner()->PostShutdownBlockingTask(

Powered by Google App Engine
This is Rietveld 408576698