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

Unified Diff: content/browser/dom_storage/dom_storage_context_impl.cc

Issue 757723002: [Tests not passing yet] Remove prerender sessionStorage namespace merging. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 6 years 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 d8e7ac5041189092ace373d632363ff9b6a7873a..db9681cfe72208acbdc22d1d61366e12fbfaad82 100644
--- a/content/browser/dom_storage/dom_storage_context_impl.cc
+++ b/content/browser/dom_storage/dom_storage_context_impl.cc
@@ -227,16 +227,6 @@ void DOMStorageContextImpl::NotifyAreaCleared(
OnDOMStorageAreaCleared(area, page_url));
}
-void DOMStorageContextImpl::NotifyAliasSessionMerged(
- int64 namespace_id,
- DOMStorageNamespace* old_alias_master_namespace) {
- FOR_EACH_OBSERVER(
- EventObserver, event_observers_,
- OnDOMSessionStorageReset(namespace_id));
- if (old_alias_master_namespace)
- MaybeShutdownSessionNamespace(old_alias_master_namespace);
-}
-
std::string DOMStorageContextImpl::AllocatePersistentSessionId() {
std::string guid = base::GenerateGUID();
std::replace(guid.begin(), guid.end(), '-', '_');
@@ -261,36 +251,11 @@ void DOMStorageContextImpl::DeleteSessionNamespace(
int64 namespace_id, bool should_persist_data) {
DCHECK_NE(kLocalStorageNamespaceId, namespace_id);
StorageNamespaceMap::const_iterator it = namespaces_.find(namespace_id);
- if (it == namespaces_.end() ||
- it->second->ready_for_deletion_pending_aliases()) {
- return;
- }
- it->second->set_ready_for_deletion_pending_aliases(true);
- DOMStorageNamespace* alias_master = it->second->alias_master_namespace();
- if (alias_master) {
- DCHECK(it->second->num_aliases() == 0);
- DCHECK(alias_master->alias_master_namespace() == NULL);
- if (should_persist_data)
- alias_master->set_must_persist_at_shutdown(true);
- if (it->second->DecrementMasterAliasCount())
- MaybeShutdownSessionNamespace(alias_master);
- namespaces_.erase(namespace_id);
- } else {
- if (should_persist_data)
- it->second->set_must_persist_at_shutdown(true);
- MaybeShutdownSessionNamespace(it->second.get());
- }
-}
-
-void DOMStorageContextImpl::MaybeShutdownSessionNamespace(
- DOMStorageNamespace* ns) {
- if (ns->num_aliases() > 0 || !ns->ready_for_deletion_pending_aliases())
+ if (it == namespaces_.end())
return;
- DCHECK_EQ(ns->num_aliases(), 0);
- DCHECK(ns->alias_master_namespace() == NULL);
- std::string persistent_namespace_id = ns->persistent_namespace_id();
+ std::string persistent_namespace_id = it->second->persistent_namespace_id();
if (session_storage_database_.get()) {
- if (!ns->must_persist_at_shutdown()) {
+ if (!should_persist_data) {
task_runner_->PostShutdownBlockingTask(
FROM_HERE,
DOMStorageTaskRunner::COMMIT_SEQUENCE,
@@ -300,7 +265,7 @@ void DOMStorageContextImpl::MaybeShutdownSessionNamespace(
persistent_namespace_id));
} else {
// Ensure that the data gets committed before we shut down.
- ns->Shutdown();
+ it->second->Shutdown();
if (!scavenging_started_) {
// Protect the persistent namespace ID from scavenging.
protected_persistent_session_ids_.insert(persistent_namespace_id);
@@ -308,7 +273,7 @@ void DOMStorageContextImpl::MaybeShutdownSessionNamespace(
}
}
persistent_namespace_id_to_namespace_id_.erase(persistent_namespace_id);
- namespaces_.erase(ns->namespace_id());
+ namespaces_.erase(namespace_id);
}
void DOMStorageContextImpl::CloneSessionNamespace(
@@ -325,21 +290,6 @@ void DOMStorageContextImpl::CloneSessionNamespace(
CreateSessionNamespace(new_id, new_persistent_id);
}
-void DOMStorageContextImpl::CreateAliasSessionNamespace(
- int64 existing_id, int64 new_id,
- const std::string& persistent_id) {
- if (is_shutdown_)
- return;
- DCHECK_NE(kLocalStorageNamespaceId, existing_id);
- DCHECK_NE(kLocalStorageNamespaceId, new_id);
- StorageNamespaceMap::iterator found = namespaces_.find(existing_id);
- if (found != namespaces_.end()) {
- namespaces_[new_id] = found->second->CreateAlias(new_id);
- } else {
- CreateSessionNamespace(new_id, persistent_id);
- }
-}
-
void DOMStorageContextImpl::ClearSessionOnlyOrigins() {
if (!localstorage_directory_.empty()) {
std::vector<LocalStorageUsageInfo> infos;
@@ -458,39 +408,4 @@ void DOMStorageContextImpl::DeleteNextUnusedNamespaceInCommitSequence() {
}
}
-void DOMStorageContextImpl::AddTransactionLogProcessId(int64 namespace_id,
- int process_id) {
- DCHECK_NE(kLocalStorageNamespaceId, namespace_id);
- StorageNamespaceMap::const_iterator it = namespaces_.find(namespace_id);
- if (it == namespaces_.end())
- return;
- it->second->AddTransactionLogProcessId(process_id);
-}
-
-void DOMStorageContextImpl::RemoveTransactionLogProcessId(int64 namespace_id,
- int process_id) {
- DCHECK_NE(kLocalStorageNamespaceId, namespace_id);
- StorageNamespaceMap::const_iterator it = namespaces_.find(namespace_id);
- if (it == namespaces_.end())
- return;
- it->second->RemoveTransactionLogProcessId(process_id);
-}
-
-SessionStorageNamespace::MergeResult
-DOMStorageContextImpl::MergeSessionStorage(
- int64 namespace1_id, bool actually_merge, int process_id,
- int64 namespace2_id) {
- DCHECK_NE(kLocalStorageNamespaceId, namespace1_id);
- DCHECK_NE(kLocalStorageNamespaceId, namespace2_id);
- StorageNamespaceMap::const_iterator it = namespaces_.find(namespace1_id);
- if (it == namespaces_.end())
- return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND;
- DOMStorageNamespace* ns1 = it->second.get();
- it = namespaces_.find(namespace2_id);
- if (it == namespaces_.end())
- return SessionStorageNamespace::MERGE_RESULT_NAMESPACE_NOT_FOUND;
- DOMStorageNamespace* ns2 = it->second.get();
- return ns1->Merge(actually_merge, process_id, ns2, this);
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698