| 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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
| 6 | 6 |
| 7 #if !defined(OS_IOS) | 7 #if !defined(OS_IOS) |
| 8 #include "content/browser/download/download_manager_impl.h" | 8 #include "content/browser/download/download_manager_impl.h" |
| 9 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 9 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
| 10 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 10 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 context->channel_id_service()->GetChannelIDStore()-> | 77 context->channel_id_service()->GetChannelIDStore()-> |
| 78 SetForceKeepSessionState(); | 78 SetForceKeepSessionState(); |
| 79 appcache_service->set_force_keep_session_state(); | 79 appcache_service->set_force_keep_session_state(); |
| 80 } | 80 } |
| 81 | 81 |
| 82 void SaveSessionStateOnIndexedDBThread( | 82 void SaveSessionStateOnIndexedDBThread( |
| 83 scoped_refptr<IndexedDBContextImpl> indexed_db_context) { | 83 scoped_refptr<IndexedDBContextImpl> indexed_db_context) { |
| 84 indexed_db_context->SetForceKeepSessionState(); | 84 indexed_db_context->SetForceKeepSessionState(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ShutdownServiceWorkerContext(StoragePartition* partition) { |
| 88 partition->GetServiceWorkerContext()->Terminate(); |
| 89 } |
| 90 |
| 87 } // namespace | 91 } // namespace |
| 88 | 92 |
| 89 // static | 93 // static |
| 90 void BrowserContext::AsyncObliterateStoragePartition( | 94 void BrowserContext::AsyncObliterateStoragePartition( |
| 91 BrowserContext* browser_context, | 95 BrowserContext* browser_context, |
| 92 const GURL& site, | 96 const GURL& site, |
| 93 const base::Closure& on_gc_required) { | 97 const base::Closure& on_gc_required) { |
| 94 GetStoragePartitionMap(browser_context)->AsyncObliterate(site, | 98 GetStoragePartitionMap(browser_context)->AsyncObliterate(site, |
| 95 on_gc_required); | 99 on_gc_required); |
| 96 } | 100 } |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 263 storage_partition->GetIndexedDBContext()); | 267 storage_partition->GetIndexedDBContext()); |
| 264 // No task runner in unit tests. | 268 // No task runner in unit tests. |
| 265 if (indexed_db_context_impl->TaskRunner()) { | 269 if (indexed_db_context_impl->TaskRunner()) { |
| 266 indexed_db_context_impl->TaskRunner()->PostTask( | 270 indexed_db_context_impl->TaskRunner()->PostTask( |
| 267 FROM_HERE, | 271 FROM_HERE, |
| 268 base::Bind(&SaveSessionStateOnIndexedDBThread, | 272 base::Bind(&SaveSessionStateOnIndexedDBThread, |
| 269 make_scoped_refptr(indexed_db_context_impl))); | 273 make_scoped_refptr(indexed_db_context_impl))); |
| 270 } | 274 } |
| 271 } | 275 } |
| 272 | 276 |
| 277 void BrowserContext::NotifyWillBeDestroyed() { |
| 278 // Service Workers must shutdown before the browser context is destroyed, |
| 279 // since they keep render process hosts alive and the codebase assumes that |
| 280 // render process hosts die before their profile (browser context) dies. |
| 281 ForEachStoragePartition(this, base::Bind(ShutdownServiceWorkerContext)); |
| 282 } |
| 283 |
| 273 #endif // !OS_IOS | 284 #endif // !OS_IOS |
| 274 | 285 |
| 275 BrowserContext::~BrowserContext() { | 286 BrowserContext::~BrowserContext() { |
| 276 #if !defined(OS_IOS) | 287 #if !defined(OS_IOS) |
| 277 if (GetUserData(kDownloadManagerKeyName)) | 288 if (GetUserData(kDownloadManagerKeyName)) |
| 278 GetDownloadManager(this)->Shutdown(); | 289 GetDownloadManager(this)->Shutdown(); |
| 279 #endif | 290 #endif |
| 280 } | 291 } |
| 281 | 292 |
| 282 } // namespace content | 293 } // namespace content |
| OLD | NEW |