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 "content/browser/dom_storage/dom_storage_context_impl.h" | 5 #include "content/browser/dom_storage/dom_storage_context_impl.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/files/file_enumerator.h" | 10 #include "base/files/file_enumerator.h" |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 DCHECK(it->second->num_aliases() == 0); | 271 DCHECK(it->second->num_aliases() == 0); |
272 DCHECK(alias_master->alias_master_namespace() == NULL); | 272 DCHECK(alias_master->alias_master_namespace() == NULL); |
273 if (should_persist_data) | 273 if (should_persist_data) |
274 alias_master->set_must_persist_at_shutdown(true); | 274 alias_master->set_must_persist_at_shutdown(true); |
275 if (it->second->DecrementMasterAliasCount()) | 275 if (it->second->DecrementMasterAliasCount()) |
276 MaybeShutdownSessionNamespace(alias_master); | 276 MaybeShutdownSessionNamespace(alias_master); |
277 namespaces_.erase(namespace_id); | 277 namespaces_.erase(namespace_id); |
278 } else { | 278 } else { |
279 if (should_persist_data) | 279 if (should_persist_data) |
280 it->second->set_must_persist_at_shutdown(true); | 280 it->second->set_must_persist_at_shutdown(true); |
281 MaybeShutdownSessionNamespace(it->second); | 281 MaybeShutdownSessionNamespace(it->second.get()); |
282 } | 282 } |
283 } | 283 } |
284 | 284 |
285 void DOMStorageContextImpl::MaybeShutdownSessionNamespace( | 285 void DOMStorageContextImpl::MaybeShutdownSessionNamespace( |
286 DOMStorageNamespace* ns) { | 286 DOMStorageNamespace* ns) { |
287 if (ns->num_aliases() > 0 || !ns->ready_for_deletion_pending_aliases()) | 287 if (ns->num_aliases() > 0 || !ns->ready_for_deletion_pending_aliases()) |
288 return; | 288 return; |
289 DCHECK_EQ(ns->num_aliases(), 0); | 289 DCHECK_EQ(ns->num_aliases(), 0); |
290 DCHECK(ns->alias_master_namespace() == NULL); | 290 DCHECK(ns->alias_master_namespace() == NULL); |
291 std::string persistent_namespace_id = ns->persistent_namespace_id(); | 291 std::string persistent_namespace_id = ns->persistent_namespace_id(); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 | 478 |
479 SessionStorageNamespace::MergeResult | 479 SessionStorageNamespace::MergeResult |
480 DOMStorageContextImpl::MergeSessionStorage( | 480 DOMStorageContextImpl::MergeSessionStorage( |
481 int64 namespace1_id, bool actually_merge, int process_id, | 481 int64 namespace1_id, bool actually_merge, int process_id, |
482 int64 namespace2_id) { | 482 int64 namespace2_id) { |
483 DCHECK_NE(kLocalStorageNamespaceId, namespace1_id); | 483 DCHECK_NE(kLocalStorageNamespaceId, namespace1_id); |
484 DCHECK_NE(kLocalStorageNamespaceId, namespace2_id); | 484 DCHECK_NE(kLocalStorageNamespaceId, namespace2_id); |
485 StorageNamespaceMap::const_iterator it = namespaces_.find(namespace1_id); | 485 StorageNamespaceMap::const_iterator it = namespaces_.find(namespace1_id); |
486 if (it == namespaces_.end()) | 486 if (it == namespaces_.end()) |
487 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; | 487 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; |
488 DOMStorageNamespace* ns1 = it->second; | 488 DOMStorageNamespace* ns1 = it->second.get(); |
489 it = namespaces_.find(namespace2_id); | 489 it = namespaces_.find(namespace2_id); |
490 if (it == namespaces_.end()) | 490 if (it == namespaces_.end()) |
491 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; | 491 return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND; |
492 DOMStorageNamespace* ns2 = it->second; | 492 DOMStorageNamespace* ns2 = it->second.get(); |
493 return ns1->Merge(actually_merge, process_id, ns2, this); | 493 return ns1->Merge(actually_merge, process_id, ns2, this); |
494 } | 494 } |
495 | 495 |
496 } // namespace content | 496 } // namespace content |
OLD | NEW |