| 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 "content/browser/fileapi/browser_file_system_helper.h" | 7 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 8 #include "content/public/browser/browser_context.h" | 8 #include "content/public/browser/browser_context.h" |
| 9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
| 10 #include "webkit/database/database_tracker.h" | 10 #include "webkit/database/database_tracker.h" |
| 11 #include "webkit/quota/quota_manager.h" | 11 #include "webkit/quota/quota_manager.h" |
| 12 | 12 |
| 13 namespace content { | 13 namespace content { |
| 14 | 14 |
| 15 StoragePartitionImpl::StoragePartitionImpl( | 15 StoragePartitionImpl::StoragePartitionImpl( |
| 16 const FilePath& partition_path, | 16 const FilePath& partition_path, |
| 17 quota::QuotaManager* quota_manager, | 17 quota::QuotaManager* quota_manager, |
| 18 ChromeAppCacheService* appcache_service, | 18 ChromeAppCacheService* appcache_service, |
| 19 fileapi::FileSystemContext* filesystem_context, | 19 fileapi::FileSystemContext* filesystem_context, |
| 20 webkit_database::DatabaseTracker* database_tracker, | 20 webkit_database::DatabaseTracker* database_tracker, |
| 21 DOMStorageContextImpl* dom_storage_context, | 21 DOMStorageContextImpl* dom_storage_context, |
| 22 IndexedDBContextImpl* indexed_db_context) | 22 IndexedDBContextImpl* indexed_db_context, |
| 23 ResourceContext* resource_context) |
| 23 : partition_path_(partition_path), | 24 : partition_path_(partition_path), |
| 24 quota_manager_(quota_manager), | 25 quota_manager_(quota_manager), |
| 25 appcache_service_(appcache_service), | 26 appcache_service_(appcache_service), |
| 26 filesystem_context_(filesystem_context), | 27 filesystem_context_(filesystem_context), |
| 27 database_tracker_(database_tracker), | 28 database_tracker_(database_tracker), |
| 28 dom_storage_context_(dom_storage_context), | 29 dom_storage_context_(dom_storage_context), |
| 29 indexed_db_context_(indexed_db_context) { | 30 indexed_db_context_(indexed_db_context), |
| 31 resource_context_(resource_context) { |
| 30 } | 32 } |
| 31 | 33 |
| 32 StoragePartitionImpl::~StoragePartitionImpl() { | 34 StoragePartitionImpl::~StoragePartitionImpl() { |
| 33 // These message loop checks are just to avoid leaks in unittests. | 35 // These message loop checks are just to avoid leaks in unittests. |
| 34 if (GetDatabaseTracker() && | 36 if (GetDatabaseTracker() && |
| 35 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { | 37 BrowserThread::IsMessageLoopValid(BrowserThread::FILE)) { |
| 36 BrowserThread::PostTask( | 38 BrowserThread::PostTask( |
| 37 BrowserThread::FILE, FROM_HERE, | 39 BrowserThread::FILE, FROM_HERE, |
| 38 base::Bind(&webkit_database::DatabaseTracker::Shutdown, | 40 base::Bind(&webkit_database::DatabaseTracker::Shutdown, |
| 39 GetDatabaseTracker())); | 41 GetDatabaseTracker())); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 91 |
| 90 scoped_refptr<ChromeAppCacheService> appcache_service = | 92 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 91 new ChromeAppCacheService(quota_manager->proxy()); | 93 new ChromeAppCacheService(quota_manager->proxy()); |
| 92 | 94 |
| 93 return new StoragePartitionImpl(partition_path, | 95 return new StoragePartitionImpl(partition_path, |
| 94 quota_manager, | 96 quota_manager, |
| 95 appcache_service, | 97 appcache_service, |
| 96 filesystem_context, | 98 filesystem_context, |
| 97 database_tracker, | 99 database_tracker, |
| 98 dom_storage_context, | 100 dom_storage_context, |
| 99 indexed_db_context); | 101 indexed_db_context, |
| 102 context->GetResourceContext(NULL)); |
| 100 } | 103 } |
| 101 | 104 |
| 102 quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() { | 105 quota::QuotaManager* StoragePartitionImpl::GetQuotaManager() { |
| 103 return quota_manager_; | 106 return quota_manager_; |
| 104 } | 107 } |
| 105 | 108 |
| 106 ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() { | 109 ChromeAppCacheService* StoragePartitionImpl::GetAppCacheService() { |
| 107 return appcache_service_; | 110 return appcache_service_; |
| 108 } | 111 } |
| 109 | 112 |
| 110 fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() { | 113 fileapi::FileSystemContext* StoragePartitionImpl::GetFileSystemContext() { |
| 111 return filesystem_context_; | 114 return filesystem_context_; |
| 112 } | 115 } |
| 113 | 116 |
| 114 webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() { | 117 webkit_database::DatabaseTracker* StoragePartitionImpl::GetDatabaseTracker() { |
| 115 return database_tracker_; | 118 return database_tracker_; |
| 116 } | 119 } |
| 117 | 120 |
| 118 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() { | 121 DOMStorageContextImpl* StoragePartitionImpl::GetDOMStorageContext() { |
| 119 return dom_storage_context_; | 122 return dom_storage_context_; |
| 120 } | 123 } |
| 121 | 124 |
| 122 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { | 125 IndexedDBContextImpl* StoragePartitionImpl::GetIndexedDBContext() { |
| 123 return indexed_db_context_; | 126 return indexed_db_context_; |
| 124 } | 127 } |
| 125 | 128 |
| 129 ResourceContext* StoragePartitionImpl::GetResourceContext() { |
| 130 return resource_context_; |
| 131 } |
| 132 |
| 126 } // namespace content | 133 } // namespace content |
| OLD | NEW |