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

Side by Side Diff: content/shell/browser/shell_browser_main_parts.cc

Issue 2393853002: Refactor CrashDump*Manager to use a shared CrashDumpObserver singleton. (Closed)
Patch Set: fix initialization in ShellBrowserMainParts Created 4 years, 2 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/shell/browser/shell_browser_main_parts.h" 5 #include "content/shell/browser/shell_browser_main_parts.h"
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
11 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
12 #include "base/threading/thread.h" 12 #include "base/threading/thread.h"
13 #include "base/threading/thread_restrictions.h" 13 #include "base/threading/thread_restrictions.h"
14 #include "build/build_config.h" 14 #include "build/build_config.h"
15 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/devtools_agent_host.h" 16 #include "content/public/browser/devtools_agent_host.h"
17 #include "content/public/browser/storage_partition.h" 17 #include "content/public/browser/storage_partition.h"
18 #include "content/public/common/content_switches.h" 18 #include "content/public/common/content_switches.h"
19 #include "content/public/common/main_function_params.h" 19 #include "content/public/common/main_function_params.h"
20 #include "content/public/common/url_constants.h" 20 #include "content/public/common/url_constants.h"
21 #include "content/shell/android/shell_descriptors.h"
21 #include "content/shell/browser/shell.h" 22 #include "content/shell/browser/shell.h"
22 #include "content/shell/browser/shell_access_token_store.h" 23 #include "content/shell/browser/shell_access_token_store.h"
23 #include "content/shell/browser/shell_browser_context.h" 24 #include "content/shell/browser/shell_browser_context.h"
24 #include "content/shell/browser/shell_devtools_manager_delegate.h" 25 #include "content/shell/browser/shell_devtools_manager_delegate.h"
25 #include "content/shell/browser/shell_net_log.h" 26 #include "content/shell/browser/shell_net_log.h"
26 #include "content/shell/common/shell_switches.h" 27 #include "content/shell/common/shell_switches.h"
27 #include "device/bluetooth/bluetooth_adapter_factory.h" 28 #include "device/bluetooth/bluetooth_adapter_factory.h"
28 #include "device/geolocation/geolocation_delegate.h" 29 #include "device/geolocation/geolocation_delegate.h"
29 #include "device/geolocation/geolocation_provider.h" 30 #include "device/geolocation/geolocation_provider.h"
30 #include "net/base/filename_util.h" 31 #include "net/base/filename_util.h"
31 #include "net/base/net_module.h" 32 #include "net/base/net_module.h"
32 #include "net/grit/net_resources.h" 33 #include "net/grit/net_resources.h"
33 #include "ui/base/material_design/material_design_controller.h" 34 #include "ui/base/material_design/material_design_controller.h"
34 #include "ui/base/resource/resource_bundle.h" 35 #include "ui/base/resource/resource_bundle.h"
35 #include "url/gurl.h" 36 #include "url/gurl.h"
36 37
37 #if defined(OS_ANDROID) 38 #if defined(OS_ANDROID)
38 #include "base/message_loop/message_loop.h" 39 #include "base/message_loop/message_loop.h"
39 #include "components/crash/content/browser/crash_dump_manager_android.h" 40 #include "components/crash/content/browser/crash_dump_manager_android.h"
41 #include "components/crash/content/browser/crash_dump_observer_android.h"
40 #include "net/android/network_change_notifier_factory_android.h" 42 #include "net/android/network_change_notifier_factory_android.h"
41 #include "net/base/network_change_notifier.h" 43 #include "net/base/network_change_notifier.h"
42 #endif 44 #endif
43 45
44 #if defined(USE_AURA) && defined(USE_X11) 46 #if defined(USE_AURA) && defined(USE_X11)
45 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck 47 #include "ui/events/devices/x11/touch_factory_x11.h" // nogncheck
46 #endif 48 #endif
47 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX) 49 #if !defined(OS_CHROMEOS) && defined(USE_AURA) && defined(OS_LINUX)
48 #include "ui/base/ime/input_method_initializer.h" 50 #include "ui/base/ime/input_method_initializer.h"
49 #endif 51 #endif
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 109
108 } // namespace 110 } // namespace
109 111
110 ShellBrowserMainParts::ShellBrowserMainParts( 112 ShellBrowserMainParts::ShellBrowserMainParts(
111 const MainFunctionParams& parameters) 113 const MainFunctionParams& parameters)
112 : parameters_(parameters), 114 : parameters_(parameters),
113 run_message_loop_(true) { 115 run_message_loop_(true) {
114 } 116 }
115 117
116 ShellBrowserMainParts::~ShellBrowserMainParts() { 118 ShellBrowserMainParts::~ShellBrowserMainParts() {
119 #if defined(OS_ANDROID)
120 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient(
121 crash_dump_manager_);
122 #endif
117 } 123 }
118 124
119 #if !defined(OS_MACOSX) 125 #if !defined(OS_MACOSX)
120 void ShellBrowserMainParts::PreMainMessageLoopStart() { 126 void ShellBrowserMainParts::PreMainMessageLoopStart() {
121 #if defined(USE_AURA) && defined(USE_X11) 127 #if defined(USE_AURA) && defined(USE_X11)
122 ui::TouchFactory::SetTouchDeviceListFromCommandLine(); 128 ui::TouchFactory::SetTouchDeviceListFromCommandLine();
123 #endif 129 #endif
124 } 130 }
125 #endif 131 #endif
126 132
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 void ShellBrowserMainParts::InitializeMessageLoopContext() { 164 void ShellBrowserMainParts::InitializeMessageLoopContext() {
159 ui::MaterialDesignController::Initialize(); 165 ui::MaterialDesignController::Initialize();
160 Shell::CreateNewWindow(browser_context_.get(), 166 Shell::CreateNewWindow(browser_context_.get(),
161 GetStartupURL(), 167 GetStartupURL(),
162 NULL, 168 NULL,
163 gfx::Size()); 169 gfx::Size());
164 } 170 }
165 171
166 #if defined(OS_ANDROID) 172 #if defined(OS_ANDROID)
167 int ShellBrowserMainParts::PreCreateThreads() { 173 int ShellBrowserMainParts::PreCreateThreads() {
174 breakpad::CrashDumpObserver::Create();
168 if (base::CommandLine::ForCurrentProcess()->HasSwitch( 175 if (base::CommandLine::ForCurrentProcess()->HasSwitch(
169 switches::kEnableCrashReporter)) { 176 switches::kEnableCrashReporter)) {
170 base::FilePath crash_dumps_dir = 177 base::FilePath crash_dumps_dir =
171 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath( 178 base::CommandLine::ForCurrentProcess()->GetSwitchValuePath(
172 switches::kCrashDumpsDir); 179 switches::kCrashDumpsDir);
173 crash_dump_manager_.reset(new breakpad::CrashDumpManager(crash_dumps_dir)); 180 breakpad::CrashDumpObserver::GetInstance()->RegisterClient(
181 crash_dump_manager_ = new breakpad::CrashDumpManager(
boliu 2016/10/13 21:07:19 ditto
Tobias Sargeant 2016/12/08 16:41:42 Done.
182 crash_dumps_dir, kAndroidMinidumpDescriptor));
174 } 183 }
175 184
176 return 0; 185 return 0;
177 } 186 }
178 #endif 187 #endif
179 188
180 void ShellBrowserMainParts::PreMainMessageLoopRun() { 189 void ShellBrowserMainParts::PreMainMessageLoopRun() {
181 net_log_.reset(new ShellNetLog("content_shell")); 190 net_log_.reset(new ShellNetLog("content_shell"));
182 InitializeBrowserContexts(); 191 InitializeBrowserContexts();
183 device::GeolocationProvider::SetGeolocationDelegate( 192 device::GeolocationProvider::SetGeolocationDelegate(
(...skipping 25 matching lines...) Expand all
209 device::BluetoothAdapterFactory::Shutdown(); 218 device::BluetoothAdapterFactory::Shutdown();
210 bluez::BluezDBusManager::Shutdown(); 219 bluez::BluezDBusManager::Shutdown();
211 chromeos::DBusThreadManager::Shutdown(); 220 chromeos::DBusThreadManager::Shutdown();
212 #elif defined(OS_LINUX) 221 #elif defined(OS_LINUX)
213 device::BluetoothAdapterFactory::Shutdown(); 222 device::BluetoothAdapterFactory::Shutdown();
214 bluez::DBusBluezManagerWrapperLinux::Shutdown(); 223 bluez::DBusBluezManagerWrapperLinux::Shutdown();
215 #endif 224 #endif
216 } 225 }
217 226
218 } // namespace 227 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698