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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "content/browser/browser_main_loop.h" |
8 #include "content/browser/fileapi/browser_file_system_helper.h" | 10 #include "content/browser/fileapi/browser_file_system_helper.h" |
9 #include "content/browser/gpu/shader_disk_cache.h" | 11 #include "content/browser/gpu/shader_disk_cache.h" |
10 #include "content/public/browser/browser_context.h" | 12 #include "content/public/browser/browser_context.h" |
11 #include "content/public/browser/browser_thread.h" | 13 #include "content/public/browser/browser_thread.h" |
12 #include "content/public/browser/dom_storage_context.h" | 14 #include "content/public/browser/dom_storage_context.h" |
13 #include "content/public/browser/indexed_db_context.h" | 15 #include "content/public/browser/indexed_db_context.h" |
14 #include "net/base/completion_callback.h" | 16 #include "net/base/completion_callback.h" |
15 #include "net/base/net_errors.h" | 17 #include "net/base/net_errors.h" |
16 #include "net/cookies/cookie_monster.h" | 18 #include "net/cookies/cookie_monster.h" |
17 #include "net/url_request/url_request_context.h" | 19 #include "net/url_request/url_request_context.h" |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 in_memory, | 219 in_memory, |
218 context->GetSpecialStoragePolicy(), | 220 context->GetSpecialStoragePolicy(), |
219 quota_manager->proxy(), | 221 quota_manager->proxy(), |
220 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) | 222 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) |
221 .get()); | 223 .get()); |
222 | 224 |
223 base::FilePath path = in_memory ? base::FilePath() : partition_path; | 225 base::FilePath path = in_memory ? base::FilePath() : partition_path; |
224 scoped_refptr<DOMStorageContextImpl> dom_storage_context = | 226 scoped_refptr<DOMStorageContextImpl> dom_storage_context = |
225 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); | 227 new DOMStorageContextImpl(path, context->GetSpecialStoragePolicy()); |
226 | 228 |
| 229 // BrowserMainLoop may not be initialized in unit tests. Tests will |
| 230 // need to inject their own task runner into the IndexedDBContext. |
| 231 base::SequencedTaskRunner* idb_task_runner = |
| 232 BrowserThread::CurrentlyOn(BrowserThread::UI) && |
| 233 BrowserMainLoop::GetInstance() |
| 234 ? BrowserMainLoop::GetInstance()->indexed_db_thread()-> |
| 235 message_loop_proxy() |
| 236 : NULL; |
227 scoped_refptr<IndexedDBContextImpl> indexed_db_context = | 237 scoped_refptr<IndexedDBContextImpl> indexed_db_context = |
228 new IndexedDBContextImpl(path, | 238 new IndexedDBContextImpl(path, |
229 context->GetSpecialStoragePolicy(), | 239 context->GetSpecialStoragePolicy(), |
230 quota_manager->proxy(), | 240 quota_manager->proxy(), |
231 BrowserThread::GetMessageLoopProxyForThread( | 241 idb_task_runner); |
232 BrowserThread::WEBKIT_DEPRECATED).get()); | |
233 | 242 |
234 scoped_refptr<ChromeAppCacheService> appcache_service = | 243 scoped_refptr<ChromeAppCacheService> appcache_service = |
235 new ChromeAppCacheService(quota_manager->proxy()); | 244 new ChromeAppCacheService(quota_manager->proxy()); |
236 | 245 |
237 return new StoragePartitionImpl(partition_path, | 246 return new StoragePartitionImpl(partition_path, |
238 quota_manager.get(), | 247 quota_manager.get(), |
239 appcache_service.get(), | 248 appcache_service.get(), |
240 filesystem_context.get(), | 249 filesystem_context.get(), |
241 database_tracker.get(), | 250 database_tracker.get(), |
242 dom_storage_context.get(), | 251 dom_storage_context.get(), |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
339 net::URLRequestContextGetter* url_request_context) { | 348 net::URLRequestContextGetter* url_request_context) { |
340 url_request_context_ = url_request_context; | 349 url_request_context_ = url_request_context; |
341 } | 350 } |
342 | 351 |
343 void StoragePartitionImpl::SetMediaURLRequestContext( | 352 void StoragePartitionImpl::SetMediaURLRequestContext( |
344 net::URLRequestContextGetter* media_url_request_context) { | 353 net::URLRequestContextGetter* media_url_request_context) { |
345 media_url_request_context_ = media_url_request_context; | 354 media_url_request_context_ = media_url_request_context; |
346 } | 355 } |
347 | 356 |
348 } // namespace content | 357 } // namespace content |
OLD | NEW |