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

Side by Side Diff: android_webview/browser/aw_browser_main_parts.cc

Issue 2303153002: Revert "Refactor CrashDump*Manager to use a shared CrashDumpObserver singleton." (Closed)
Patch Set: Created 4 years, 3 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 "android_webview/browser/aw_browser_main_parts.h" 5 #include "android_webview/browser/aw_browser_main_parts.h"
6 6
7 #include "android_webview/browser/aw_browser_context.h" 7 #include "android_webview/browser/aw_browser_context.h"
8 #include "android_webview/browser/aw_browser_terminator.h"
9 #include "android_webview/browser/aw_content_browser_client.h" 8 #include "android_webview/browser/aw_content_browser_client.h"
10 #include "android_webview/browser/aw_dev_tools_discovery_provider.h" 9 #include "android_webview/browser/aw_dev_tools_discovery_provider.h"
11 #include "android_webview/browser/aw_result_codes.h" 10 #include "android_webview/browser/aw_result_codes.h"
12 #include "android_webview/browser/deferred_gpu_command_service.h" 11 #include "android_webview/browser/deferred_gpu_command_service.h"
13 #include "android_webview/browser/net/aw_network_change_notifier_factory.h" 12 #include "android_webview/browser/net/aw_network_change_notifier_factory.h"
14 #include "android_webview/common/aw_resource.h" 13 #include "android_webview/common/aw_resource.h"
15 #include "android_webview/common/aw_switches.h" 14 #include "android_webview/common/aw_switches.h"
16 #include "base/android/apk_assets.h" 15 #include "base/android/apk_assets.h"
17 #include "base/android/build_info.h" 16 #include "base/android/build_info.h"
18 #include "base/android/locale_utils.h" 17 #include "base/android/locale_utils.h"
19 #include "base/android/memory_pressure_listener_android.h" 18 #include "base/android/memory_pressure_listener_android.h"
20 #include "base/command_line.h" 19 #include "base/command_line.h"
21 #include "base/files/file_path.h" 20 #include "base/files/file_path.h"
22 #include "base/i18n/rtl.h" 21 #include "base/i18n/rtl.h"
23 #include "base/path_service.h" 22 #include "base/path_service.h"
24 #include "components/crash/content/browser/crash_dump_observer_android.h" 23 #include "components/crash/content/browser/crash_micro_dump_manager_android.h"
25 #include "content/public/browser/android/synchronous_compositor.h" 24 #include "content/public/browser/android/synchronous_compositor.h"
26 #include "content/public/browser/render_frame_host.h" 25 #include "content/public/browser/render_frame_host.h"
27 #include "content/public/browser/render_process_host.h" 26 #include "content/public/browser/render_process_host.h"
28 #include "content/public/common/content_client.h" 27 #include "content/public/common/content_client.h"
29 #include "content/public/common/content_switches.h" 28 #include "content/public/common/content_switches.h"
30 #include "content/public/common/result_codes.h" 29 #include "content/public/common/result_codes.h"
31 #include "device/geolocation/access_token_store.h" 30 #include "device/geolocation/access_token_store.h"
32 #include "device/geolocation/geolocation_delegate.h" 31 #include "device/geolocation/geolocation_delegate.h"
33 #include "device/geolocation/geolocation_provider.h" 32 #include "device/geolocation/geolocation_provider.h"
34 #include "net/android/network_change_notifier_factory_android.h" 33 #include "net/android/network_change_notifier_factory_android.h"
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 DISALLOW_COPY_AND_ASSIGN(AwGeolocationDelegate); 75 DISALLOW_COPY_AND_ASSIGN(AwGeolocationDelegate);
77 }; 76 };
78 77
79 } // anonymous namespace 78 } // anonymous namespace
80 79
81 AwBrowserMainParts::AwBrowserMainParts(AwContentBrowserClient* browser_client) 80 AwBrowserMainParts::AwBrowserMainParts(AwContentBrowserClient* browser_client)
82 : browser_client_(browser_client) { 81 : browser_client_(browser_client) {
83 } 82 }
84 83
85 AwBrowserMainParts::~AwBrowserMainParts() { 84 AwBrowserMainParts::~AwBrowserMainParts() {
86 breakpad::CrashDumpObserver::GetInstance()->UnregisterClient(
87 aw_browser_terminator_.get());
88 } 85 }
89 86
90 void AwBrowserMainParts::PreEarlyInitialization() { 87 void AwBrowserMainParts::PreEarlyInitialization() {
91 net::NetworkChangeNotifier::SetFactory(new AwNetworkChangeNotifierFactory()); 88 net::NetworkChangeNotifier::SetFactory(new AwNetworkChangeNotifierFactory());
92 89
93 // Android WebView does not use default MessageLoop. It has its own 90 // Android WebView does not use default MessageLoop. It has its own
94 // Android specific MessageLoop. Also see MainMessageLoopRun. 91 // Android specific MessageLoop. Also see MainMessageLoopRun.
95 DCHECK(!main_message_loop_.get()); 92 DCHECK(!main_message_loop_.get());
96 main_message_loop_.reset(new base::MessageLoopForUI); 93 main_message_loop_.reset(new base::MessageLoopForUI);
97 base::MessageLoopForUI::current()->Start(); 94 base::MessageLoopForUI::current()->Start();
(...skipping 17 matching lines...) Expand all
115 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path); 112 PathService::Get(ui::DIR_RESOURCE_PAKS_ANDROID, &pak_file_path);
116 pak_file_path = pak_file_path.AppendASCII("resources.pak"); 113 pak_file_path = pak_file_path.AppendASCII("resources.pak");
117 ui::LoadMainAndroidPackFile("assets/resources.pak", pak_file_path); 114 ui::LoadMainAndroidPackFile("assets/resources.pak", pak_file_path);
118 115
119 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback( 116 base::android::MemoryPressureListenerAndroid::RegisterSystemCallback(
120 base::android::AttachCurrentThread()); 117 base::android::AttachCurrentThread());
121 DeferredGpuCommandService::SetInstance(); 118 DeferredGpuCommandService::SetInstance();
122 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 119 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
123 switches::kSingleProcess)) { 120 switches::kSingleProcess)) {
124 // Create the renderers crash manager on the UI thread. 121 // Create the renderers crash manager on the UI thread.
125 aw_browser_terminator_ = base::MakeUnique<AwBrowserTerminator>(); 122 breakpad::CrashMicroDumpManager::GetInstance();
126 breakpad::CrashDumpObserver::GetInstance()->RegisterClient(
127 aw_browser_terminator_.get());
128 } 123 }
129 124
130 return content::RESULT_CODE_NORMAL_EXIT; 125 return content::RESULT_CODE_NORMAL_EXIT;
131 } 126 }
132 127
133 void AwBrowserMainParts::PreMainMessageLoopRun() { 128 void AwBrowserMainParts::PreMainMessageLoopRun() {
134 browser_client_->InitBrowserContext()->PreMainMessageLoopRun(); 129 browser_client_->InitBrowserContext()->PreMainMessageLoopRun();
135 130
136 device::GeolocationProvider::SetGeolocationDelegate( 131 device::GeolocationProvider::SetGeolocationDelegate(
137 new AwGeolocationDelegate()); 132 new AwGeolocationDelegate());
138 133
139 AwDevToolsDiscoveryProvider::Install(); 134 AwDevToolsDiscoveryProvider::Install();
140 135
141 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView(); 136 content::RenderFrameHost::AllowInjectingJavaScriptForAndroidWebView();
142 } 137 }
143 138
144 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) { 139 bool AwBrowserMainParts::MainMessageLoopRun(int* result_code) {
145 // Android WebView does not use default MessageLoop. It has its own 140 // Android WebView does not use default MessageLoop. It has its own
146 // Android specific MessageLoop. 141 // Android specific MessageLoop.
147 return true; 142 return true;
148 } 143 }
149 144
150 } // namespace android_webview 145 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/browser/aw_browser_main_parts.h ('k') | android_webview/browser/aw_browser_terminator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698