| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 infos->push_back(info); | 104 infos->push_back(info); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 // TODO(marja): Get usage infos for sessionStorage (crbug.com/123599). | 107 // TODO(marja): Get usage infos for sessionStorage (crbug.com/123599). |
| 108 } | 108 } |
| 109 | 109 |
| 110 void DomStorageContext::DeleteOrigin(const GURL& origin) { | 110 void DomStorageContext::DeleteOrigin(const GURL& origin) { |
| 111 DCHECK(!is_shutdown_); | 111 DCHECK(!is_shutdown_); |
| 112 DomStorageNamespace* local = GetStorageNamespace(kLocalStorageNamespaceId); | 112 DomStorageNamespace* local = GetStorageNamespace(kLocalStorageNamespaceId); |
| 113 local->DeleteOrigin(origin); | 113 local->DeleteOrigin(origin); |
| 114 // Synthesize a 'cleared' event if the area is open so CachedAreas in |
| 115 // renderers get emptied out too. |
| 116 DomStorageArea* area = local->GetOpenStorageArea(origin); |
| 117 if (area) |
| 118 NotifyAreaCleared(area, origin); |
| 114 } | 119 } |
| 115 | 120 |
| 116 void DomStorageContext::PurgeMemory() { | 121 void DomStorageContext::PurgeMemory() { |
| 117 // We can only purge memory from the local storage namespace | 122 // We can only purge memory from the local storage namespace |
| 118 // which is backed by disk. | 123 // which is backed by disk. |
| 119 StorageNamespaceMap::iterator found = | 124 StorageNamespaceMap::iterator found = |
| 120 namespaces_.find(kLocalStorageNamespaceId); | 125 namespaces_.find(kLocalStorageNamespaceId); |
| 121 if (found != namespaces_.end()) | 126 if (found != namespaces_.end()) |
| 122 found->second->PurgeMemory(); | 127 found->second->PurgeMemory(); |
| 123 } | 128 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 361 if (!deletable_persistent_namespace_ids_.empty()) { | 366 if (!deletable_persistent_namespace_ids_.empty()) { |
| 362 task_runner_->PostDelayedTask( | 367 task_runner_->PostDelayedTask( |
| 363 FROM_HERE, base::Bind( | 368 FROM_HERE, base::Bind( |
| 364 &DomStorageContext::DeleteNextUnusedNamespace, | 369 &DomStorageContext::DeleteNextUnusedNamespace, |
| 365 this), | 370 this), |
| 366 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); | 371 base::TimeDelta::FromSeconds(kSessionStoraceScavengingSeconds)); |
| 367 } | 372 } |
| 368 } | 373 } |
| 369 | 374 |
| 370 } // namespace dom_storage | 375 } // namespace dom_storage |
| OLD | NEW |