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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/location.h" | 13 #include "base/location.h" |
14 #include "base/sequenced_task_runner.h" | 14 #include "base/sequenced_task_runner.h" |
15 #include "base/single_thread_task_runner.h" | 15 #include "base/single_thread_task_runner.h" |
16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
17 #include "content/browser/browser_main_loop.h" | 17 #include "content/browser/browser_main_loop.h" |
18 #include "content/browser/fileapi/browser_file_system_helper.h" | 18 #include "content/browser/fileapi/browser_file_system_helper.h" |
19 #include "content/browser/geofencing/geofencing_manager.h" | |
20 #include "content/browser/gpu/shader_disk_cache.h" | 19 #include "content/browser/gpu/shader_disk_cache.h" |
21 #include "content/browser/host_zoom_map_impl.h" | 20 #include "content/browser/host_zoom_map_impl.h" |
22 #include "content/browser/notifications/platform_notification_context_impl.h" | 21 #include "content/browser/notifications/platform_notification_context_impl.h" |
23 #include "content/common/dom_storage/dom_storage_types.h" | 22 #include "content/common/dom_storage/dom_storage_types.h" |
24 #include "content/public/browser/browser_context.h" | 23 #include "content/public/browser/browser_context.h" |
25 #include "content/public/browser/browser_thread.h" | 24 #include "content/public/browser/browser_thread.h" |
26 #include "content/public/browser/dom_storage_context.h" | 25 #include "content/public/browser/dom_storage_context.h" |
27 #include "content/public/browser/indexed_db_context.h" | 26 #include "content/public/browser/indexed_db_context.h" |
28 #include "content/public/browser/local_storage_usage_info.h" | 27 #include "content/public/browser/local_storage_usage_info.h" |
29 #include "content/public/browser/session_storage_usage_info.h" | 28 #include "content/public/browser/session_storage_usage_info.h" |
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 storage::QuotaManager* quota_manager, | 361 storage::QuotaManager* quota_manager, |
363 ChromeAppCacheService* appcache_service, | 362 ChromeAppCacheService* appcache_service, |
364 storage::FileSystemContext* filesystem_context, | 363 storage::FileSystemContext* filesystem_context, |
365 storage::DatabaseTracker* database_tracker, | 364 storage::DatabaseTracker* database_tracker, |
366 DOMStorageContextWrapper* dom_storage_context, | 365 DOMStorageContextWrapper* dom_storage_context, |
367 IndexedDBContextImpl* indexed_db_context, | 366 IndexedDBContextImpl* indexed_db_context, |
368 CacheStorageContextImpl* cache_storage_context, | 367 CacheStorageContextImpl* cache_storage_context, |
369 ServiceWorkerContextWrapper* service_worker_context, | 368 ServiceWorkerContextWrapper* service_worker_context, |
370 WebRTCIdentityStore* webrtc_identity_store, | 369 WebRTCIdentityStore* webrtc_identity_store, |
371 storage::SpecialStoragePolicy* special_storage_policy, | 370 storage::SpecialStoragePolicy* special_storage_policy, |
372 GeofencingManager* geofencing_manager, | |
373 HostZoomLevelContext* host_zoom_level_context, | 371 HostZoomLevelContext* host_zoom_level_context, |
374 PlatformNotificationContextImpl* platform_notification_context, | 372 PlatformNotificationContextImpl* platform_notification_context, |
375 BackgroundSyncContext* background_sync_context) | 373 BackgroundSyncContext* background_sync_context) |
376 : partition_path_(partition_path), | 374 : partition_path_(partition_path), |
377 quota_manager_(quota_manager), | 375 quota_manager_(quota_manager), |
378 appcache_service_(appcache_service), | 376 appcache_service_(appcache_service), |
379 filesystem_context_(filesystem_context), | 377 filesystem_context_(filesystem_context), |
380 database_tracker_(database_tracker), | 378 database_tracker_(database_tracker), |
381 dom_storage_context_(dom_storage_context), | 379 dom_storage_context_(dom_storage_context), |
382 indexed_db_context_(indexed_db_context), | 380 indexed_db_context_(indexed_db_context), |
383 cache_storage_context_(cache_storage_context), | 381 cache_storage_context_(cache_storage_context), |
384 service_worker_context_(service_worker_context), | 382 service_worker_context_(service_worker_context), |
385 webrtc_identity_store_(webrtc_identity_store), | 383 webrtc_identity_store_(webrtc_identity_store), |
386 special_storage_policy_(special_storage_policy), | 384 special_storage_policy_(special_storage_policy), |
387 geofencing_manager_(geofencing_manager), | |
388 host_zoom_level_context_(host_zoom_level_context), | 385 host_zoom_level_context_(host_zoom_level_context), |
389 platform_notification_context_(platform_notification_context), | 386 platform_notification_context_(platform_notification_context), |
390 background_sync_context_(background_sync_context), | 387 background_sync_context_(background_sync_context), |
391 browser_context_(browser_context) { | 388 browser_context_(browser_context) { |
392 } | 389 } |
393 | 390 |
394 StoragePartitionImpl::~StoragePartitionImpl() { | 391 StoragePartitionImpl::~StoragePartitionImpl() { |
395 browser_context_ = nullptr; | 392 browser_context_ = nullptr; |
396 | 393 |
397 // These message loop checks are just to avoid leaks in unittests. | 394 // These message loop checks are just to avoid leaks in unittests. |
(...skipping 10 matching lines...) Expand all Loading... |
408 | 405 |
409 if (GetDOMStorageContext()) | 406 if (GetDOMStorageContext()) |
410 GetDOMStorageContext()->Shutdown(); | 407 GetDOMStorageContext()->Shutdown(); |
411 | 408 |
412 if (GetServiceWorkerContext()) | 409 if (GetServiceWorkerContext()) |
413 GetServiceWorkerContext()->Shutdown(); | 410 GetServiceWorkerContext()->Shutdown(); |
414 | 411 |
415 if (GetCacheStorageContext()) | 412 if (GetCacheStorageContext()) |
416 GetCacheStorageContext()->Shutdown(); | 413 GetCacheStorageContext()->Shutdown(); |
417 | 414 |
418 if (GetGeofencingManager()) | |
419 GetGeofencingManager()->Shutdown(); | |
420 | |
421 if (GetPlatformNotificationContext()) | 415 if (GetPlatformNotificationContext()) |
422 GetPlatformNotificationContext()->Shutdown(); | 416 GetPlatformNotificationContext()->Shutdown(); |
423 | 417 |
424 if (GetBackgroundSyncContext()) | 418 if (GetBackgroundSyncContext()) |
425 GetBackgroundSyncContext()->Shutdown(); | 419 GetBackgroundSyncContext()->Shutdown(); |
426 } | 420 } |
427 | 421 |
428 StoragePartitionImpl* StoragePartitionImpl::Create( | 422 StoragePartitionImpl* StoragePartitionImpl::Create( |
429 BrowserContext* context, | 423 BrowserContext* context, |
430 bool in_memory, | 424 bool in_memory, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
498 | 492 |
499 scoped_refptr<ChromeAppCacheService> appcache_service = | 493 scoped_refptr<ChromeAppCacheService> appcache_service = |
500 new ChromeAppCacheService(quota_manager->proxy()); | 494 new ChromeAppCacheService(quota_manager->proxy()); |
501 | 495 |
502 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 496 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
503 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 497 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
504 | 498 |
505 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( | 499 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( |
506 context->GetSpecialStoragePolicy()); | 500 context->GetSpecialStoragePolicy()); |
507 | 501 |
508 scoped_refptr<GeofencingManager> geofencing_manager = | |
509 new GeofencingManager(service_worker_context); | |
510 geofencing_manager->Init(); | |
511 | |
512 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( | 502 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( |
513 new HostZoomLevelContext( | 503 new HostZoomLevelContext( |
514 context->CreateZoomLevelDelegate(partition_path))); | 504 context->CreateZoomLevelDelegate(partition_path))); |
515 | 505 |
516 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = | 506 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = |
517 new PlatformNotificationContextImpl(path, context, | 507 new PlatformNotificationContextImpl(path, context, |
518 service_worker_context); | 508 service_worker_context); |
519 platform_notification_context->Initialize(); | 509 platform_notification_context->Initialize(); |
520 | 510 |
521 scoped_refptr<BackgroundSyncContext> background_sync_context = | 511 scoped_refptr<BackgroundSyncContext> background_sync_context = |
522 new BackgroundSyncContext(); | 512 new BackgroundSyncContext(); |
523 background_sync_context->Init(service_worker_context); | 513 background_sync_context->Init(service_worker_context); |
524 | 514 |
525 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( | 515 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( |
526 context, partition_path, quota_manager.get(), appcache_service.get(), | 516 context, partition_path, quota_manager.get(), appcache_service.get(), |
527 filesystem_context.get(), database_tracker.get(), | 517 filesystem_context.get(), database_tracker.get(), |
528 dom_storage_context.get(), indexed_db_context.get(), | 518 dom_storage_context.get(), indexed_db_context.get(), |
529 cache_storage_context.get(), service_worker_context.get(), | 519 cache_storage_context.get(), service_worker_context.get(), |
530 webrtc_identity_store.get(), special_storage_policy.get(), | 520 webrtc_identity_store.get(), special_storage_policy.get(), |
531 geofencing_manager.get(), host_zoom_level_context.get(), | 521 host_zoom_level_context.get(), platform_notification_context.get(), |
532 platform_notification_context.get(), background_sync_context.get()); | 522 background_sync_context.get()); |
533 | 523 |
534 service_worker_context->set_storage_partition(storage_partition); | 524 service_worker_context->set_storage_partition(storage_partition); |
535 | 525 |
536 return storage_partition; | 526 return storage_partition; |
537 } | 527 } |
538 | 528 |
539 base::FilePath StoragePartitionImpl::GetPath() { | 529 base::FilePath StoragePartitionImpl::GetPath() { |
540 return partition_path_; | 530 return partition_path_; |
541 } | 531 } |
542 | 532 |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 } | 564 } |
575 | 565 |
576 CacheStorageContextImpl* StoragePartitionImpl::GetCacheStorageContext() { | 566 CacheStorageContextImpl* StoragePartitionImpl::GetCacheStorageContext() { |
577 return cache_storage_context_.get(); | 567 return cache_storage_context_.get(); |
578 } | 568 } |
579 | 569 |
580 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 570 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
581 return service_worker_context_.get(); | 571 return service_worker_context_.get(); |
582 } | 572 } |
583 | 573 |
584 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { | |
585 return geofencing_manager_.get(); | |
586 } | |
587 | |
588 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { | 574 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
589 DCHECK(host_zoom_level_context_.get()); | 575 DCHECK(host_zoom_level_context_.get()); |
590 return host_zoom_level_context_->GetHostZoomMap(); | 576 return host_zoom_level_context_->GetHostZoomMap(); |
591 } | 577 } |
592 | 578 |
593 HostZoomLevelContext* StoragePartitionImpl::GetHostZoomLevelContext() { | 579 HostZoomLevelContext* StoragePartitionImpl::GetHostZoomLevelContext() { |
594 return host_zoom_level_context_.get(); | 580 return host_zoom_level_context_.get(); |
595 } | 581 } |
596 | 582 |
597 ZoomLevelDelegate* StoragePartitionImpl::GetZoomLevelDelegate() { | 583 ZoomLevelDelegate* StoragePartitionImpl::GetZoomLevelDelegate() { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
929 net::URLRequestContextGetter* url_request_context) { | 915 net::URLRequestContextGetter* url_request_context) { |
930 url_request_context_ = url_request_context; | 916 url_request_context_ = url_request_context; |
931 } | 917 } |
932 | 918 |
933 void StoragePartitionImpl::SetMediaURLRequestContext( | 919 void StoragePartitionImpl::SetMediaURLRequestContext( |
934 net::URLRequestContextGetter* media_url_request_context) { | 920 net::URLRequestContextGetter* media_url_request_context) { |
935 media_url_request_context_ = media_url_request_context; | 921 media_url_request_context_ = media_url_request_context; |
936 } | 922 } |
937 | 923 |
938 } // namespace content | 924 } // namespace content |
OLD | NEW |