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

Unified Diff: content/browser/browser_context.cc

Issue 10850010: Make session restore understand that tabs have multiple SessionStorageNamespaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: attempt to fix unittsets. Created 8 years, 4 months 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
« no previous file with comments | « chrome/test/base/in_process_browser_test.h ('k') | content/browser/storage_partition_impl.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/browser_context.cc
diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc
index 4916ea0b0eb60705155fde2f34526dda2823c18d..083fce8fefee569c6c255ee21fd85716672754e3 100644
--- a/content/browser/browser_context.cc
+++ b/content/browser/browser_context.cc
@@ -33,27 +33,18 @@ namespace content {
namespace {
-StoragePartition* GetStoragePartitionByPartitionId(
- BrowserContext* browser_context,
- const std::string& partition_id) {
- StoragePartitionImplMap* partition_map =
- static_cast<StoragePartitionImplMap*>(
- browser_context->GetUserData(kStorageParitionMapKeyName));
- if (!partition_map) {
- partition_map = new StoragePartitionImplMap(browser_context);
- browser_context->SetUserData(kStorageParitionMapKeyName, partition_map);
- }
-
- return partition_map->Get(partition_id);
-}
-
-// Run |callback| on each DOMStorageContextImpl in |browser_context|.
void PurgeDOMStorageContextInPartition(const std::string& id,
StoragePartition* storage_partition) {
static_cast<StoragePartitionImpl*>(storage_partition)->
GetDOMStorageContext()->PurgeMemory();
}
+void KeepSessionStateInPartition(const std::string& id,
+ StoragePartition* storage_partition) {
+ static_cast<StoragePartitionImpl*>(storage_partition)->
+ GetDOMStorageContext()->SetForceKeepSessionState();
+}
+
void SaveSessionStateOnIOThread(ResourceContext* resource_context) {
resource_context->GetRequestContext()->cookie_store()->GetCookieMonster()->
SetForceKeepSessionState();
@@ -134,6 +125,12 @@ fileapi::FileSystemContext* BrowserContext::GetFileSystemContext(
return GetDefaultStoragePartition(browser_context)->GetFileSystemContext();
}
+bool BrowserContext::IsValidPartitionId(BrowserContext* browser_context,
+ const std::string& partition_id) {
+ return GetContentClient()->browser()->IsValidStoragePartitionId(
+ browser_context, partition_id);
+}
+
StoragePartition* BrowserContext::GetStoragePartition(
BrowserContext* browser_context,
SiteInstance* site_instance) {
@@ -147,7 +144,21 @@ StoragePartition* BrowserContext::GetStoragePartition(
site_instance);
}
- return GetStoragePartitionByPartitionId(browser_context, partition_id);
+ return GetStoragePartitionById(browser_context, partition_id);
+}
+
+StoragePartition* BrowserContext::GetStoragePartitionById(
+ BrowserContext* browser_context,
+ const std::string& partition_id) {
+ StoragePartitionImplMap* partition_map =
+ static_cast<StoragePartitionImplMap*>(
+ browser_context->GetUserData(kStorageParitionMapKeyName));
+ if (!partition_map) {
+ partition_map = new StoragePartitionImplMap(browser_context);
+ browser_context->SetUserData(kStorageParitionMapKeyName, partition_map);
+ }
+
+ return partition_map->Get(partition_id);
}
void BrowserContext::ForEachStoragePartition(
@@ -189,10 +200,8 @@ void BrowserContext::SaveSessionState(BrowserContext* browser_context) {
browser_context->GetResourceContext()));
}
- DOMStorageContextImpl* dom_storage_context_impl =
- static_cast<DOMStorageContextImpl*>(
- GetDefaultStoragePartition(browser_context)->GetDOMStorageContext());
- dom_storage_context_impl->SetForceKeepSessionState();
+ ForEachStoragePartition(browser_context,
+ base::Bind(&KeepSessionStateInPartition));
if (BrowserThread::IsMessageLoopValid(BrowserThread::WEBKIT_DEPRECATED)) {
IndexedDBContextImpl* indexed_db = static_cast<IndexedDBContextImpl*>(
« no previous file with comments | « chrome/test/base/in_process_browser_test.h ('k') | content/browser/storage_partition_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698