| 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 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 367 storage::FileSystemContext* filesystem_context, | 367 storage::FileSystemContext* filesystem_context, |
| 368 storage::DatabaseTracker* database_tracker, | 368 storage::DatabaseTracker* database_tracker, |
| 369 DOMStorageContextWrapper* dom_storage_context, | 369 DOMStorageContextWrapper* dom_storage_context, |
| 370 IndexedDBContextImpl* indexed_db_context, | 370 IndexedDBContextImpl* indexed_db_context, |
| 371 CacheStorageContextImpl* cache_storage_context, | 371 CacheStorageContextImpl* cache_storage_context, |
| 372 ServiceWorkerContextWrapper* service_worker_context, | 372 ServiceWorkerContextWrapper* service_worker_context, |
| 373 storage::SpecialStoragePolicy* special_storage_policy, | 373 storage::SpecialStoragePolicy* special_storage_policy, |
| 374 HostZoomLevelContext* host_zoom_level_context, | 374 HostZoomLevelContext* host_zoom_level_context, |
| 375 PlatformNotificationContextImpl* platform_notification_context, | 375 PlatformNotificationContextImpl* platform_notification_context, |
| 376 BackgroundSyncContext* background_sync_context, | 376 BackgroundSyncContext* background_sync_context, |
| 377 PaymentAppContext* payment_app_context, |
| 377 scoped_refptr<BroadcastChannelProvider> broadcast_channel_provider) | 378 scoped_refptr<BroadcastChannelProvider> broadcast_channel_provider) |
| 378 : partition_path_(partition_path), | 379 : partition_path_(partition_path), |
| 379 quota_manager_(quota_manager), | 380 quota_manager_(quota_manager), |
| 380 appcache_service_(appcache_service), | 381 appcache_service_(appcache_service), |
| 381 filesystem_context_(filesystem_context), | 382 filesystem_context_(filesystem_context), |
| 382 database_tracker_(database_tracker), | 383 database_tracker_(database_tracker), |
| 383 dom_storage_context_(dom_storage_context), | 384 dom_storage_context_(dom_storage_context), |
| 384 indexed_db_context_(indexed_db_context), | 385 indexed_db_context_(indexed_db_context), |
| 385 cache_storage_context_(cache_storage_context), | 386 cache_storage_context_(cache_storage_context), |
| 386 service_worker_context_(service_worker_context), | 387 service_worker_context_(service_worker_context), |
| 387 special_storage_policy_(special_storage_policy), | 388 special_storage_policy_(special_storage_policy), |
| 388 host_zoom_level_context_(host_zoom_level_context), | 389 host_zoom_level_context_(host_zoom_level_context), |
| 389 platform_notification_context_(platform_notification_context), | 390 platform_notification_context_(platform_notification_context), |
| 390 background_sync_context_(background_sync_context), | 391 background_sync_context_(background_sync_context), |
| 392 payment_app_context_(payment_app_context), |
| 391 broadcast_channel_provider_(std::move(broadcast_channel_provider)), | 393 broadcast_channel_provider_(std::move(broadcast_channel_provider)), |
| 392 browser_context_(browser_context) {} | 394 browser_context_(browser_context) {} |
| 393 | 395 |
| 394 StoragePartitionImpl::~StoragePartitionImpl() { | 396 StoragePartitionImpl::~StoragePartitionImpl() { |
| 395 browser_context_ = nullptr; | 397 browser_context_ = nullptr; |
| 396 | 398 |
| 397 // These message loop checks are just to avoid leaks in unittests. | 399 // These message loop checks are just to avoid leaks in unittests. |
| 398 if (GetDatabaseTracker() && | 400 if (GetDatabaseTracker() && |
| 399 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 401 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 400 BrowserThread::PostTask( | 402 BrowserThread::PostTask( |
| (...skipping 12 matching lines...) Expand all Loading... |
| 413 GetServiceWorkerContext()->Shutdown(); | 415 GetServiceWorkerContext()->Shutdown(); |
| 414 | 416 |
| 415 if (GetCacheStorageContext()) | 417 if (GetCacheStorageContext()) |
| 416 GetCacheStorageContext()->Shutdown(); | 418 GetCacheStorageContext()->Shutdown(); |
| 417 | 419 |
| 418 if (GetPlatformNotificationContext()) | 420 if (GetPlatformNotificationContext()) |
| 419 GetPlatformNotificationContext()->Shutdown(); | 421 GetPlatformNotificationContext()->Shutdown(); |
| 420 | 422 |
| 421 if (GetBackgroundSyncContext()) | 423 if (GetBackgroundSyncContext()) |
| 422 GetBackgroundSyncContext()->Shutdown(); | 424 GetBackgroundSyncContext()->Shutdown(); |
| 425 |
| 426 if (GetPaymentAppContext()) |
| 427 GetPaymentAppContext()->Shutdown(); |
| 423 } | 428 } |
| 424 | 429 |
| 425 std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create( | 430 std::unique_ptr<StoragePartitionImpl> StoragePartitionImpl::Create( |
| 426 BrowserContext* context, | 431 BrowserContext* context, |
| 427 bool in_memory, | 432 bool in_memory, |
| 428 const base::FilePath& relative_partition_path) { | 433 const base::FilePath& relative_partition_path) { |
| 429 // Ensure that these methods are called on the UI thread, except for | 434 // Ensure that these methods are called on the UI thread, except for |
| 430 // unittests where a UI thread might not have been created. | 435 // unittests where a UI thread might not have been created. |
| 431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 436 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| 432 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 437 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 502 | 507 |
| 503 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = | 508 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = |
| 504 new PlatformNotificationContextImpl(path, context, | 509 new PlatformNotificationContextImpl(path, context, |
| 505 service_worker_context); | 510 service_worker_context); |
| 506 platform_notification_context->Initialize(); | 511 platform_notification_context->Initialize(); |
| 507 | 512 |
| 508 scoped_refptr<BackgroundSyncContext> background_sync_context = | 513 scoped_refptr<BackgroundSyncContext> background_sync_context = |
| 509 new BackgroundSyncContext(); | 514 new BackgroundSyncContext(); |
| 510 background_sync_context->Init(service_worker_context); | 515 background_sync_context->Init(service_worker_context); |
| 511 | 516 |
| 517 scoped_refptr<PaymentAppContext> payment_app_context = |
| 518 new PaymentAppContext(); |
| 519 payment_app_context->Init(service_worker_context); |
| 520 |
| 512 scoped_refptr<BroadcastChannelProvider> | 521 scoped_refptr<BroadcastChannelProvider> |
| 513 broadcast_channel_provider = new BroadcastChannelProvider(); | 522 broadcast_channel_provider = new BroadcastChannelProvider(); |
| 514 | 523 |
| 515 std::unique_ptr<StoragePartitionImpl> storage_partition( | 524 std::unique_ptr<StoragePartitionImpl> storage_partition( |
| 516 new StoragePartitionImpl( | 525 new StoragePartitionImpl( |
| 517 context, partition_path, quota_manager.get(), appcache_service.get(), | 526 context, partition_path, quota_manager.get(), appcache_service.get(), |
| 518 filesystem_context.get(), database_tracker.get(), | 527 filesystem_context.get(), database_tracker.get(), |
| 519 dom_storage_context.get(), indexed_db_context.get(), | 528 dom_storage_context.get(), indexed_db_context.get(), |
| 520 cache_storage_context.get(), service_worker_context.get(), | 529 cache_storage_context.get(), service_worker_context.get(), |
| 521 special_storage_policy.get(), host_zoom_level_context.get(), | 530 special_storage_policy.get(), host_zoom_level_context.get(), |
| 522 platform_notification_context.get(), background_sync_context.get(), | 531 platform_notification_context.get(), background_sync_context.get(), |
| 532 payment_app_context.get(), |
| 523 std::move(broadcast_channel_provider))); | 533 std::move(broadcast_channel_provider))); |
| 524 | 534 |
| 525 service_worker_context->set_storage_partition(storage_partition.get()); | 535 service_worker_context->set_storage_partition(storage_partition.get()); |
| 526 | 536 |
| 527 return storage_partition; | 537 return storage_partition; |
| 528 } | 538 } |
| 529 | 539 |
| 530 base::FilePath StoragePartitionImpl::GetPath() { | 540 base::FilePath StoragePartitionImpl::GetPath() { |
| 531 return partition_path_; | 541 return partition_path_; |
| 532 } | 542 } |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 588 | 598 |
| 589 PlatformNotificationContextImpl* | 599 PlatformNotificationContextImpl* |
| 590 StoragePartitionImpl::GetPlatformNotificationContext() { | 600 StoragePartitionImpl::GetPlatformNotificationContext() { |
| 591 return platform_notification_context_.get(); | 601 return platform_notification_context_.get(); |
| 592 } | 602 } |
| 593 | 603 |
| 594 BackgroundSyncContext* StoragePartitionImpl::GetBackgroundSyncContext() { | 604 BackgroundSyncContext* StoragePartitionImpl::GetBackgroundSyncContext() { |
| 595 return background_sync_context_.get(); | 605 return background_sync_context_.get(); |
| 596 } | 606 } |
| 597 | 607 |
| 608 PaymentAppContext* StoragePartitionImpl::GetPaymentAppContext() { |
| 609 return payment_app_context_.get(); |
| 610 } |
| 611 |
| 598 BroadcastChannelProvider* StoragePartitionImpl::GetBroadcastChannelProvider() { | 612 BroadcastChannelProvider* StoragePartitionImpl::GetBroadcastChannelProvider() { |
| 599 return broadcast_channel_provider_.get(); | 613 return broadcast_channel_provider_.get(); |
| 600 } | 614 } |
| 601 | 615 |
| 602 void StoragePartitionImpl::OpenLocalStorage( | 616 void StoragePartitionImpl::OpenLocalStorage( |
| 603 const url::Origin& origin, | 617 const url::Origin& origin, |
| 604 mojom::LevelDBObserverPtr observer, | 618 mojom::LevelDBObserverPtr observer, |
| 605 mojo::InterfaceRequest<mojom::LevelDBWrapper> request) { | 619 mojo::InterfaceRequest<mojom::LevelDBWrapper> request) { |
| 606 dom_storage_context_->OpenLocalStorage( | 620 dom_storage_context_->OpenLocalStorage( |
| 607 origin, std::move(observer), std::move(request)); | 621 origin, std::move(observer), std::move(request)); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 914 net::URLRequestContextGetter* url_request_context) { | 928 net::URLRequestContextGetter* url_request_context) { |
| 915 url_request_context_ = url_request_context; | 929 url_request_context_ = url_request_context; |
| 916 } | 930 } |
| 917 | 931 |
| 918 void StoragePartitionImpl::SetMediaURLRequestContext( | 932 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 919 net::URLRequestContextGetter* media_url_request_context) { | 933 net::URLRequestContextGetter* media_url_request_context) { |
| 920 media_url_request_context_ = media_url_request_context; | 934 media_url_request_context_ = media_url_request_context; |
| 921 } | 935 } |
| 922 | 936 |
| 923 } // namespace content | 937 } // namespace content |
| OLD | NEW |