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 <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
415 if (GetCacheStorageContext()) | 415 if (GetCacheStorageContext()) |
416 GetCacheStorageContext()->Shutdown(); | 416 GetCacheStorageContext()->Shutdown(); |
417 | 417 |
418 if (GetPlatformNotificationContext()) | 418 if (GetPlatformNotificationContext()) |
419 GetPlatformNotificationContext()->Shutdown(); | 419 GetPlatformNotificationContext()->Shutdown(); |
420 | 420 |
421 if (GetBackgroundSyncContext()) | 421 if (GetBackgroundSyncContext()) |
422 GetBackgroundSyncContext()->Shutdown(); | 422 GetBackgroundSyncContext()->Shutdown(); |
423 } | 423 } |
424 | 424 |
425 StoragePartitionImpl* StoragePartitionImpl::Create( | 425 std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create( |
426 BrowserContext* context, | 426 BrowserContext* context, |
427 bool in_memory, | 427 bool in_memory, |
428 const base::FilePath& relative_partition_path) { | 428 const base::FilePath& relative_partition_path) { |
429 // Ensure that these methods are called on the UI thread, except for | 429 // Ensure that these methods are called on the UI thread, except for |
430 // unittests where a UI thread might not have been created. | 430 // unittests where a UI thread might not have been created. |
431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
432 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 432 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
433 | 433 |
434 base::FilePath partition_path = | 434 base::FilePath partition_path = |
435 context->GetPath().Append(relative_partition_path); | 435 context->GetPath().Append(relative_partition_path); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 service_worker_context); | 505 service_worker_context); |
506 platform_notification_context->Initialize(); | 506 platform_notification_context->Initialize(); |
507 | 507 |
508 scoped_refptr<BackgroundSyncContext> background_sync_context = | 508 scoped_refptr<BackgroundSyncContext> background_sync_context = |
509 new BackgroundSyncContext(); | 509 new BackgroundSyncContext(); |
510 background_sync_context->Init(service_worker_context); | 510 background_sync_context->Init(service_worker_context); |
511 | 511 |
512 scoped_refptr<BroadcastChannelProvider> | 512 scoped_refptr<BroadcastChannelProvider> |
513 broadcast_channel_provider = new BroadcastChannelProvider(); | 513 broadcast_channel_provider = new BroadcastChannelProvider(); |
514 | 514 |
515 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( | 515 std::unique_ptr<StoragePartitionImpl> storage_partition( |
516 context, partition_path, quota_manager.get(), appcache_service.get(), | 516 new StoragePartitionImpl( |
517 filesystem_context.get(), database_tracker.get(), | 517 context, partition_path, quota_manager.get(), appcache_service.get(), |
518 dom_storage_context.get(), indexed_db_context.get(), | 518 filesystem_context.get(), database_tracker.get(), |
519 cache_storage_context.get(), service_worker_context.get(), | 519 dom_storage_context.get(), indexed_db_context.get(), |
520 special_storage_policy.get(), host_zoom_level_context.get(), | 520 cache_storage_context.get(), service_worker_context.get(), |
521 platform_notification_context.get(), background_sync_context.get(), | 521 special_storage_policy.get(), host_zoom_level_context.get(), |
522 std::move(broadcast_channel_provider)); | 522 platform_notification_context.get(), background_sync_context.get(), |
| 523 std::move(broadcast_channel_provider))); |
523 | 524 |
524 service_worker_context->set_storage_partition(storage_partition); | 525 service_worker_context->set_storage_partition(storage_partition.get()); |
525 | 526 |
526 return storage_partition; | 527 return storage_partition; |
527 } | 528 } |
528 | 529 |
529 base::FilePath StoragePartitionImpl::GetPath() { | 530 base::FilePath StoragePartitionImpl::GetPath() { |
530 return partition_path_; | 531 return partition_path_; |
531 } | 532 } |
532 | 533 |
533 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 534 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
534 return url_request_context_.get(); | 535 return url_request_context_.get(); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 net::URLRequestContextGetter* url_request_context) { | 914 net::URLRequestContextGetter* url_request_context) { |
914 url_request_context_ = url_request_context; | 915 url_request_context_ = url_request_context; |
915 } | 916 } |
916 | 917 |
917 void StoragePartitionImpl::SetMediaURLRequestContext( | 918 void StoragePartitionImpl::SetMediaURLRequestContext( |
918 net::URLRequestContextGetter* media_url_request_context) { | 919 net::URLRequestContextGetter* media_url_request_context) { |
919 media_url_request_context_ = media_url_request_context; | 920 media_url_request_context_ = media_url_request_context; |
920 } | 921 } |
921 | 922 |
922 } // namespace content | 923 } // namespace content |
OLD | NEW |