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_map.h" | 5 #include "content/browser/storage_partition_impl_map.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/files/file_enumerator.h" | 12 #include "base/files/file_enumerator.h" |
13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
14 #include "base/files/file_util.h" | 14 #include "base/files/file_util.h" |
15 #include "base/location.h" | 15 #include "base/location.h" |
16 #include "base/macros.h" | 16 #include "base/macros.h" |
17 #include "base/memory/ptr_util.h" | 17 #include "base/memory/ptr_util.h" |
18 #include "base/single_thread_task_runner.h" | 18 #include "base/single_thread_task_runner.h" |
19 #include "base/strings/string_number_conversions.h" | 19 #include "base/strings/string_number_conversions.h" |
20 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
21 #include "base/strings/stringprintf.h" | 21 #include "base/strings/stringprintf.h" |
22 #include "base/task_scheduler/post_task.h" | 22 #include "base/task_scheduler/post_task.h" |
23 #include "base/threading/sequenced_worker_pool.h" | |
24 #include "base/threading/thread_task_runner_handle.h" | 23 #include "base/threading/thread_task_runner_handle.h" |
25 #include "build/build_config.h" | 24 #include "build/build_config.h" |
26 #include "content/browser/appcache/appcache_interceptor.h" | 25 #include "content/browser/appcache/appcache_interceptor.h" |
27 #include "content/browser/appcache/chrome_appcache_service.h" | 26 #include "content/browser/appcache/chrome_appcache_service.h" |
28 #include "content/browser/background_fetch/background_fetch_context.h" | 27 #include "content/browser/background_fetch/background_fetch_context.h" |
29 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 28 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
30 #include "content/browser/fileapi/browser_file_system_helper.h" | 29 #include "content/browser/fileapi/browser_file_system_helper.h" |
31 #include "content/browser/loader/resource_request_info_impl.h" | 30 #include "content/browser/loader/resource_request_info_impl.h" |
32 #include "content/browser/resource_context_impl.h" | 31 #include "content/browser/resource_context_impl.h" |
33 #include "content/browser/service_worker/foreign_fetch_request_handler.h" | 32 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
364 sizeof(buffer)); | 363 sizeof(buffer)); |
365 return path.AppendASCII(base::HexEncode(buffer, sizeof(buffer))); | 364 return path.AppendASCII(base::HexEncode(buffer, sizeof(buffer))); |
366 } | 365 } |
367 | 366 |
368 return path.Append(kDefaultPartitionDirname); | 367 return path.Append(kDefaultPartitionDirname); |
369 } | 368 } |
370 | 369 |
371 StoragePartitionImplMap::StoragePartitionImplMap( | 370 StoragePartitionImplMap::StoragePartitionImplMap( |
372 BrowserContext* browser_context) | 371 BrowserContext* browser_context) |
373 : browser_context_(browser_context), | 372 : browser_context_(browser_context), |
374 resource_context_initialized_(false) { | 373 file_access_runner_(base::CreateSequencedTaskRunnerWithTraits( |
jam
2017/05/18 14:20:14
just to double check: this doesn't create a unique
fdoray
2017/05/18 14:51:24
No, it doesn't create a new thread. I will make th
| |
375 // Doing here instead of initializer list cause it's just too ugly to read. | 374 {base::MayBlock(), base::TaskPriority::BACKGROUND})), |
376 base::SequencedWorkerPool* blocking_pool = BrowserThread::GetBlockingPool(); | 375 resource_context_initialized_(false) {} |
377 file_access_runner_ = | |
378 blocking_pool->GetSequencedTaskRunner(blocking_pool->GetSequenceToken()); | |
379 } | |
380 | 376 |
381 StoragePartitionImplMap::~StoragePartitionImplMap() { | 377 StoragePartitionImplMap::~StoragePartitionImplMap() { |
382 } | 378 } |
383 | 379 |
384 StoragePartitionImpl* StoragePartitionImplMap::Get( | 380 StoragePartitionImpl* StoragePartitionImplMap::Get( |
385 const std::string& partition_domain, | 381 const std::string& partition_domain, |
386 const std::string& partition_name, | 382 const std::string& partition_name, |
387 bool in_memory) { | 383 bool in_memory) { |
388 // Find the previously created partition if it's available. | 384 // Find the previously created partition if it's available. |
389 StoragePartitionConfig partition_config( | 385 StoragePartitionConfig partition_config( |
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
596 | 592 |
597 // We do not call InitializeURLRequestContext() for media contexts because, | 593 // We do not call InitializeURLRequestContext() for media contexts because, |
598 // other than the HTTP cache, the media contexts share the same backing | 594 // other than the HTTP cache, the media contexts share the same backing |
599 // objects as their associated "normal" request context. Thus, the previous | 595 // objects as their associated "normal" request context. Thus, the previous |
600 // call serves to initialize the media request context for this storage | 596 // call serves to initialize the media request context for this storage |
601 // partition as well. | 597 // partition as well. |
602 } | 598 } |
603 } | 599 } |
604 | 600 |
605 } // namespace content | 601 } // namespace content |
OLD | NEW |