OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |