| 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*>(
|
|
|