| 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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 363 | 363 |
| 364 StoragePartitionImpl::StoragePartitionImpl( | 364 StoragePartitionImpl::StoragePartitionImpl( |
| 365 BrowserContext* browser_context, | 365 BrowserContext* browser_context, |
| 366 const base::FilePath& partition_path, | 366 const base::FilePath& partition_path, |
| 367 storage::QuotaManager* quota_manager, | 367 storage::QuotaManager* quota_manager, |
| 368 ChromeAppCacheService* appcache_service, | 368 ChromeAppCacheService* appcache_service, |
| 369 storage::FileSystemContext* filesystem_context, | 369 storage::FileSystemContext* filesystem_context, |
| 370 storage::DatabaseTracker* database_tracker, | 370 storage::DatabaseTracker* database_tracker, |
| 371 DOMStorageContextWrapper* dom_storage_context, | 371 DOMStorageContextWrapper* dom_storage_context, |
| 372 IndexedDBContextImpl* indexed_db_context, | 372 IndexedDBContextImpl* indexed_db_context, |
| 373 CacheStorageContextImpl* cache_storage_context, |
| 373 ServiceWorkerContextWrapper* service_worker_context, | 374 ServiceWorkerContextWrapper* service_worker_context, |
| 374 WebRTCIdentityStore* webrtc_identity_store, | 375 WebRTCIdentityStore* webrtc_identity_store, |
| 375 storage::SpecialStoragePolicy* special_storage_policy, | 376 storage::SpecialStoragePolicy* special_storage_policy, |
| 376 GeofencingManager* geofencing_manager, | 377 GeofencingManager* geofencing_manager, |
| 377 HostZoomLevelContext* host_zoom_level_context, | 378 HostZoomLevelContext* host_zoom_level_context, |
| 378 NavigatorConnectContextImpl* navigator_connect_context, | 379 NavigatorConnectContextImpl* navigator_connect_context, |
| 379 PlatformNotificationContextImpl* platform_notification_context) | 380 PlatformNotificationContextImpl* platform_notification_context) |
| 380 : partition_path_(partition_path), | 381 : partition_path_(partition_path), |
| 381 quota_manager_(quota_manager), | 382 quota_manager_(quota_manager), |
| 382 appcache_service_(appcache_service), | 383 appcache_service_(appcache_service), |
| 383 filesystem_context_(filesystem_context), | 384 filesystem_context_(filesystem_context), |
| 384 database_tracker_(database_tracker), | 385 database_tracker_(database_tracker), |
| 385 dom_storage_context_(dom_storage_context), | 386 dom_storage_context_(dom_storage_context), |
| 386 indexed_db_context_(indexed_db_context), | 387 indexed_db_context_(indexed_db_context), |
| 388 cache_storage_context_(cache_storage_context), |
| 387 service_worker_context_(service_worker_context), | 389 service_worker_context_(service_worker_context), |
| 388 webrtc_identity_store_(webrtc_identity_store), | 390 webrtc_identity_store_(webrtc_identity_store), |
| 389 special_storage_policy_(special_storage_policy), | 391 special_storage_policy_(special_storage_policy), |
| 390 geofencing_manager_(geofencing_manager), | 392 geofencing_manager_(geofencing_manager), |
| 391 host_zoom_level_context_(host_zoom_level_context), | 393 host_zoom_level_context_(host_zoom_level_context), |
| 392 navigator_connect_context_(navigator_connect_context), | 394 navigator_connect_context_(navigator_connect_context), |
| 393 platform_notification_context_(platform_notification_context), | 395 platform_notification_context_(platform_notification_context), |
| 394 browser_context_(browser_context) { | 396 browser_context_(browser_context) { |
| 395 } | 397 } |
| 396 | 398 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 408 | 410 |
| 409 if (GetFileSystemContext()) | 411 if (GetFileSystemContext()) |
| 410 GetFileSystemContext()->Shutdown(); | 412 GetFileSystemContext()->Shutdown(); |
| 411 | 413 |
| 412 if (GetDOMStorageContext()) | 414 if (GetDOMStorageContext()) |
| 413 GetDOMStorageContext()->Shutdown(); | 415 GetDOMStorageContext()->Shutdown(); |
| 414 | 416 |
| 415 if (GetServiceWorkerContext()) | 417 if (GetServiceWorkerContext()) |
| 416 GetServiceWorkerContext()->Shutdown(); | 418 GetServiceWorkerContext()->Shutdown(); |
| 417 | 419 |
| 420 if (GetCacheStorageContext()) |
| 421 GetCacheStorageContext()->Shutdown(); |
| 422 |
| 418 if (GetGeofencingManager()) | 423 if (GetGeofencingManager()) |
| 419 GetGeofencingManager()->Shutdown(); | 424 GetGeofencingManager()->Shutdown(); |
| 420 } | 425 } |
| 421 | 426 |
| 422 StoragePartitionImpl* StoragePartitionImpl::Create( | 427 StoragePartitionImpl* StoragePartitionImpl::Create( |
| 423 BrowserContext* context, | 428 BrowserContext* context, |
| 424 bool in_memory, | 429 bool in_memory, |
| 425 const base::FilePath& partition_path) { | 430 const base::FilePath& partition_path) { |
| 426 // Ensure that these methods are called on the UI thread, except for | 431 // Ensure that these methods are called on the UI thread, except for |
| 427 // unittests where a UI thread might not have been created. | 432 // unittests where a UI thread might not have been created. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 465 BrowserMainLoop::GetInstance() | 470 BrowserMainLoop::GetInstance() |
| 466 ? BrowserMainLoop::GetInstance()->indexed_db_thread() | 471 ? BrowserMainLoop::GetInstance()->indexed_db_thread() |
| 467 ->message_loop_proxy().get() | 472 ->message_loop_proxy().get() |
| 468 : NULL; | 473 : NULL; |
| 469 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 474 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
| 470 new IndexedDBContextImpl(path, | 475 new IndexedDBContextImpl(path, |
| 471 context->GetSpecialStoragePolicy(), | 476 context->GetSpecialStoragePolicy(), |
| 472 quota_manager->proxy(), | 477 quota_manager->proxy(), |
| 473 idb_task_runner); | 478 idb_task_runner); |
| 474 | 479 |
| 480 scoped_refptr<CacheStorageContextImpl> cache_storage_context = |
| 481 new CacheStorageContextImpl(context); |
| 482 cache_storage_context->Init(path, quota_manager->proxy(), |
| 483 context->GetSpecialStoragePolicy()); |
| 484 |
| 475 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = | 485 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = |
| 476 new ServiceWorkerContextWrapper(context); | 486 new ServiceWorkerContextWrapper(context); |
| 477 service_worker_context->Init( | 487 service_worker_context->Init(path, quota_manager->proxy(), |
| 478 path, quota_manager->proxy(), context->GetSpecialStoragePolicy()); | 488 context->GetSpecialStoragePolicy()); |
| 479 | 489 |
| 480 scoped_refptr<ChromeAppCacheService> appcache_service = | 490 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 481 new ChromeAppCacheService(quota_manager->proxy()); | 491 new ChromeAppCacheService(quota_manager->proxy()); |
| 482 | 492 |
| 483 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 493 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
| 484 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 494 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
| 485 | 495 |
| 486 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( | 496 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( |
| 487 context->GetSpecialStoragePolicy()); | 497 context->GetSpecialStoragePolicy()); |
| 488 | 498 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 499 navigator_connect_context->AddFactory(make_scoped_ptr( | 509 navigator_connect_context->AddFactory(make_scoped_ptr( |
| 500 new NavigatorConnectServiceWorkerServiceFactory(service_worker_context))); | 510 new NavigatorConnectServiceWorkerServiceFactory(service_worker_context))); |
| 501 | 511 |
| 502 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = | 512 scoped_refptr<PlatformNotificationContextImpl> platform_notification_context = |
| 503 new PlatformNotificationContextImpl(path); | 513 new PlatformNotificationContextImpl(path); |
| 504 | 514 |
| 505 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( | 515 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( |
| 506 context, partition_path, quota_manager.get(), appcache_service.get(), | 516 context, partition_path, quota_manager.get(), appcache_service.get(), |
| 507 filesystem_context.get(), database_tracker.get(), | 517 filesystem_context.get(), database_tracker.get(), |
| 508 dom_storage_context.get(), indexed_db_context.get(), | 518 dom_storage_context.get(), indexed_db_context.get(), |
| 509 service_worker_context.get(), webrtc_identity_store.get(), | 519 cache_storage_context.get(), service_worker_context.get(), |
| 510 special_storage_policy.get(), geofencing_manager.get(), | 520 webrtc_identity_store.get(), special_storage_policy.get(), |
| 511 host_zoom_level_context.get(), navigator_connect_context.get(), | 521 geofencing_manager.get(), host_zoom_level_context.get(), |
| 522 navigator_connect_context.get(), |
| 512 platform_notification_context.get()); | 523 platform_notification_context.get()); |
| 513 | 524 |
| 514 service_worker_context->set_storage_partition(storage_partition); | 525 service_worker_context->set_storage_partition(storage_partition); |
| 515 | 526 |
| 516 return storage_partition; | 527 return storage_partition; |
| 517 } | 528 } |
| 518 | 529 |
| 519 base::FilePath StoragePartitionImpl::GetPath() { | 530 base::FilePath StoragePartitionImpl::GetPath() { |
| 520 return partition_path_; | 531 return partition_path_; |
| 521 } | 532 } |
| (...skipping 24 matching lines...) Expand all Loading... |
| 546 } | 557 } |
| 547 | 558 |
| 548 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { | 559 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { |
| 549 return dom_storage_context_.get(); | 560 return dom_storage_context_.get(); |
| 550 } | 561 } |
| 551 | 562 |
| 552 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 563 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
| 553 return indexed_db_context_.get(); | 564 return indexed_db_context_.get(); |
| 554 } | 565 } |
| 555 | 566 |
| 567 CacheStorageContextImpl* StoragePartitionImpl::GetCacheStorageContext() { |
| 568 return cache_storage_context_.get(); |
| 569 } |
| 570 |
| 556 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 571 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
| 557 return service_worker_context_.get(); | 572 return service_worker_context_.get(); |
| 558 } | 573 } |
| 559 | 574 |
| 560 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { | 575 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { |
| 561 return geofencing_manager_.get(); | 576 return geofencing_manager_.get(); |
| 562 } | 577 } |
| 563 | 578 |
| 564 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { | 579 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
| 565 DCHECK(host_zoom_level_context_.get()); | 580 DCHECK(host_zoom_level_context_.get()); |
| (...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 893 net::URLRequestContextGetter* url_request_context) { | 908 net::URLRequestContextGetter* url_request_context) { |
| 894 url_request_context_ = url_request_context; | 909 url_request_context_ = url_request_context; |
| 895 } | 910 } |
| 896 | 911 |
| 897 void StoragePartitionImpl::SetMediaURLRequestContext( | 912 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 898 net::URLRequestContextGetter* media_url_request_context) { | 913 net::URLRequestContextGetter* media_url_request_context) { |
| 899 media_url_request_context_ = media_url_request_context; | 914 media_url_request_context_ = media_url_request_context; |
| 900 } | 915 } |
| 901 | 916 |
| 902 } // namespace content | 917 } // namespace content |
| OLD | NEW |