| OLD | NEW |
| 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/lib/main/aw_main_delegate.h" | 5 #include "android_webview/lib/main/aw_main_delegate.h" |
| 6 | 6 |
| 7 #include "android_webview/browser/aw_content_browser_client.h" | 7 #include "android_webview/browser/aw_content_browser_client.h" |
| 8 #include "android_webview/browser/browser_view_renderer.h" | 8 #include "android_webview/browser/browser_view_renderer.h" |
| 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" | 9 #include "android_webview/browser/scoped_allow_wait_for_legacy_web_view_api.h" |
| 10 #include "android_webview/common/aw_descriptors.h" | 10 #include "android_webview/common/aw_descriptors.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // here when those files have arch specific names http://crbug.com/455699 | 134 // here when those files have arch specific names http://crbug.com/455699 |
| 135 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( | 135 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( |
| 136 kV8NativesDataDescriptor, kNativesFileName)); | 136 kV8NativesDataDescriptor, kNativesFileName)); |
| 137 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( | 137 CHECK(base::android::RegisterApkAssetWithGlobalDescriptors( |
| 138 kV8SnapshotDataDescriptor, kSnapshotFileName)); | 138 kV8SnapshotDataDescriptor, kSnapshotFileName)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 if (cl->HasSwitch(switches::kWebViewSandboxedRenderer)) { | 141 if (cl->HasSwitch(switches::kWebViewSandboxedRenderer)) { |
| 142 cl->AppendSwitch(switches::kInProcessGPU); | 142 cl->AppendSwitch(switches::kInProcessGPU); |
| 143 cl->AppendSwitchASCII(switches::kRendererProcessLimit, "1"); | 143 cl->AppendSwitchASCII(switches::kRendererProcessLimit, "1"); |
| 144 cl->AppendSwitch(switches::kDisableRendererBackgrounding); |
| 144 } | 145 } |
| 145 | 146 |
| 146 return false; | 147 return false; |
| 147 } | 148 } |
| 148 | 149 |
| 149 void AwMainDelegate::PreSandboxStartup() { | 150 void AwMainDelegate::PreSandboxStartup() { |
| 150 #if defined(ARCH_CPU_ARM_FAMILY) | 151 #if defined(ARCH_CPU_ARM_FAMILY) |
| 151 // Create an instance of the CPU class to parse /proc/cpuinfo and cache | 152 // Create an instance of the CPU class to parse /proc/cpuinfo and cache |
| 152 // cpu_brand info. | 153 // cpu_brand info. |
| 153 base::CPU cpu_info; | 154 base::CPU cpu_info; |
| 154 #endif | 155 #endif |
| 155 | 156 |
| 156 const base::CommandLine& command_line = | 157 const base::CommandLine& command_line = |
| 157 *base::CommandLine::ForCurrentProcess(); | 158 *base::CommandLine::ForCurrentProcess(); |
| 158 std::string process_type = | 159 std::string process_type = |
| 159 command_line.GetSwitchValueASCII(switches::kProcessType); | 160 command_line.GetSwitchValueASCII(switches::kProcessType); |
| 161 int crash_signal_fd = -1; |
| 160 if (process_type == switches::kRendererProcess) { | 162 if (process_type == switches::kRendererProcess) { |
| 161 auto global_descriptors = base::GlobalDescriptors::GetInstance(); | 163 auto global_descriptors = base::GlobalDescriptors::GetInstance(); |
| 162 int pak_fd = global_descriptors->Get(kAndroidWebViewLocalePakDescriptor); | 164 int pak_fd = global_descriptors->Get(kAndroidWebViewLocalePakDescriptor); |
| 163 base::MemoryMappedFile::Region pak_region = | 165 base::MemoryMappedFile::Region pak_region = |
| 164 global_descriptors->GetRegion(kAndroidWebViewLocalePakDescriptor); | 166 global_descriptors->GetRegion(kAndroidWebViewLocalePakDescriptor); |
| 165 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), | 167 ResourceBundle::InitSharedInstanceWithPakFileRegion(base::File(pak_fd), |
| 166 pak_region); | 168 pak_region); |
| 167 pak_fd = global_descriptors->Get(kAndroidWebViewMainPakDescriptor); | 169 pak_fd = global_descriptors->Get(kAndroidWebViewMainPakDescriptor); |
| 168 pak_region = | 170 pak_region = |
| 169 global_descriptors->GetRegion(kAndroidWebViewMainPakDescriptor); | 171 global_descriptors->GetRegion(kAndroidWebViewMainPakDescriptor); |
| 170 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( | 172 ResourceBundle::GetSharedInstance().AddDataPackFromFileRegion( |
| 171 base::File(pak_fd), pak_region, ui::SCALE_FACTOR_NONE); | 173 base::File(pak_fd), pak_region, ui::SCALE_FACTOR_NONE); |
| 174 crash_signal_fd = |
| 175 global_descriptors->Get(kAndroidWebViewCrashSignalDescriptor); |
| 172 } | 176 } |
| 173 if (process_type.empty() && | 177 if (process_type.empty() && |
| 174 command_line.HasSwitch(switches::kSingleProcess)) { | 178 command_line.HasSwitch(switches::kSingleProcess)) { |
| 175 // "webview" has a special treatment in breakpad_linux.cc. | 179 // "webview" has a special treatment in breakpad_linux.cc. |
| 176 process_type = "webview"; | 180 process_type = "webview"; |
| 177 } | 181 } |
| 178 | 182 |
| 179 crash_reporter::EnableMicrodumpCrashReporter(process_type); | 183 crash_reporter::EnableMicrodumpCrashReporter(process_type, crash_signal_fd); |
| 180 } | 184 } |
| 181 | 185 |
| 182 int AwMainDelegate::RunProcess( | 186 int AwMainDelegate::RunProcess( |
| 183 const std::string& process_type, | 187 const std::string& process_type, |
| 184 const content::MainFunctionParams& main_function_params) { | 188 const content::MainFunctionParams& main_function_params) { |
| 185 if (process_type.empty()) { | 189 if (process_type.empty()) { |
| 186 AwBrowserDependencyFactoryImpl::InstallInstance(); | 190 AwBrowserDependencyFactoryImpl::InstallInstance(); |
| 187 | 191 |
| 188 browser_runner_.reset(content::BrowserMainRunner::Create()); | 192 browser_runner_.reset(content::BrowserMainRunner::Create()); |
| 189 int exit_code = browser_runner_->Initialize(main_function_params); | 193 int exit_code = browser_runner_->Initialize(main_function_params); |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 #if defined(VIDEO_HOLE) | 253 #if defined(VIDEO_HOLE) |
| 250 content::ExternalVideoSurfaceContainer* | 254 content::ExternalVideoSurfaceContainer* |
| 251 AwMainDelegate::CreateExternalVideoSurfaceContainer( | 255 AwMainDelegate::CreateExternalVideoSurfaceContainer( |
| 252 content::WebContents* web_contents) { | 256 content::WebContents* web_contents) { |
| 253 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( | 257 return external_video_surface::ExternalVideoSurfaceContainerImpl::Create( |
| 254 web_contents); | 258 web_contents); |
| 255 } | 259 } |
| 256 #endif | 260 #endif |
| 257 | 261 |
| 258 } // namespace android_webview | 262 } // namespace android_webview |
| OLD | NEW |