| 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/browser/storage_partition_impl.h" | 5 #include "content/browser/storage_partition_impl.h" |
| 6 | 6 |
| 7 #include "base/sequenced_task_runner.h" | 7 #include "base/sequenced_task_runner.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/browser/browser_main_loop.h" | 9 #include "content/browser/browser_main_loop.h" |
| 10 #include "content/browser/fileapi/browser_file_system_helper.h" | 10 #include "content/browser/fileapi/browser_file_system_helper.h" |
| (...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 } | 318 } |
| 319 | 319 |
| 320 StoragePartitionImpl::StoragePartitionImpl( | 320 StoragePartitionImpl::StoragePartitionImpl( |
| 321 const base::FilePath& partition_path, | 321 const base::FilePath& partition_path, |
| 322 quota::QuotaManager* quota_manager, | 322 quota::QuotaManager* quota_manager, |
| 323 ChromeAppCacheService* appcache_service, | 323 ChromeAppCacheService* appcache_service, |
| 324 fileapi::FileSystemContext* filesystem_context, | 324 fileapi::FileSystemContext* filesystem_context, |
| 325 webkit_database::DatabaseTracker* database_tracker, | 325 webkit_database::DatabaseTracker* database_tracker, |
| 326 DOMStorageContextWrapper* dom_storage_context, | 326 DOMStorageContextWrapper* dom_storage_context, |
| 327 IndexedDBContextImpl* indexed_db_context, | 327 IndexedDBContextImpl* indexed_db_context, |
| 328 ServiceWorkerContext* service_worker_context, | 328 ServiceWorkerContextWrapper* service_worker_context, |
| 329 WebRTCIdentityStore* webrtc_identity_store, | 329 WebRTCIdentityStore* webrtc_identity_store, |
| 330 quota::SpecialStoragePolicy* special_storage_policy) | 330 quota::SpecialStoragePolicy* special_storage_policy) |
| 331 : partition_path_(partition_path), | 331 : partition_path_(partition_path), |
| 332 quota_manager_(quota_manager), | 332 quota_manager_(quota_manager), |
| 333 appcache_service_(appcache_service), | 333 appcache_service_(appcache_service), |
| 334 filesystem_context_(filesystem_context), | 334 filesystem_context_(filesystem_context), |
| 335 database_tracker_(database_tracker), | 335 database_tracker_(database_tracker), |
| 336 dom_storage_context_(dom_storage_context), | 336 dom_storage_context_(dom_storage_context), |
| 337 indexed_db_context_(indexed_db_context), | 337 indexed_db_context_(indexed_db_context), |
| 338 service_worker_context_(service_worker_context), | 338 service_worker_context_(service_worker_context), |
| 339 webrtc_identity_store_(webrtc_identity_store), | 339 webrtc_identity_store_(webrtc_identity_store), |
| 340 special_storage_policy_(special_storage_policy) {} | 340 special_storage_policy_(special_storage_policy) {} |
| 341 | 341 |
| 342 StoragePartitionImpl::~StoragePartitionImpl() { | 342 StoragePartitionImpl::~StoragePartitionImpl() { |
| 343 // These message loop checks are just to avoid leaks in unittests. | 343 // These message loop checks are just to avoid leaks in unittests. |
| 344 if (GetDatabaseTracker() && | 344 if (GetDatabaseTracker() && |
| 345 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 345 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 346 BrowserThread::PostTask( | 346 BrowserThread::PostTask( |
| 347 BrowserThread::FILE, FROM_HERE, | 347 BrowserThread::FILE, FROM_HERE, |
| 348 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 348 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
| 349 GetDatabaseTracker())); | 349 GetDatabaseTracker())); |
| 350 } | 350 } |
| 351 | 351 |
| 352 if (GetFileSystemContext()) | 352 if (GetFileSystemContext()) |
| 353 GetFileSystemContext()->Shutdown(); | 353 GetFileSystemContext()->Shutdown(); |
| 354 | 354 |
| 355 if (GetDOMStorageContext()) | 355 if (GetDOMStorageContext()) |
| 356 GetDOMStorageContext()->Shutdown(); | 356 GetDOMStorageContext()->Shutdown(); |
| 357 |
| 358 if (GetServiceWorkerContext()) |
| 359 GetServiceWorkerContext()->Shutdown(); |
| 357 } | 360 } |
| 358 | 361 |
| 359 // TODO(ajwong): Break the direct dependency on |context|. We only | 362 // TODO(ajwong): Break the direct dependency on |context|. We only |
| 360 // need 3 pieces of info from it. | 363 // need 3 pieces of info from it. |
| 361 StoragePartitionImpl* StoragePartitionImpl::Create( | 364 StoragePartitionImpl* StoragePartitionImpl::Create( |
| 362 BrowserContext* context, | 365 BrowserContext* context, |
| 363 bool in_memory, | 366 bool in_memory, |
| 364 const base::FilePath& partition_path) { | 367 const base::FilePath& partition_path) { |
| 365 // Ensure that these methods are called on the UI thread, except for | 368 // Ensure that these methods are called on the UI thread, except for |
| 366 // unittests where a UI thread might not have been created. | 369 // unittests where a UI thread might not have been created. |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 BrowserMainLoop::GetInstance() | 408 BrowserMainLoop::GetInstance() |
| 406 ? BrowserMainLoop::GetInstance()->indexed_db_thread() | 409 ? BrowserMainLoop::GetInstance()->indexed_db_thread() |
| 407 ->message_loop_proxy().get() | 410 ->message_loop_proxy().get() |
| 408 : NULL; | 411 : NULL; |
| 409 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 412 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
| 410 new IndexedDBContextImpl(path, | 413 new IndexedDBContextImpl(path, |
| 411 context->GetSpecialStoragePolicy(), | 414 context->GetSpecialStoragePolicy(), |
| 412 quota_manager->proxy(), | 415 quota_manager->proxy(), |
| 413 idb_task_runner); | 416 idb_task_runner); |
| 414 | 417 |
| 415 scoped_refptr<ServiceWorkerContext> service_worker_context = | 418 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = |
| 416 new ServiceWorkerContext(path, quota_manager->proxy()); | 419 new ServiceWorkerContextWrapper(); |
| 420 service_worker_context->Init(path, quota_manager->proxy()); |
| 417 | 421 |
| 418 scoped_refptr<ChromeAppCacheService> appcache_service = | 422 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 419 new ChromeAppCacheService(quota_manager->proxy()); | 423 new ChromeAppCacheService(quota_manager->proxy()); |
| 420 | 424 |
| 421 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 425 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
| 422 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 426 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
| 423 | 427 |
| 424 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy( | 428 scoped_refptr<quota::SpecialStoragePolicy> special_storage_policy( |
| 425 context->GetSpecialStoragePolicy()); | 429 context->GetSpecialStoragePolicy()); |
| 426 | 430 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 } | 470 } |
| 467 | 471 |
| 468 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { | 472 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { |
| 469 return dom_storage_context_.get(); | 473 return dom_storage_context_.get(); |
| 470 } | 474 } |
| 471 | 475 |
| 472 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 476 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
| 473 return indexed_db_context_.get(); | 477 return indexed_db_context_.get(); |
| 474 } | 478 } |
| 475 | 479 |
| 476 ServiceWorkerContext* StoragePartitionImpl::GetServiceWorkerContext() { | 480 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
| 477 return service_worker_context_.get(); | 481 return service_worker_context_.get(); |
| 478 } | 482 } |
| 479 | 483 |
| 480 void StoragePartitionImpl::ClearDataImpl( | 484 void StoragePartitionImpl::ClearDataImpl( |
| 481 uint32 remove_mask, | 485 uint32 remove_mask, |
| 482 uint32 quota_storage_remove_mask, | 486 uint32 quota_storage_remove_mask, |
| 483 const GURL* remove_origin, | 487 const GURL* remove_origin, |
| 484 const OriginMatcherFunction& origin_matcher, | 488 const OriginMatcherFunction& origin_matcher, |
| 485 net::URLRequestContextGetter* rq_context, | 489 net::URLRequestContextGetter* rq_context, |
| 486 const base::Time begin, | 490 const base::Time begin, |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 768 net::URLRequestContextGetter* url_request_context) { | 772 net::URLRequestContextGetter* url_request_context) { |
| 769 url_request_context_ = url_request_context; | 773 url_request_context_ = url_request_context; |
| 770 } | 774 } |
| 771 | 775 |
| 772 void StoragePartitionImpl::SetMediaURLRequestContext( | 776 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 773 net::URLRequestContextGetter* media_url_request_context) { | 777 net::URLRequestContextGetter* media_url_request_context) { |
| 774 media_url_request_context_ = media_url_request_context; | 778 media_url_request_context_ = media_url_request_context; |
| 775 } | 779 } |
| 776 | 780 |
| 777 } // namespace content | 781 } // namespace content |
| OLD | NEW |