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 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
277 } | 277 } |
278 | 278 |
279 StoragePartitionImpl::StoragePartitionImpl( | 279 StoragePartitionImpl::StoragePartitionImpl( |
280 const base::FilePath& partition_path, | 280 const base::FilePath& partition_path, |
281 quota::QuotaManager* quota_manager, | 281 quota::QuotaManager* quota_manager, |
282 ChromeAppCacheService* appcache_service, | 282 ChromeAppCacheService* appcache_service, |
283 fileapi::FileSystemContext* filesystem_context, | 283 fileapi::FileSystemContext* filesystem_context, |
284 webkit_database::DatabaseTracker* database_tracker, | 284 webkit_database::DatabaseTracker* database_tracker, |
285 DOMStorageContextWrapper* dom_storage_context, | 285 DOMStorageContextWrapper* dom_storage_context, |
286 IndexedDBContextImpl* indexed_db_context, | 286 IndexedDBContextImpl* indexed_db_context, |
| 287 ServiceWorkerContext* service_worker_context, |
287 WebRTCIdentityStore* webrtc_identity_store) | 288 WebRTCIdentityStore* webrtc_identity_store) |
288 : partition_path_(partition_path), | 289 : partition_path_(partition_path), |
289 quota_manager_(quota_manager), | 290 quota_manager_(quota_manager), |
290 appcache_service_(appcache_service), | 291 appcache_service_(appcache_service), |
291 filesystem_context_(filesystem_context), | 292 filesystem_context_(filesystem_context), |
292 database_tracker_(database_tracker), | 293 database_tracker_(database_tracker), |
293 dom_storage_context_(dom_storage_context), | 294 dom_storage_context_(dom_storage_context), |
294 indexed_db_context_(indexed_db_context), | 295 indexed_db_context_(indexed_db_context), |
| 296 service_worker_context_(service_worker_context), |
295 webrtc_identity_store_(webrtc_identity_store) {} | 297 webrtc_identity_store_(webrtc_identity_store) {} |
296 | 298 |
297 StoragePartitionImpl::~StoragePartitionImpl() { | 299 StoragePartitionImpl::~StoragePartitionImpl() { |
298 // These message loop checks are just to avoid leaks in unittests. | 300 // These message loop checks are just to avoid leaks in unittests. |
299 if (GetDatabaseTracker() && | 301 if (GetDatabaseTracker() && |
300 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 302 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
301 BrowserThread::PostTask( | 303 BrowserThread::PostTask( |
302 BrowserThread::FILE, FROM_HERE, | 304 BrowserThread::FILE, FROM_HERE, |
303 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 305 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
304 GetDatabaseTracker())); | 306 GetDatabaseTracker())); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 BrowserMainLoop::GetInstance() | 362 BrowserMainLoop::GetInstance() |
361 ? BrowserMainLoop::GetInstance()->indexed_db_thread() | 363 ? BrowserMainLoop::GetInstance()->indexed_db_thread() |
362 ->message_loop_proxy().get() | 364 ->message_loop_proxy().get() |
363 : NULL; | 365 : NULL; |
364 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 366 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
365 new IndexedDBContextImpl(path, | 367 new IndexedDBContextImpl(path, |
366 context->GetSpecialStoragePolicy(), | 368 context->GetSpecialStoragePolicy(), |
367 quota_manager->proxy(), | 369 quota_manager->proxy(), |
368 idb_task_runner); | 370 idb_task_runner); |
369 | 371 |
| 372 scoped_refptr<ServiceWorkerContext> service_worker_context = |
| 373 new ServiceWorkerContext(path, quota_manager->proxy()); |
| 374 |
370 scoped_refptr<ChromeAppCacheService> appcache_service = | 375 scoped_refptr<ChromeAppCacheService> appcache_service = |
371 new ChromeAppCacheService(quota_manager->proxy()); | 376 new ChromeAppCacheService(quota_manager->proxy()); |
372 | 377 |
373 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( | 378 scoped_refptr<WebRTCIdentityStore> webrtc_identity_store( |
374 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); | 379 new WebRTCIdentityStore(path, context->GetSpecialStoragePolicy())); |
375 | 380 |
376 return new StoragePartitionImpl(partition_path, | 381 return new StoragePartitionImpl(partition_path, |
377 quota_manager.get(), | 382 quota_manager.get(), |
378 appcache_service.get(), | 383 appcache_service.get(), |
379 filesystem_context.get(), | 384 filesystem_context.get(), |
380 database_tracker.get(), | 385 database_tracker.get(), |
381 dom_storage_context.get(), | 386 dom_storage_context.get(), |
382 indexed_db_context.get(), | 387 indexed_db_context.get(), |
| 388 service_worker_context.get(), |
383 webrtc_identity_store.get()); | 389 webrtc_identity_store.get()); |
384 } | 390 } |
385 | 391 |
386 base::FilePath StoragePartitionImpl::GetPath() { | 392 base::FilePath StoragePartitionImpl::GetPath() { |
387 return partition_path_; | 393 return partition_path_; |
388 } | 394 } |
389 | 395 |
390 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 396 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
391 return url_request_context_.get(); | 397 return url_request_context_.get(); |
392 } | 398 } |
(...skipping 20 matching lines...) Expand all Loading... |
413 } | 419 } |
414 | 420 |
415 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { | 421 DOMStorageContextWrapper* StoragePartitionImpl::GetDOMStorageContext() { |
416 return dom_storage_context_.get(); | 422 return dom_storage_context_.get(); |
417 } | 423 } |
418 | 424 |
419 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 425 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
420 return indexed_db_context_.get(); | 426 return indexed_db_context_.get(); |
421 } | 427 } |
422 | 428 |
| 429 ServiceWorkerContext* StoragePartitionImpl::GetServiceWorkerContext() { |
| 430 return service_worker_context_.get(); |
| 431 } |
| 432 |
423 void StoragePartitionImpl::ClearDataImpl( | 433 void StoragePartitionImpl::ClearDataImpl( |
424 uint32 remove_mask, | 434 uint32 remove_mask, |
425 uint32 quota_storage_remove_mask, | 435 uint32 quota_storage_remove_mask, |
426 const GURL& remove_origin, | 436 const GURL& remove_origin, |
427 net::URLRequestContextGetter* rq_context, | 437 net::URLRequestContextGetter* rq_context, |
428 const base::Time begin, | 438 const base::Time begin, |
429 const base::Time end, | 439 const base::Time end, |
430 const base::Closure& callback) { | 440 const base::Closure& callback) { |
431 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 441 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
432 DataDeletionHelper* helper = new DataDeletionHelper(callback); | 442 DataDeletionHelper* helper = new DataDeletionHelper(callback); |
(...skipping 226 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
659 net::URLRequestContextGetter* url_request_context) { | 669 net::URLRequestContextGetter* url_request_context) { |
660 url_request_context_ = url_request_context; | 670 url_request_context_ = url_request_context; |
661 } | 671 } |
662 | 672 |
663 void StoragePartitionImpl::SetMediaURLRequestContext( | 673 void StoragePartitionImpl::SetMediaURLRequestContext( |
664 net::URLRequestContextGetter* media_url_request_context) { | 674 net::URLRequestContextGetter* media_url_request_context) { |
665 media_url_request_context_ = media_url_request_context; | 675 media_url_request_context_ = media_url_request_context; |
666 } | 676 } |
667 | 677 |
668 } // namespace content | 678 } // namespace content |
OLD | NEW |