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/strings/utf_string_conversions.h" | 7 #include "base/strings/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/browser/gpu/shader_disk_cache.h" | 9 #include "content/browser/gpu/shader_disk_cache.h" |
10 #include "content/public/browser/browser_context.h" | 10 #include "content/public/browser/browser_context.h" |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 const base::FilePath& partition_path) { | 189 const base::FilePath& partition_path) { |
190 // Ensure that these methods are called on the UI thread, except for | 190 // Ensure that these methods are called on the UI thread, except for |
191 // unittests where a UI thread might not have been created. | 191 // unittests where a UI thread might not have been created. |
192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || | 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI) || |
193 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); | 193 !BrowserThread::IsMessageLoopValid(BrowserThread::UI)); |
194 | 194 |
195 // All of the clients have to be created and registered with the | 195 // All of the clients have to be created and registered with the |
196 // QuotaManager prior to the QuotaManger being used. We do them | 196 // QuotaManager prior to the QuotaManger being used. We do them |
197 // all together here prior to handing out a reference to anything | 197 // all together here prior to handing out a reference to anything |
198 // that utilizes the QuotaManager. | 198 // that utilizes the QuotaManager. |
199 scoped_refptr<quota::QuotaManager> quota_manager = | 199 scoped_refptr<quota::QuotaManager> quota_manager = new quota::QuotaManager( |
200 new quota::QuotaManager( | 200 in_memory, |
201 in_memory, partition_path, | 201 partition_path, |
202 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO), | 202 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), |
203 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB), | 203 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::DB).get(), |
204 context->GetSpecialStoragePolicy()); | 204 context->GetSpecialStoragePolicy()); |
205 | 205 |
206 // Each consumer is responsible for registering its QuotaClient during | 206 // Each consumer is responsible for registering its QuotaClient during |
207 // its construction. | 207 // its construction. |
208 scoped_refptr<fileapi::FileSystemContext> filesystem_context = | 208 scoped_refptr<fileapi::FileSystemContext> filesystem_context = |
209 CreateFileSystemContext(partition_path, in_memory, | 209 CreateFileSystemContext(partition_path, in_memory, |
210 BrowserContext::GetMountPoints(context), | 210 BrowserContext::GetMountPoints(context), |
211 context->GetSpecialStoragePolicy(), | 211 context->GetSpecialStoragePolicy(), |
212 quota_manager->proxy()); | 212 quota_manager->proxy()); |
213 | 213 |
214 scoped_refptr<webkit_database::DatabaseTracker> database_tracker = | 214 scoped_refptr<webkit_database::DatabaseTracker> database_tracker = |
215 new webkit_database::DatabaseTracker( | 215 new webkit_database::DatabaseTracker( |
216 partition_path, in_memory, | 216 partition_path, |
217 context->GetSpecialStoragePolicy(), quota_manager->proxy(), | 217 in_memory, |
218 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); | 218 context->GetSpecialStoragePolicy(), |
| 219 quota_manager->proxy(), |
| 220 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
| 221 .get()); |
219 | 222 |
220 base::FilePath path = in_memory ? base::FilePath() : partition_path; | 223 base::FilePath path = in_memory ? base::FilePath() : partition_path; |
221 scoped_refptr<DOMStorageContextImpl> dom_storage_context = | 224 scoped_refptr<DOMStorageContextImpl> dom_storage_context = |
222 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); | 225 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); |
223 | 226 |
224 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 227 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
225 new IndexedDBContextImpl(path, context->GetSpecialStoragePolicy(), | 228 new IndexedDBContextImpl(path, |
| 229 context->GetSpecialStoragePolicy(), |
226 quota_manager->proxy(), | 230 quota_manager->proxy(), |
227 BrowserThread::GetMessageLoopProxyForThread( | 231 BrowserThread::GetMessageLoopProxyForThread( |
228 BrowserThread::WEBKIT_DEPRECATED)); | 232 BrowserThread::WEBKIT_DEPRECATED).get()); |
229 | 233 |
230 scoped_refptr<ChromeAppCacheService> appcache_service = | 234 scoped_refptr<ChromeAppCacheService> appcache_service = |
231 new ChromeAppCacheService(quota_manager->proxy()); | 235 new ChromeAppCacheService(quota_manager->proxy()); |
232 | 236 |
233 return new StoragePartitionImpl(partition_path, | 237 return new StoragePartitionImpl(partition_path, |
234 quota_manager.get(), | 238 quota_manager.get(), |
235 appcache_service.get(), | 239 appcache_service.get(), |
236 filesystem_context.get(), | 240 filesystem_context.get(), |
237 database_tracker.get(), | 241 database_tracker.get(), |
238 dom_storage_context.get(), | 242 dom_storage_context.get(), |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
335 net::URLRequestContextGetter* url_request_context) { | 339 net::URLRequestContextGetter* url_request_context) { |
336 url_request_context_ = url_request_context; | 340 url_request_context_ = url_request_context; |
337 } | 341 } |
338 | 342 |
339 void StoragePartitionImpl::SetMediaURLRequestContext( | 343 void StoragePartitionImpl::SetMediaURLRequestContext( |
340 net::URLRequestContextGetter* media_url_request_context) { | 344 net::URLRequestContextGetter* media_url_request_context) { |
341 media_url_request_context_ = media_url_request_context; | 345 media_url_request_context_ = media_url_request_context; |
342 } | 346 } |
343 | 347 |
344 } // namespace content | 348 } // namespace content |
OLD | NEW |