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/public/browser/browser_context.h" | 5 #include "content/public/browser/browser_context.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
11 #include <limits> | 11 #include <limits> |
12 #include <memory> | 12 #include <memory> |
13 #include <utility> | 13 #include <utility> |
14 #include <vector> | 14 #include <vector> |
15 | 15 |
16 #include "base/base64.h" | 16 #include "base/base64.h" |
17 #include "base/command_line.h" | 17 #include "base/command_line.h" |
18 #include "base/guid.h" | 18 #include "base/guid.h" |
19 #include "base/lazy_instance.h" | 19 #include "base/lazy_instance.h" |
20 #include "base/logging.h" | 20 #include "base/logging.h" |
21 #include "base/macros.h" | 21 #include "base/macros.h" |
22 #include "base/memory/ptr_util.h" | 22 #include "base/memory/ptr_util.h" |
23 #include "base/rand_util.h" | 23 #include "base/rand_util.h" |
24 #include "base/task_scheduler/post_task.h" | |
24 #include "base/threading/thread_task_runner_handle.h" | 25 #include "base/threading/thread_task_runner_handle.h" |
25 #include "build/build_config.h" | 26 #include "build/build_config.h" |
26 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 27 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
27 #include "content/browser/browsing_data/browsing_data_remover_impl.h" | 28 #include "content/browser/browsing_data/browsing_data_remover_impl.h" |
28 #include "content/browser/download/download_manager_impl.h" | 29 #include "content/browser/download/download_manager_impl.h" |
29 #include "content/browser/indexed_db/indexed_db_context_impl.h" | 30 #include "content/browser/indexed_db/indexed_db_context_impl.h" |
30 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 31 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
31 #include "content/browser/push_messaging/push_messaging_router.h" | 32 #include "content/browser/push_messaging/push_messaging_router.h" |
32 #include "content/browser/storage_partition_impl_map.h" | 33 #include "content/browser/storage_partition_impl_map.h" |
33 #include "content/common/child_process_host_impl.h" | 34 #include "content/common/child_process_host_impl.h" |
(...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
473 base::WrapUnique(connection_holder)); | 474 base::WrapUnique(connection_holder)); |
474 | 475 |
475 ServiceManagerConnection* connection = | 476 ServiceManagerConnection* connection = |
476 connection_holder->service_manager_connection(); | 477 connection_holder->service_manager_connection(); |
477 | 478 |
478 // New embedded service factories should be added to |connection| here. | 479 // New embedded service factories should be added to |connection| here. |
479 | 480 |
480 if (base::CommandLine::ForCurrentProcess()->HasSwitch( | 481 if (base::CommandLine::ForCurrentProcess()->HasSwitch( |
481 switches::kMojoLocalStorage)) { | 482 switches::kMojoLocalStorage)) { |
482 ServiceInfo info; | 483 ServiceInfo info; |
484 // TODO(mek): Use sequenced task runner rather than single thread task | |
485 // runner when mojo supports that (http://crbug.com/678155). | |
483 info.factory = | 486 info.factory = |
484 base::Bind(&file::CreateFileService, | 487 base::Bind(&file::CreateFileService, |
485 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), | 488 base::CreateSingleThreadTaskRunnerWithTraits( |
489 base::TaskTraits() | |
gab
2017/05/08 17:14:32
See brand new way to specify TaskTraits as a bag i
Marijn Kruisselbrink
2017/05/08 18:18:01
Ah, nice. Done. The sample code in post_task.h sho
gab
2017/05/08 19:25:14
Ah oops looks like we forgot to update that, will
| |
490 .MayBlock() | |
491 .WithBaseSyncPrimitives() | |
gab
2017/05/08 17:14:32
Do you really need WithBaseSyncPrimitives()? (see
Marijn Kruisselbrink
2017/05/08 18:18:01
Ah yes, it indeed seems that to signal on a waitab
| |
492 .WithShutdownBehavior( | |
493 base::TaskShutdownBehavior::BLOCK_SHUTDOWN)), | |
486 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); | 494 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); |
487 connection->AddEmbeddedService(file::mojom::kServiceName, info); | 495 connection->AddEmbeddedService(file::mojom::kServiceName, info); |
488 } | 496 } |
489 | 497 |
490 ContentBrowserClient::StaticServiceMap services; | 498 ContentBrowserClient::StaticServiceMap services; |
491 browser_context->RegisterInProcessServices(&services); | 499 browser_context->RegisterInProcessServices(&services); |
492 for (const auto& entry : services) { | 500 for (const auto& entry : services) { |
493 connection->AddEmbeddedService(entry.first, entry.second); | 501 connection->AddEmbeddedService(entry.first, entry.second); |
494 } | 502 } |
495 connection->Start(); | 503 connection->Start(); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
565 base::Base64Encode(base::RandBytesAsString(16), &salt); | 573 base::Base64Encode(base::RandBytesAsString(16), &salt); |
566 DCHECK(!salt.empty()); | 574 DCHECK(!salt.empty()); |
567 return salt; | 575 return salt; |
568 } | 576 } |
569 | 577 |
570 BrowsingDataRemoverDelegate* BrowserContext::GetBrowsingDataRemoverDelegate() { | 578 BrowsingDataRemoverDelegate* BrowserContext::GetBrowsingDataRemoverDelegate() { |
571 return nullptr; | 579 return nullptr; |
572 } | 580 } |
573 | 581 |
574 } // namespace content | 582 } // namespace content |
OLD | NEW |