| 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "content/browser/fileapi/browser_file_system_helper.h" | 8 #include "content/browser/fileapi/browser_file_system_helper.h" |
| 9 #include "content/public/browser/browser_context.h" | 9 #include "content/public/browser/browser_context.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 104 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 105 | 105 |
| 106 for (size_t i = 0; i < infos.size(); ++i) { | 106 for (size_t i = 0; i < infos.size(); ++i) { |
| 107 dom_storage_context->DeleteSessionStorage(infos[i]); | 107 dom_storage_context->DeleteSessionStorage(infos[i]); |
| 108 } | 108 } |
| 109 } | 109 } |
| 110 | 110 |
| 111 } // namespace | 111 } // namespace |
| 112 | 112 |
| 113 StoragePartitionImpl::StoragePartitionImpl( | 113 StoragePartitionImpl::StoragePartitionImpl( |
| 114 const FilePath& partition_path, | 114 const base::FilePath& partition_path, |
| 115 quota::QuotaManager* quota_manager, | 115 quota::QuotaManager* quota_manager, |
| 116 ChromeAppCacheService* appcache_service, | 116 ChromeAppCacheService* appcache_service, |
| 117 fileapi::FileSystemContext* filesystem_context, | 117 fileapi::FileSystemContext* filesystem_context, |
| 118 webkit_database::DatabaseTracker* database_tracker, | 118 webkit_database::DatabaseTracker* database_tracker, |
| 119 DOMStorageContextImpl* dom_storage_context, | 119 DOMStorageContextImpl* dom_storage_context, |
| 120 IndexedDBContextImpl* indexed_db_context) | 120 IndexedDBContextImpl* indexed_db_context) |
| 121 : partition_path_(partition_path), | 121 : partition_path_(partition_path), |
| 122 quota_manager_(quota_manager), | 122 quota_manager_(quota_manager), |
| 123 appcache_service_(appcache_service), | 123 appcache_service_(appcache_service), |
| 124 filesystem_context_(filesystem_context), | 124 filesystem_context_(filesystem_context), |
| (...skipping 14 matching lines...) Expand all Loading... |
| 139 | 139 |
| 140 if (GetDOMStorageContext()) | 140 if (GetDOMStorageContext()) |
| 141 GetDOMStorageContext()->Shutdown(); | 141 GetDOMStorageContext()->Shutdown(); |
| 142 } | 142 } |
| 143 | 143 |
| 144 // TODO(ajwong): Break the direct dependency on |context|. We only | 144 // TODO(ajwong): Break the direct dependency on |context|. We only |
| 145 // need 3 pieces of info from it. | 145 // need 3 pieces of info from it. |
| 146 StoragePartitionImpl* StoragePartitionImpl::Create( | 146 StoragePartitionImpl* StoragePartitionImpl::Create( |
| 147 BrowserContext* context, | 147 BrowserContext* context, |
| 148 bool in_memory, | 148 bool in_memory, |
| 149 const FilePath& partition_path) { | 149 const base::FilePath& partition_path) { |
| 150 // Ensure that these methods are called on the UI thread, except for | 150 // Ensure that these methods are called on the UI thread, except for |
| 151 // unittests where a UI thread might not have been created. | 151 // unittests where a UI thread might not have been created. |
| 152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 152 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
| 153 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 153 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
| 154 | 154 |
| 155 // All of the clients have to be created and registered with the | 155 // All of the clients have to be created and registered with the |
| 156 // QuotaManager prior to the QuotaManger being used. We do them | 156 // QuotaManager prior to the QuotaManger being used. We do them |
| 157 // all together here prior to handing out a reference to anything | 157 // all together here prior to handing out a reference to anything |
| 158 // that utilizes the QuotaManager. | 158 // that utilizes the QuotaManager. |
| 159 scoped_refptr<quota::QuotaManager> quota_manager = | 159 scoped_refptr<quota::QuotaManager> quota_manager = |
| (...skipping 10 matching lines...) Expand all Loading... |
| 170 BrowserContext::GetMountPoints(context), | 170 BrowserContext::GetMountPoints(context), |
| 171 context->GetSpecialStoragePolicy(), | 171 context->GetSpecialStoragePolicy(), |
| 172 quota_manager->proxy()); | 172 quota_manager->proxy()); |
| 173 | 173 |
| 174 scoped_refptr<webkit_database::DatabaseTracker> database_tracker = | 174 scoped_refptr<webkit_database::DatabaseTracker> database_tracker = |
| 175 new webkit_database::DatabaseTracker( | 175 new webkit_database::DatabaseTracker( |
| 176 partition_path, in_memory, | 176 partition_path, in_memory, |
| 177 context->GetSpecialStoragePolicy(), quota_manager->proxy(), | 177 context->GetSpecialStoragePolicy(), quota_manager->proxy(), |
| 178 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 178 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); |
| 179 | 179 |
| 180 FilePath path = in_memory ? FilePath() : partition_path; | 180 base::FilePath path = in_memory ? base::FilePath() : partition_path; |
| 181 scoped_refptr<DOMStorageContextImpl> dom_storage_context = | 181 scoped_refptr<DOMStorageContextImpl> dom_storage_context = |
| 182 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); | 182 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); |
| 183 | 183 |
| 184 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 184 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
| 185 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), | 185 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), |
| 186 quota_manager->proxy(), | 186 quota_manager->proxy(), |
| 187 BrowserThread::GetMessageLoopProxyForThread( | 187 BrowserThread::GetMessageLoopProxyForThread( |
| 188 BrowserThread::WEBKIT_DEPRECATED)); | 188 BrowserThread::WEBKIT_DEPRECATED)); |
| 189 | 189 |
| 190 scoped_refptr<ChromeAppCacheService> appcache_service = | 190 scoped_refptr<ChromeAppCacheService> appcache_service = |
| 191 new ChromeAppCacheService(quota_manager->proxy()); | 191 new ChromeAppCacheService(quota_manager->proxy()); |
| 192 | 192 |
| 193 return new StoragePartitionImpl(partition_path, | 193 return new StoragePartitionImpl(partition_path, |
| 194 quota_manager, | 194 quota_manager, |
| 195 appcache_service, | 195 appcache_service, |
| 196 filesystem_context, | 196 filesystem_context, |
| 197 database_tracker, | 197 database_tracker, |
| 198 dom_storage_context, | 198 dom_storage_context, |
| 199 indexed_db_context); | 199 indexed_db_context); |
| 200 } | 200 } |
| 201 | 201 |
| 202 FilePath StoragePartitionImpl::GetPath() { | 202 base::FilePath StoragePartitionImpl::GetPath() { |
| 203 return partition_path_; | 203 return partition_path_; |
| 204 } | 204 } |
| 205 | 205 |
| 206 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { | 206 net::URLRequestContextGetter* StoragePartitionImpl::GetURLRequestContext() { |
| 207 return url_request_context_; | 207 return url_request_context_; |
| 208 } | 208 } |
| 209 | 209 |
| 210 net::URLRequestContextGetter* | 210 net::URLRequestContextGetter* |
| 211 StoragePartitionImpl::GetMediaURLRequestContext() { | 211 StoragePartitionImpl::GetMediaURLRequestContext() { |
| 212 return media_url_request_context_; | 212 return media_url_request_context_; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 271 net::URLRequestContextGetter* url_request_context) { | 271 net::URLRequestContextGetter* url_request_context) { |
| 272 url_request_context_ = url_request_context; | 272 url_request_context_ = url_request_context; |
| 273 } | 273 } |
| 274 | 274 |
| 275 void StoragePartitionImpl::SetMediaURLRequestContext( | 275 void StoragePartitionImpl::SetMediaURLRequestContext( |
| 276 net::URLRequestContextGetter* media_url_request_context) { | 276 net::URLRequestContextGetter* media_url_request_context) { |
| 277 media_url_request_context_ = media_url_request_context; | 277 media_url_request_context_ = media_url_request_context; |
| 278 } | 278 } |
| 279 | 279 |
| 280 } // namespace content | 280 } // namespace content |
| OLD | NEW |