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

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: temporary change to show problem with task scheduler shutdown 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
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/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 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
472 base::WrapUnique(connection_holder)); 473 base::WrapUnique(connection_holder));
473 474
474 ServiceManagerConnection* connection = 475 ServiceManagerConnection* connection =
475 connection_holder->service_manager_connection(); 476 connection_holder->service_manager_connection();
476 477
477 // New embedded service factories should be added to |connection| here. 478 // New embedded service factories should be added to |connection| here.
478 479
479 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 480 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
480 switches::kMojoLocalStorage)) { 481 switches::kMojoLocalStorage)) {
481 ServiceInfo info; 482 ServiceInfo info;
483 // TODO(mek): Use sequenced task runner rather than single thread task
484 // runner when mojo supports that.
gab 2017/05/03 20:18:57 Add http://crbug.com/678155 for ease of searching.
482 info.factory = 485 info.factory =
483 base::Bind(&file::CreateFileService, 486 base::Bind(&file::CreateFileService,
484 BrowserThread::GetTaskRunnerForThread(BrowserThread::FILE), 487 base::CreateSingleThreadTaskRunnerWithTraits(
488 base::TaskTraits()
489 .MayBlock()
490 .WithBaseSyncPrimitives()
491 .WithShutdownBehavior(
492 base::TaskShutdownBehavior::BLOCK_SHUTDOWN)),
485 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB)); 493 BrowserThread::GetTaskRunnerForThread(BrowserThread::DB));
486 connection->AddEmbeddedService(file::mojom::kServiceName, info); 494 connection->AddEmbeddedService(file::mojom::kServiceName, info);
487 } 495 }
488 496
489 ContentBrowserClient::StaticServiceMap services; 497 ContentBrowserClient::StaticServiceMap services;
490 browser_context->RegisterInProcessServices(&services); 498 browser_context->RegisterInProcessServices(&services);
491 for (const auto& entry : services) { 499 for (const auto& entry : services) {
492 connection->AddEmbeddedService(entry.first, entry.second); 500 connection->AddEmbeddedService(entry.first, entry.second);
493 } 501 }
494 connection->Start(); 502 connection->Start();
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
564 base::Base64Encode(base::RandBytesAsString(16), &salt); 572 base::Base64Encode(base::RandBytesAsString(16), &salt);
565 DCHECK(!salt.empty()); 573 DCHECK(!salt.empty());
566 return salt; 574 return salt;
567 } 575 }
568 576
569 BrowsingDataRemoverDelegate* BrowserContext::GetBrowsingDataRemoverDelegate() { 577 BrowsingDataRemoverDelegate* BrowserContext::GetBrowsingDataRemoverDelegate() {
570 return nullptr; 578 return nullptr;
571 } 579 }
572 580
573 } // namespace content 581 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_service_test_base.cc ('k') | content/browser/dom_storage/dom_storage_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698