Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1251)

Side by Side Diff: content/browser/browser_context.cc

Issue 2852333004: Fix possible deadlock during shutdown by not using the FILE thread. (Closed)
Patch Set: use new way of specifying task traits Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/service_manager/common_browser_interfaces.h" 33 #include "content/browser/service_manager/common_browser_interfaces.h"
33 #include "content/browser/storage_partition_impl_map.h" 34 #include "content/browser/storage_partition_impl_map.h"
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
474 base::WrapUnique(connection_holder)); 475 base::WrapUnique(connection_holder));
475 476
476 ServiceManagerConnection* connection = 477 ServiceManagerConnection* connection =
477 connection_holder->service_manager_connection(); 478 connection_holder->service_manager_connection();
478 479
479 // New embedded service factories should be added to |connection| here. 480 // New embedded service factories should be added to |connection| here.
480 481
481 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 482 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
482 switches::kMojoLocalStorage)) { 483 switches::kMojoLocalStorage)) {
483 ServiceInfo info; 484 ServiceInfo info;
484 info.factory = 485 // TODO(mek): Use sequenced task runner rather than single thread task
485 base::Bind(&file::CreateFileService, 486 // runner when mojo supports that (http://crbug.com/678155).
486 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 487 info.factory = base::Bind(
487 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 488 &file::CreateFileService,
489 base::CreateSingleThreadTaskRunnerWithTraits(
490 {base::MayBlock(), base::TaskShutdownBehavior::BLOCK_SHUTDOWN}),
491 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
488 connection->AddEmbeddedService(file::mojom::kServiceName, info); 492 connection->AddEmbeddedService(file::mojom::kServiceName, info);
489 } 493 }
490 494
491 ContentBrowserClient::StaticServiceMap services; 495 ContentBrowserClient::StaticServiceMap services;
492 browser_context->RegisterInProcessServices(&services); 496 browser_context->RegisterInProcessServices(&services);
493 for (const auto& entry : services) { 497 for (const auto& entry : services) {
494 connection->AddEmbeddedService(entry.first, entry.second); 498 connection->AddEmbeddedService(entry.first, entry.second);
495 } 499 }
496 500
497 RegisterCommonBrowserInterfaces(connection); 501 RegisterCommonBrowserInterfaces(connection);
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
568 base::Base64Encode(base::RandBytesAsString(16), &salt); 572 base::Base64Encode(base::RandBytesAsString(16), &salt);
569 DCHECK(!salt.empty()); 573 DCHECK(!salt.empty());
570 return salt; 574 return salt;
571 } 575 }
572 576
573 BrowsingDataRemoverDelegate* BrowserContext::GetBrowsingDataRemoverDelegate() { 577 BrowsingDataRemoverDelegate* BrowserContext::GetBrowsingDataRemoverDelegate() {
574 return nullptr; 578 return nullptr;
575 } 579 }
576 580
577 } // namespace content 581 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/dom_storage/dom_storage_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698