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 "content/browser/zygote_host/zygote_host_impl_linux.h" | 5 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
6 | 6 |
7 #include <sys/socket.h> | 7 #include <sys/socket.h> |
8 #include <sys/stat.h> | 8 #include <sys/stat.h> |
9 #include <sys/types.h> | 9 #include <sys/types.h> |
10 #include <unistd.h> | 10 #include <unistd.h> |
(...skipping 15 matching lines...) Expand all Loading... |
26 #include "base/string_util.h" | 26 #include "base/string_util.h" |
27 #include "base/time.h" | 27 #include "base/time.h" |
28 #include "base/utf_string_conversions.h" | 28 #include "base/utf_string_conversions.h" |
29 #include "content/browser/renderer_host/render_sandbox_host_linux.h" | 29 #include "content/browser/renderer_host/render_sandbox_host_linux.h" |
30 #include "content/common/zygote_commands_linux.h" | 30 #include "content/common/zygote_commands_linux.h" |
31 #include "content/public/browser/content_browser_client.h" | 31 #include "content/public/browser/content_browser_client.h" |
32 #include "content/public/common/content_switches.h" | 32 #include "content/public/common/content_switches.h" |
33 #include "content/public/common/result_codes.h" | 33 #include "content/public/common/result_codes.h" |
34 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" | 34 #include "sandbox/linux/suid/client/setuid_sandbox_client.h" |
35 #include "sandbox/linux/suid/common/sandbox.h" | 35 #include "sandbox/linux/suid/common/sandbox.h" |
| 36 #include "ui/base/ui_base_switches.h" |
36 | 37 |
37 #if defined(USE_TCMALLOC) | 38 #if defined(USE_TCMALLOC) |
38 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" | 39 #include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h" |
39 #endif | 40 #endif |
40 | 41 |
41 // static | 42 // static |
42 content::ZygoteHost* content::ZygoteHost::GetInstance() { | 43 content::ZygoteHost* content::ZygoteHost::GetInstance() { |
43 return ZygoteHostImpl::GetInstance(); | 44 return ZygoteHostImpl::GetInstance(); |
44 } | 45 } |
45 | 46 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
93 // Should this list be obtained from browser_render_process_host.cc? | 94 // Should this list be obtained from browser_render_process_host.cc? |
94 static const char* kForwardSwitches[] = { | 95 static const char* kForwardSwitches[] = { |
95 switches::kAllowSandboxDebugging, | 96 switches::kAllowSandboxDebugging, |
96 switches::kLoggingLevel, | 97 switches::kLoggingLevel, |
97 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. | 98 switches::kEnableLogging, // Support, e.g., --enable-logging=stderr. |
98 switches::kV, | 99 switches::kV, |
99 switches::kVModule, | 100 switches::kVModule, |
100 switches::kRegisterPepperPlugins, | 101 switches::kRegisterPepperPlugins, |
101 switches::kDisableSeccompSandbox, | 102 switches::kDisableSeccompSandbox, |
102 switches::kEnableSeccompSandbox, | 103 switches::kEnableSeccompSandbox, |
| 104 // Zygote process needs to know what resources to have loaded when it |
| 105 // becomes a renderer process. |
| 106 switches::kForceDeviceScaleFactor, |
| 107 switches::kLoad2xResources, |
103 }; | 108 }; |
104 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, | 109 cmd_line.CopySwitchesFrom(browser_command_line, kForwardSwitches, |
105 arraysize(kForwardSwitches)); | 110 arraysize(kForwardSwitches)); |
106 | 111 |
107 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( | 112 content::GetContentClient()->browser()->AppendExtraCommandLineSwitches( |
108 &cmd_line, -1); | 113 &cmd_line, -1); |
109 | 114 |
110 sandbox_binary_ = sandbox_cmd.c_str(); | 115 sandbox_binary_ = sandbox_cmd.c_str(); |
111 | 116 |
112 if (!sandbox_cmd.empty()) { | 117 if (!sandbox_cmd.empty()) { |
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 | 476 |
472 pid_t ZygoteHostImpl::GetSandboxHelperPid() const { | 477 pid_t ZygoteHostImpl::GetSandboxHelperPid() const { |
473 return RenderSandboxHostLinux::GetInstance()->pid(); | 478 return RenderSandboxHostLinux::GetInstance()->pid(); |
474 } | 479 } |
475 | 480 |
476 int ZygoteHostImpl::GetSandboxStatus() const { | 481 int ZygoteHostImpl::GetSandboxStatus() const { |
477 if (have_read_sandbox_status_word_) | 482 if (have_read_sandbox_status_word_) |
478 return sandbox_status_; | 483 return sandbox_status_; |
479 return 0; | 484 return 0; |
480 } | 485 } |
OLD | NEW |