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

Side by Side Diff: webkit/dom_storage/dom_storage_context.cc

Issue 12398008: Purge in-memory localStorage areas if the # of areas exceeds the limit (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: comment fix Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/dom_storage/dom_storage_area.h ('k') | webkit/dom_storage/dom_storage_host.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "webkit/dom_storage/dom_storage_context.h" 5 #include "webkit/dom_storage/dom_storage_context.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/guid.h" 10 #include "base/guid.h"
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 } 160 }
161 161
162 void DomStorageContext::PurgeMemory() { 162 void DomStorageContext::PurgeMemory() {
163 // We can only purge memory from the local storage namespace 163 // We can only purge memory from the local storage namespace
164 // which is backed by disk. 164 // which is backed by disk.
165 // TODO(marja): Purge sessionStorage, too. (Requires changes to the FastClear 165 // TODO(marja): Purge sessionStorage, too. (Requires changes to the FastClear
166 // functionality.) 166 // functionality.)
167 StorageNamespaceMap::iterator found = 167 StorageNamespaceMap::iterator found =
168 namespaces_.find(kLocalStorageNamespaceId); 168 namespaces_.find(kLocalStorageNamespaceId);
169 if (found != namespaces_.end()) 169 if (found != namespaces_.end())
170 found->second->PurgeMemory(); 170 found->second->PurgeMemory(DomStorageNamespace::PURGE_AGGRESSIVE);
171 } 171 }
172 172
173 void DomStorageContext::Shutdown() { 173 void DomStorageContext::Shutdown() {
174 is_shutdown_ = true; 174 is_shutdown_ = true;
175 StorageNamespaceMap::const_iterator it = namespaces_.begin(); 175 StorageNamespaceMap::const_iterator it = namespaces_.begin();
176 for (; it != namespaces_.end(); ++it) 176 for (; it != namespaces_.end(); ++it)
177 it->second->Shutdown(); 177 it->second->Shutdown();
178 178
179 if (localstorage_directory_.empty() && !session_storage_database_.get()) 179 if (localstorage_directory_.empty() && !session_storage_database_.get())
180 return; 180 return;
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 if (!deletable_persistent_namespace_ids_.empty()) { 415 if (!deletable_persistent_namespace_ids_.empty()) {
416 task_runner_->PostDelayedTask( 416 task_runner_->PostDelayedTask(
417 FROM_HERE, base::Bind( 417 FROM_HERE, base::Bind(
418 &DomStorageContext::DeleteNextUnusedNamespace, 418 &DomStorageContext::DeleteNextUnusedNamespace,
419 this), 419 this),
420 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); 420 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds));
421 } 421 }
422 } 422 }
423 423
424 } // namespace dom_storage 424 } // namespace dom_storage
OLDNEW
« no previous file with comments | « webkit/dom_storage/dom_storage_area.h ('k') | webkit/dom_storage/dom_storage_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698