| 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 | 362 |
| 363 StoragePartitionImpl::StoragePartitionImpl( | 363 StoragePartitionImpl::StoragePartitionImpl( |
| 364 BrowserContext* browser_context, | 364 BrowserContext* browser_context, |
| 365 const base::FilePath& partition_path, | 365 const base::FilePath& partition_path, |
| 366 storage::QuotaManager* quota_manager, | 366 storage::QuotaManager* quota_manager, |
| 367 ChromeAppCacheService* appcache_service, | 367 ChromeAppCacheService* appcache_service, |
| 368 storage::FileSystemContext* filesystem_context, | 368 storage::FileSystemContext* filesystem_context, |
| 369 storage::DatabaseTracker* database_tracker, | 369 storage::DatabaseTracker* database_tracker, |
| 370 DOMStorageContextWrapper* dom_storage_context, | 370 DOMStorageContextWrapper* dom_storage_context, |
| 371 IndexedDBContextImpl* indexed_db_context, | 371 IndexedDBContextImpl* indexed_db_context, |
| 372 CacheStorageContextImpl* cache_storage_context, |
| 372 ServiceWorkerContextWrapper* service_worker_context, | 373 ServiceWorkerContextWrapper* service_worker_context, |
| 373 WebRTCIdentityStore* webrtc_identity_store, | 374 WebRTCIdentityStore* webrtc_identity_store, |
| 374 storage::SpecialStoragePolicy* special_storage_policy, | 375 storage::SpecialStoragePolicy* special_storage_policy, |
| 375 GeofencingManager* geofencing_manager, | 376 GeofencingManager* geofencing_manager, |
| 376 HostZoomLevelContext* host_zoom_level_context, | 377 HostZoomLevelContext* host_zoom_level_context, |
| 377 NavigatorConnectContextImpl* navigator_connect_context) | 378 NavigatorConnectContextImpl* navigator_connect_context) |
| 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), |
| 386 cache_storage_context_(cache_storage_context), |
| 385 service_worker_context_(service_worker_context), | 387 service_worker_context_(service_worker_context), |
| 386 webrtc_identity_store_(webrtc_identity_store), | 388 webrtc_identity_store_(webrtc_identity_store), |
| 387 special_storage_policy_(special_storage_policy), | 389 special_storage_policy_(special_storage_policy), |
| 388 geofencing_manager_(geofencing_manager), | 390 geofencing_manager_(geofencing_manager), |
| 389 host_zoom_level_context_(host_zoom_level_context), | 391 host_zoom_level_context_(host_zoom_level_context), |
| 390 navigator_connect_context_(navigator_connect_context), | 392 navigator_connect_context_(navigator_connect_context), |
| 391 browser_context_(browser_context) { | 393 browser_context_(browser_context) { |
| 392 } | 394 } |
| 393 | 395 |
| 394 StoragePartitionImpl::~StoragePartitionImpl() { | 396 StoragePartitionImpl::~StoragePartitionImpl() { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 405 | 407 |
| 406 if (GetFileSystemContext()) | 408 if (GetFileSystemContext()) |
| 407 GetFileSystemContext()->Shutdown(); | 409 GetFileSystemContext()->Shutdown(); |
| 408 | 410 |
| 409 if (GetDOMStorageContext()) | 411 if (GetDOMStorageContext()) |
| 410 GetDOMStorageContext()->Shutdown(); | 412 GetDOMStorageContext()->Shutdown(); |
| 411 | 413 |
| 412 if (GetServiceWorkerContext()) | 414 if (GetServiceWorkerContext()) |
| 413 GetServiceWorkerContext()->Shutdown(); | 415 GetServiceWorkerContext()->Shutdown(); |
| 414 | 416 |
| 417 if (GetCacheStorageContext()) |
| 418 GetCacheStorageContext()->Shutdown(); |
| 419 |
| 415 if (GetGeofencingManager()) | 420 if (GetGeofencingManager()) |
| 416 GetGeofencingManager()->Shutdown(); | 421 GetGeofencingManager()->Shutdown(); |
| 417 } | 422 } |
| 418 | 423 |
| 419 StoragePartitionImpl* StoragePartitionImpl::Create( | 424 StoragePartitionImpl* StoragePartitionImpl::Create( |
| 420 BrowserContext* context, | 425 BrowserContext* context, |
| 421 bool in_memory, | 426 bool in_memory, |
| 422 const base::FilePath& partition_path) { | 427 const base::FilePath& partition_path) { |
| 423 // Ensure that these methods are called on the UI thread, except for | 428 // Ensure that these methods are called on the UI thread, except for |
| 424 // unittests where a UI thread might not have been created. | 429 // unittests where a UI thread might not have been created. |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 BrowserMainLoop::GetInstance() | 467 BrowserMainLoop::GetInstance() |
| 463 ? BrowserMainLoop::GetInstance()->indexed_db_thread() | 468 ? BrowserMainLoop::GetInstance()->indexed_db_thread() |
| 464 ->message_loop_proxy().get() | 469 ->message_loop_proxy().get() |
| 465 : NULL; | 470 : NULL; |
| 466 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 471 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
| 467 new IndexedDBContextImpl(path, | 472 new IndexedDBContextImpl(path, |
| 468 context->GetSpecialStoragePolicy(), | 473 context->GetSpecialStoragePolicy(), |
| 469 quota_manager->proxy(), | 474 quota_manager->proxy(), |
| 470 idb_task_runner); | 475 idb_task_runner); |
| 471 | 476 |
| 477 scoped_refptr<CacheStorageContextImpl> cache_storage_context = |
| 478 new CacheStorageContextImpl(context); |
| 479 cache_storage_context->Init(path, quota_manager->proxy(), |
| 480 context->GetSpecialStoragePolicy()); |
| 481 |
| 472 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = | 482 scoped_refptr<ServiceWorkerContextWrapper> service_worker_context = |
| 473 new ServiceWorkerContextWrapper(context); | 483 new ServiceWorkerContextWrapper(context); |
| 474 service_worker_context->Init( | 484 service_worker_context->Init(path, quota_manager->proxy(), |
| 475 path, quota_manager->proxy(), context->GetSpecialStoragePolicy()); | 485 context->GetSpecialStoragePolicy()); |
| 476 | 486 |
| 477 scoped_refptr<ChromeAppCacheService> appcache_service = | 487 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 478 new ChromeAppCacheService(quota_manager->proxy()); | 488 new ChromeAppCacheService(quota_manager->proxy()); |
| 479 | 489 |
| 480 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 490 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
| 481 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 491 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
| 482 | 492 |
| 483 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( | 493 scoped_refptr<storage::SpecialStoragePolicy> special_storage_policy( |
| 484 context->GetSpecialStoragePolicy()); | 494 context->GetSpecialStoragePolicy()); |
| 485 | 495 |
| 486 scoped_refptr<GeofencingManager> geofencing_manager = | 496 scoped_refptr<GeofencingManager> geofencing_manager = |
| 487 new GeofencingManager(service_worker_context); | 497 new GeofencingManager(service_worker_context); |
| 488 geofencing_manager->Init(); | 498 geofencing_manager->Init(); |
| 489 | 499 |
| 490 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( | 500 scoped_refptr<HostZoomLevelContext> host_zoom_level_context( |
| 491 new HostZoomLevelContext( | 501 new HostZoomLevelContext( |
| 492 context->CreateZoomLevelDelegate(partition_path))); | 502 context->CreateZoomLevelDelegate(partition_path))); |
| 493 | 503 |
| 494 scoped_refptr<NavigatorConnectContextImpl> navigator_connect_context = | 504 scoped_refptr<NavigatorConnectContextImpl> navigator_connect_context = |
| 495 new NavigatorConnectContextImpl(); | 505 new NavigatorConnectContextImpl(); |
| 496 navigator_connect_context->AddFactory(make_scoped_ptr( | 506 navigator_connect_context->AddFactory(make_scoped_ptr( |
| 497 new NavigatorConnectServiceWorkerServiceFactory(service_worker_context))); | 507 new NavigatorConnectServiceWorkerServiceFactory(service_worker_context))); |
| 498 | 508 |
| 499 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( | 509 StoragePartitionImpl* storage_partition = new StoragePartitionImpl( |
| 500 context, partition_path, quota_manager.get(), appcache_service.get(), | 510 context, partition_path, quota_manager.get(), appcache_service.get(), |
| 501 filesystem_context.get(), database_tracker.get(), | 511 filesystem_context.get(), database_tracker.get(), |
| 502 dom_storage_context.get(), indexed_db_context.get(), | 512 dom_storage_context.get(), indexed_db_context.get(), |
| 503 service_worker_context.get(), webrtc_identity_store.get(), | 513 cache_storage_context.get(), service_worker_context.get(), |
| 504 special_storage_policy.get(), geofencing_manager.get(), | 514 webrtc_identity_store.get(), special_storage_policy.get(), |
| 505 host_zoom_level_context.get(), navigator_connect_context.get()); | 515 geofencing_manager.get(), host_zoom_level_context.get(), |
| 516 navigator_connect_context.get()); |
| 506 | 517 |
| 507 service_worker_context->set_storage_partition(storage_partition); | 518 service_worker_context->set_storage_partition(storage_partition); |
| 508 | 519 |
| 509 return storage_partition; | 520 return storage_partition; |
| 510 } | 521 } |
| 511 | 522 |
| 512 base::FilePath StoragePartitionImpl::GetPath() { | 523 base::FilePath StoragePartitionImpl::GetPath() { |
| 513 return partition_path_; | 524 return partition_path_; |
| 514 } | 525 } |
| 515 | 526 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 539 } | 550 } |
| 540 | 551 |
| 541 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { | 552 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { |
| 542 return dom_storage_context_.get(); | 553 return dom_storage_context_.get(); |
| 543 } | 554 } |
| 544 | 555 |
| 545 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 556 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
| 546 return indexed_db_context_.get(); | 557 return indexed_db_context_.get(); |
| 547 } | 558 } |
| 548 | 559 |
| 560 CacheStorageContextImpl* StoragePartitionImpl::GetCacheStorageContext() { |
| 561 return cache_storage_context_.get(); |
| 562 } |
| 563 |
| 549 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { | 564 ServiceWorkerContextWrapper* StoragePartitionImpl::GetServiceWorkerContext() { |
| 550 return service_worker_context_.get(); | 565 return service_worker_context_.get(); |
| 551 } | 566 } |
| 552 | 567 |
| 553 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { | 568 GeofencingManager* StoragePartitionImpl::GetGeofencingManager() { |
| 554 return geofencing_manager_.get(); | 569 return geofencing_manager_.get(); |
| 555 } | 570 } |
| 556 | 571 |
| 557 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { | 572 HostZoomMap* StoragePartitionImpl::GetHostZoomMap() { |
| 558 DCHECK(host_zoom_level_context_.get()); | 573 DCHECK(host_zoom_level_context_.get()); |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 net::URLRequestContextGetter* url_request_context) { | 896 net::URLRequestContextGetter* url_request_context) { |
| 882 url_request_context_ = url_request_context; | 897 url_request_context_ = url_request_context; |
| 883 } | 898 } |
| 884 | 899 |
| 885 void StoragePartitionImpl::SetMediaURLRequestContext( | 900 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 886 net::URLRequestContextGetter* media_url_request_context) { | 901 net::URLRequestContextGetter* media_url_request_context) { |
| 887 media_url_request_context_ = media_url_request_context; | 902 media_url_request_context_ = media_url_request_context; |
| 888 } | 903 } |
| 889 | 904 |
| 890 } // namespace content | 905 } // namespace content |
| OLD | NEW |