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

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

Issue 2112683002: Null-check ThreadTaskRunnerHandle::Get() before doing Connect() in BC::Init() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | no next file » | 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 #include <algorithm> 9 #include <algorithm>
10 #include <limits> 10 #include <limits>
11 #include <memory> 11 #include <memory>
12 #include <utility> 12 #include <utility>
13 #include <vector> 13 #include <vector>
14 14
15 #include "base/command_line.h" 15 #include "base/command_line.h"
16 #include "base/guid.h" 16 #include "base/guid.h"
17 #include "base/lazy_instance.h" 17 #include "base/lazy_instance.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "base/rand_util.h" 19 #include "base/rand_util.h"
20 #include "base/threading/thread_task_runner_handle.h"
20 #include "build/build_config.h" 21 #include "build/build_config.h"
21 #include "content/browser/blob_storage/chrome_blob_storage_context.h" 22 #include "content/browser/blob_storage/chrome_blob_storage_context.h"
22 #include "content/browser/download/download_manager_impl.h" 23 #include "content/browser/download/download_manager_impl.h"
23 #include "content/browser/indexed_db/indexed_db_context_impl.h" 24 #include "content/browser/indexed_db/indexed_db_context_impl.h"
24 #include "content/browser/loader/resource_dispatcher_host_impl.h" 25 #include "content/browser/loader/resource_dispatcher_host_impl.h"
25 #include "content/browser/mojo/constants.h" 26 #include "content/browser/mojo/constants.h"
26 #include "content/browser/push_messaging/push_messaging_router.h" 27 #include "content/browser/push_messaging/push_messaging_router.h"
27 #include "content/browser/storage_partition_impl_map.h" 28 #include "content/browser/storage_partition_impl_map.h"
28 #include "content/common/child_process_host_impl.h" 29 #include "content/common/child_process_host_impl.h"
29 #include "content/public/browser/blob_handle.h" 30 #include "content/public/browser/blob_handle.h"
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
404 user_service::AssociateShellUserIdWithUserDir(new_id, path); 405 user_service::AssociateShellUserIdWithUserDir(new_id, path);
405 RemoveBrowserContextFromUserIdMap(browser_context); 406 RemoveBrowserContextFromUserIdMap(browser_context);
406 g_user_id_to_context.Get()[new_id] = browser_context; 407 g_user_id_to_context.Get()[new_id] = browser_context;
407 browser_context->SetUserData(kMojoShellUserId, 408 browser_context->SetUserData(kMojoShellUserId,
408 new ShellUserIdHolder(new_id)); 409 new ShellUserIdHolder(new_id));
409 410
410 browser_context->SetUserData(kMojoWasInitialized, 411 browser_context->SetUserData(kMojoWasInitialized,
411 new base::SupportsUserData::Data); 412 new base::SupportsUserData::Data);
412 413
413 MojoShellConnection* shell = MojoShellConnection::GetForProcess(); 414 MojoShellConnection* shell = MojoShellConnection::GetForProcess();
414 if (shell) { 415 if (shell && base::ThreadTaskRunnerHandle::Get()) {
415 // NOTE: Many unit tests create a TestBrowserContext without initializing 416 // NOTE: Many unit tests create a TestBrowserContext without initializing
416 // Mojo or the global Mojo shell connection. 417 // Mojo or the global Mojo shell connection.
417 418
418 shell::mojom::ShellClientPtr shell_client; 419 shell::mojom::ShellClientPtr shell_client;
419 shell::mojom::ShellClientRequest shell_client_request = 420 shell::mojom::ShellClientRequest shell_client_request =
420 mojo::GetProxy(&shell_client); 421 mojo::GetProxy(&shell_client);
421 422
422 shell::mojom::PIDReceiverPtr pid_receiver; 423 shell::mojom::PIDReceiverPtr pid_receiver;
423 shell::Connector::ConnectParams params( 424 shell::Connector::ConnectParams params(
424 shell::Identity(kBrowserMojoApplicationName, new_id)); 425 shell::Identity(kBrowserMojoApplicationName, new_id));
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 << "Attempting to destroy a BrowserContext that never called " 484 << "Attempting to destroy a BrowserContext that never called "
484 << "Initialize()"; 485 << "Initialize()";
485 486
486 RemoveBrowserContextFromUserIdMap(this); 487 RemoveBrowserContextFromUserIdMap(this);
487 488
488 if (GetUserData(kDownloadManagerKeyName)) 489 if (GetUserData(kDownloadManagerKeyName))
489 GetDownloadManager(this)->Shutdown(); 490 GetDownloadManager(this)->Shutdown();
490 } 491 }
491 492
492 } // namespace content 493 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698