Index: chrome/browser/sessions/session_restore.cc |
diff --git a/chrome/browser/sessions/session_restore.cc b/chrome/browser/sessions/session_restore.cc |
index 325165669502a0ac37afd82b5e739d5354b323b5..a0782b23e8ee0924bd26b709cf5f1e9332b07b6a 100644 |
--- a/chrome/browser/sessions/session_restore.cc |
+++ b/chrome/browser/sessions/session_restore.cc |
@@ -67,6 +67,13 @@ TabLoader* shared_tab_loader = NULL; |
// Pointers to SessionRestoreImpls which are currently restoring the session. |
std::set<SessionRestoreImpl*>* active_session_restorers = NULL; |
+// Helper to use with BrowserContext::ForEachStoragePartition(). |
+void StartScavengingUnusedSessionStorage(const std::string& id, |
+ content::StoragePartition* storage_partition) { |
+ storage_partition->GetDOMStorageContext()-> |
+ StartScavengingUnusedSessionStorage(); |
+} |
+ |
// TabLoader ------------------------------------------------------------------ |
// Initial delay (see class decription for details). |
@@ -594,7 +601,7 @@ class SessionRestoreImpl : public content::NotificationObserver { |
selected_index, |
true, |
tab.extension_app_id, |
- NULL, |
+ content::SessionStorageNamespaceMap(), |
tab.user_agent_override); |
} else { |
int tab_index = use_new_window ? 0 : browser->active_index() + 1; |
@@ -607,7 +614,7 @@ class SessionRestoreImpl : public content::NotificationObserver { |
false, // selected |
tab.pinned, |
true, |
- NULL, |
+ content::SessionStorageNamespaceMap(), |
tab.user_agent_override); |
// Start loading the tab immediately. |
web_contents->GetController().LoadIfNecessary(); |
@@ -741,8 +748,9 @@ class SessionRestoreImpl : public content::NotificationObserver { |
if (windows->empty()) { |
// Restore was unsuccessful. The DOM storage system can also delete its |
// data, since no session restore will happen at a later point in time. |
- content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
- GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
+ content::BrowserContext::ForEachStoragePartition( |
+ profile_, |
+ base::Bind(&StartScavengingUnusedSessionStorage)); |
return FinishedTabCreation(false, false); |
} |
@@ -835,8 +843,9 @@ class SessionRestoreImpl : public content::NotificationObserver { |
// sessionStorages needed for the session restore have now been recreated |
// by RestoreTab. Now it's safe for the DOM storage system to start |
// deleting leftover data. |
- content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
- GetDOMStorageContext()->StartScavengingUnusedSessionStorage(); |
+ content::BrowserContext::ForEachStoragePartition( |
+ profile_, |
+ base::Bind(&StartScavengingUnusedSessionStorage)); |
return last_browser; |
} |
@@ -891,12 +900,19 @@ class SessionRestoreImpl : public content::NotificationObserver { |
RecordAppLaunchForTab(browser, tab, selected_index); |
// Associate sessionStorage (if any) to the restored tab. |
- scoped_refptr<content::SessionStorageNamespace> session_storage_namespace; |
- if (!tab.session_storage_persistent_id.empty()) { |
- session_storage_namespace = |
- content::BrowserContext::GetDefaultStoragePartition(profile_)-> |
- GetDOMStorageContext()->RecreateSessionStorage( |
- tab.session_storage_persistent_id); |
+ content::SessionStorageNamespaceMap restored_session_storage_namespaces; |
+ for (std::map<std::string, std::string>::const_iterator it = |
+ tab.session_storage_persistent_id_map.begin(); |
+ it != tab.session_storage_persistent_id_map.end(); |
+ ++it) { |
+ using content::BrowserContext; |
+ if (BrowserContext::IsValidPartitionId(profile_, it->first)) { |
+ content::StoragePartition* partition = |
+ BrowserContext::GetStoragePartitionById(profile_, it->first); |
+ restored_session_storage_namespaces[it->first] = |
+ partition->GetDOMStorageContext()-> |
+ RecreateSessionStorage(it->second); |
+ } |
} |
WebContents* web_contents = |
@@ -908,7 +924,7 @@ class SessionRestoreImpl : public content::NotificationObserver { |
false, // select |
tab.pinned, |
true, |
- session_storage_namespace.get(), |
+ restored_session_storage_namespaces, |
tab.user_agent_override); |
// Regression check: check that the tab didn't start loading right away. The |
// focused tab will be loaded by Browser, and TabLoader will load the rest. |