OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/zygote_host/zygote_communication_linux.h" | 5 #include "content/browser/zygote_host/zygote_communication_linux.h" |
6 | 6 |
7 #include <string.h> | 7 #include <string.h> |
8 #include <sys/socket.h> | 8 #include <sys/socket.h> |
9 | 9 |
10 #include "base/base_switches.h" | 10 #include "base/base_switches.h" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/metrics/sparse_histogram.h" | 14 #include "base/metrics/sparse_histogram.h" |
15 #include "base/path_service.h" | 15 #include "base/path_service.h" |
16 #include "base/pickle.h" | 16 #include "base/pickle.h" |
17 #include "base/posix/eintr_wrapper.h" | 17 #include "base/posix/eintr_wrapper.h" |
18 #include "base/posix/unix_domain_socket_linux.h" | 18 #include "base/posix/unix_domain_socket_linux.h" |
19 #include "content/browser/zygote_host/zygote_host_impl_linux.h" | 19 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
20 #include "content/common/zygote_commands_linux.h" | 20 #include "content/common/zygote_commands_linux.h" |
21 #include "content/public/browser/content_browser_client.h" | 21 #include "content/public/browser/content_browser_client.h" |
22 #include "content/public/common/content_client.h" | 22 #include "content/public/common/content_client.h" |
23 #include "content/public/common/content_switches.h" | 23 #include "content/public/common/content_switches.h" |
24 #include "content/public/common/result_codes.h" | 24 #include "content/public/common/result_codes.h" |
| 25 #include "media/base/media_switches.h" |
25 #include "ui/display/display_switches.h" | 26 #include "ui/display/display_switches.h" |
26 #include "ui/gfx/switches.h" | 27 #include "ui/gfx/switches.h" |
27 | 28 |
28 namespace content { | 29 namespace content { |
29 | 30 |
30 ZygoteCommunication::ZygoteCommunication() | 31 ZygoteCommunication::ZygoteCommunication() |
31 : control_fd_(), | 32 : control_fd_(), |
32 control_lock_(), | 33 control_lock_(), |
33 pid_(), | 34 pid_(), |
34 list_of_running_zygote_children_(), | 35 list_of_running_zygote_children_(), |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 *base::CommandLine::ForCurrentProcess(); | 244 *base::CommandLine::ForCurrentProcess(); |
244 if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) { | 245 if (browser_command_line.HasSwitch(switches::kZygoteCmdPrefix)) { |
245 cmd_line.PrependWrapper( | 246 cmd_line.PrependWrapper( |
246 browser_command_line.GetSwitchValueNative(switches::kZygoteCmdPrefix)); | 247 browser_command_line.GetSwitchValueNative(switches::kZygoteCmdPrefix)); |
247 } | 248 } |
248 // Append any switches from the browser process that need to be forwarded on | 249 // Append any switches from the browser process that need to be forwarded on |
249 // to the zygote/renderers. | 250 // to the zygote/renderers. |
250 // Should this list be obtained from browser_render_process_host.cc? | 251 // Should this list be obtained from browser_render_process_host.cc? |
251 static const char* const kForwardSwitches[] = { | 252 static const char* const kForwardSwitches[] = { |
252 switches::kAllowSandboxDebugging, switches::kAndroidFontsPath, | 253 switches::kAllowSandboxDebugging, switches::kAndroidFontsPath, |
253 switches::kDisableSeccompFilterSandbox, | 254 switches::kDisableSeccompFilterSandbox, switches::kEnableHeapProfiling, |
254 switches::kEnableHeapProfiling, | |
255 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. | 255 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. |
256 // Need to tell the zygote that it is headless so that we don't try to use | 256 // Need to tell the zygote that it is headless so that we don't try to use |
257 // the wrong type of main delegate. | 257 // the wrong type of main delegate. |
258 switches::kHeadless, | 258 switches::kHeadless, |
259 // Zygote process needs to know what resources to have loaded when it | 259 // Zygote process needs to know what resources to have loaded when it |
260 // becomes a renderer process. | 260 // becomes a renderer process. |
261 switches::kForceDeviceScaleFactor, switches::kLoggingLevel, | 261 switches::kForceDeviceScaleFactor, switches::kLoggingLevel, |
262 switches::kNoSandbox, switches::kPpapiInProcess, | 262 switches::kNoSandbox, switches::kPpapiInProcess, |
263 switches::kRegisterPepperPlugins, switches::kV, switches::kVModule, | 263 switches::kRegisterPepperPlugins, switches::kV, switches::kVModule, |
| 264 // Need to tell CdmHostFile(s) to ignore missing CDM host files. |
| 265 switches::kIgnoreMissingCdmHostFile, |
264 }; | 266 }; |
265 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, | 267 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, |
266 arraysize(kForwardSwitches)); | 268 arraysize(kForwardSwitches)); |
267 | 269 |
268 GetContentClient()->browser()->AppendExtraCommandLineSwitches(&cmd_line, -1); | 270 GetContentClient()->browser()->AppendExtraCommandLineSwitches(&cmd_line, -1); |
269 | 271 |
270 pid_ = ZygoteHostImpl::GetInstance()->LaunchZygote(&cmd_line, &control_fd_); | 272 pid_ = ZygoteHostImpl::GetInstance()->LaunchZygote(&cmd_line, &control_fd_); |
271 | 273 |
272 base::Pickle pickle; | 274 base::Pickle pickle; |
273 pickle.WriteInt(kZygoteCommandGetSandboxStatus); | 275 pickle.WriteInt(kZygoteCommandGetSandboxStatus); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 } | 334 } |
333 if (ReadSandboxStatus() == -1) { | 335 if (ReadSandboxStatus() == -1) { |
334 return 0; | 336 return 0; |
335 } | 337 } |
336 have_read_sandbox_status_word_ = true; | 338 have_read_sandbox_status_word_ = true; |
337 UMA_HISTOGRAM_SPARSE_SLOWLY("Linux.SandboxStatus", sandbox_status_); | 339 UMA_HISTOGRAM_SPARSE_SLOWLY("Linux.SandboxStatus", sandbox_status_); |
338 return sandbox_status_; | 340 return sandbox_status_; |
339 } | 341 } |
340 | 342 |
341 } // namespace content | 343 } // namespace content |
OLD | NEW |