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 <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
374 DOMStorageContextWrapper* dom_storage_context, | 374 DOMStorageContextWrapper* dom_storage_context, |
375 IndexedDBContextImpl* indexed_db_context, | 375 IndexedDBContextImpl* indexed_db_context, |
376 CacheStorageContextImpl* cache_storage_context, | 376 CacheStorageContextImpl* cache_storage_context, |
377 ServiceWorkerContextWrapper* service_worker_context, | 377 ServiceWorkerContextWrapper* service_worker_context, |
378 WebRTCIdentityStore* webrtc_identity_store, | 378 WebRTCIdentityStore* webrtc_identity_store, |
379 storage::SpecialStoragePolicy* special_storage_policy, | 379 storage::SpecialStoragePolicy* special_storage_policy, |
380 GeofencingManager* geofencing_manager, | 380 GeofencingManager* geofencing_manager, |
381 HostZoomLevelContext* host_zoom_level_context, | 381 HostZoomLevelContext* host_zoom_level_context, |
382 NavigatorConnectContextImpl* navigator_connect_context, | 382 NavigatorConnectContextImpl* navigator_connect_context, |
383 PlatformNotificationContextImpl* platform_notification_context, | 383 PlatformNotificationContextImpl* platform_notification_context, |
384 BackgroundSyncContextImpl* background_sync_context) | 384 BackgroundSyncContextImpl* background_sync_context, |
| 385 StashedPortManager* stashed_port_manager) |
385 : partition_path_(partition_path), | 386 : partition_path_(partition_path), |
386 quota_manager_(quota_manager), | 387 quota_manager_(quota_manager), |
387 appcache_service_(appcache_service), | 388 appcache_service_(appcache_service), |
388 filesystem_context_(filesystem_context), | 389 filesystem_context_(filesystem_context), |
389 database_tracker_(database_tracker), | 390 database_tracker_(database_tracker), |
390 dom_storage_context_(dom_storage_context), | 391 dom_storage_context_(dom_storage_context), |
391 indexed_db_context_(indexed_db_context), | 392 indexed_db_context_(indexed_db_context), |
392 cache_storage_context_(cache_storage_context), | 393 cache_storage_context_(cache_storage_context), |
393 service_worker_context_(service_worker_context), | 394 service_worker_context_(service_worker_context), |
394 webrtc_identity_store_(webrtc_identity_store), | 395 webrtc_identity_store_(webrtc_identity_store), |
395 special_storage_policy_(special_storage_policy), | 396 special_storage_policy_(special_storage_policy), |
396 geofencing_manager_(geofencing_manager), | 397 geofencing_manager_(geofencing_manager), |
397 host_zoom_level_context_(host_zoom_level_context), | 398 host_zoom_level_context_(host_zoom_level_context), |
398 navigator_connect_context_(navigator_connect_context), | 399 navigator_connect_context_(navigator_connect_context), |
399 platform_notification_context_(platform_notification_context), | 400 platform_notification_context_(platform_notification_context), |
400 background_sync_context_(background_sync_context), | 401 background_sync_context_(background_sync_context), |
| 402 stashed_port_manager_(stashed_port_manager), |
401 browser_context_(browser_context) { | 403 browser_context_(browser_context) { |
402 } | 404 } |
403 | 405 |
404 StoragePartitionImpl::~StoragePartitionImpl() { | 406 StoragePartitionImpl::~StoragePartitionImpl() { |
405 browser_context_ = nullptr; | 407 browser_context_ = nullptr; |
406 | 408 |
407 // These message loop checks are just to avoid leaks in unittests. | 409 // These message loop checks are just to avoid leaks in unittests. |
408 if (GetDatabaseTracker() && | 410 if (GetDatabaseTracker() && |
409 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 411 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
410 BrowserThread::PostTask( | 412 BrowserThread::PostTask( |
(...skipping 15 matching lines...) Expand all Loading... |
426 GetCacheStorageContext()->Shutdown(); | 428 GetCacheStorageContext()->Shutdown(); |
427 | 429 |
428 if (GetGeofencingManager()) | 430 if (GetGeofencingManager()) |
429 GetGeofencingManager()->Shutdown(); | 431 GetGeofencingManager()->Shutdown(); |
430 | 432 |
431 if (GetPlatformNotificationContext()) | 433 if (GetPlatformNotificationContext()) |
432 GetPlatformNotificationContext()->Shutdown(); | 434 GetPlatformNotificationContext()->Shutdown(); |
433 | 435 |
434 if (GetBackgroundSyncContext()) | 436 if (GetBackgroundSyncContext()) |
435 GetBackgroundSyncContext()->Shutdown(); | 437 GetBackgroundSyncContext()->Shutdown(); |
| 438 |
| 439 if (GetStashedPortManager()) |
| 440 GetStashedPortManager()->Shutdown(); |
436 } | 441 } |
437 | 442 |
438 StoragePartitionImpl* StoragePartitionImpl::Create( | 443 StoragePartitionImpl* StoragePartitionImpl::Create( |
439 BrowserContext* context, | 444 BrowserContext* context, |
440 bool in_memory, | 445 bool in_memory, |
441 const base::FilePath& partition_path) { | 446 const base::FilePath& partition_path) { |
442 // Ensure that these methods are called on the UI thread, except for | 447 // Ensure that these methods are called on the UI thread, except for |
443 // unittests where a UI thread might not have been created. | 448 // unittests where a UI thread might not have been created. |
444 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 449 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
445 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 450 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
521 new NavigatorConnectServiceWorkerServiceFactory(service_worker_context))); | 526 new NavigatorConnectServiceWorkerServiceFactory(service_worker_context))); |
522 | 527 |
523 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = | 528 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = |
524 new PlatformNotificationContextImpl(path, service_worker_context); | 529 new PlatformNotificationContextImpl(path, service_worker_context); |
525 platform_notification_context->Initialize(); | 530 platform_notification_context->Initialize(); |
526 | 531 |
527 scoped_refptr<BackgroundSyncContextImpl> background_sync_context = | 532 scoped_refptr<BackgroundSyncContextImpl> background_sync_context = |
528 new BackgroundSyncContextImpl(); | 533 new BackgroundSyncContextImpl(); |
529 background_sync_context->Init(service_worker_context); | 534 background_sync_context->Init(service_worker_context); |
530 | 535 |
| 536 scoped_refptr<StashedPortManager> stashed_port_manager = |
| 537 new StashedPortManager(service_worker_context); |
| 538 stashed_port_manager->Init(); |
| 539 |
531 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( | 540 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( |
532 context, partition_path, quota_manager.get(), appcache_service.get(), | 541 context, partition_path, quota_manager.get(), appcache_service.get(), |
533 filesystem_context.get(), database_tracker.get(), | 542 filesystem_context.get(), database_tracker.get(), |
534 dom_storage_context.get(), indexed_db_context.get(), | 543 dom_storage_context.get(), indexed_db_context.get(), |
535 cache_storage_context.get(), service_worker_context.get(), | 544 cache_storage_context.get(), service_worker_context.get(), |
536 webrtc_identity_store.get(), special_storage_policy.get(), | 545 webrtc_identity_store.get(), special_storage_policy.get(), |
537 geofencing_manager.get(), host_zoom_level_context.get(), | 546 geofencing_manager.get(), host_zoom_level_context.get(), |
538 navigator_connect_context.get(), platform_notification_context.get(), | 547 navigator_connect_context.get(), platform_notification_context.get(), |
539 background_sync_context.get()); | 548 background_sync_context.get(), stashed_port_manager.get()); |
540 | 549 |
541 service_worker_context->set_storage_partition(storage_partition); | 550 service_worker_context->set_storage_partition(storage_partition); |
542 | 551 |
543 return storage_partition; | 552 return storage_partition; |
544 } | 553 } |
545 | 554 |
546 base::FilePath StoragePartitionImpl::GetPath() { | 555 base::FilePath StoragePartitionImpl::GetPath() { |
547 return partition_path_; | 556 return partition_path_; |
548 } | 557 } |
549 | 558 |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 622 |
614 PlatformNotificationContextImpl* | 623 PlatformNotificationContextImpl* |
615 StoragePartitionImpl::GetPlatformNotificationContext() { | 624 StoragePartitionImpl::GetPlatformNotificationContext() { |
616 return platform_notification_context_.get(); | 625 return platform_notification_context_.get(); |
617 } | 626 } |
618 | 627 |
619 BackgroundSyncContextImpl* StoragePartitionImpl::GetBackgroundSyncContext() { | 628 BackgroundSyncContextImpl* StoragePartitionImpl::GetBackgroundSyncContext() { |
620 return background_sync_context_.get(); | 629 return background_sync_context_.get(); |
621 } | 630 } |
622 | 631 |
| 632 StashedPortManager* StoragePartitionImpl::GetStashedPortManager() { |
| 633 return stashed_port_manager_.get(); |
| 634 } |
| 635 |
623 void StoragePartitionImpl::ClearDataImpl( | 636 void StoragePartitionImpl::ClearDataImpl( |
624 uint32 remove_mask, | 637 uint32 remove_mask, |
625 uint32 quota_storage_remove_mask, | 638 uint32 quota_storage_remove_mask, |
626 const GURL& storage_origin, | 639 const GURL& storage_origin, |
627 const OriginMatcherFunction& origin_matcher, | 640 const OriginMatcherFunction& origin_matcher, |
628 net::URLRequestContextGetter* rq_context, | 641 net::URLRequestContextGetter* rq_context, |
629 const base::Time begin, | 642 const base::Time begin, |
630 const base::Time end, | 643 const base::Time end, |
631 const base::Closure& callback) { | 644 const base::Closure& callback) { |
632 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 645 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
934 net::URLRequestContextGetter* url_request_context) { | 947 net::URLRequestContextGetter* url_request_context) { |
935 url_request_context_ = url_request_context; | 948 url_request_context_ = url_request_context; |
936 } | 949 } |
937 | 950 |
938 void StoragePartitionImpl::SetMediaURLRequestContext( | 951 void StoragePartitionImpl::SetMediaURLRequestContext( |
939 net::URLRequestContextGetter* media_url_request_context) { | 952 net::URLRequestContextGetter* media_url_request_context) { |
940 media_url_request_context_ = media_url_request_context; | 953 media_url_request_context_ = media_url_request_context; |
941 } | 954 } |
942 | 955 |
943 } // namespace content | 956 } // namespace content |
OLD | NEW |