OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 // Represents the browser side of the browser <--> renderer communication | 5 // Represents the browser side of the browser <--> renderer communication |
6 // channel. There will be one RenderProcessHost per renderer process. | 6 // channel. There will be one RenderProcessHost per renderer process. |
7 | 7 |
8 #include "content/browser/renderer_host/render_process_host_impl.h" | 8 #include "content/browser/renderer_host/render_process_host_impl.h" |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
193 #include "content/common/sandbox_win.h" | 193 #include "content/common/sandbox_win.h" |
194 #include "sandbox/win/src/sandbox_policy.h" | 194 #include "sandbox/win/src/sandbox_policy.h" |
195 #include "ui/gfx/win/dpi.h" | 195 #include "ui/gfx/win/dpi.h" |
196 #endif | 196 #endif |
197 | 197 |
198 #if defined(OS_MACOSX) && !defined(OS_IOS) | 198 #if defined(OS_MACOSX) && !defined(OS_IOS) |
199 #include "content/browser/bootstrap_sandbox_manager_mac.h" | 199 #include "content/browser/bootstrap_sandbox_manager_mac.h" |
200 #include "content/browser/mach_broker_mac.h" | 200 #include "content/browser/mach_broker_mac.h" |
201 #endif | 201 #endif |
202 | 202 |
| 203 #if defined(OS_POSIX) |
| 204 #include "content/browser/zygote_host/zygote_communication_linux.h" |
| 205 #include "content/browser/zygote_host/zygote_host_impl_linux.h" |
| 206 #endif // defined(OS_POSIX) |
| 207 |
203 #if defined(USE_OZONE) | 208 #if defined(USE_OZONE) |
204 #include "ui/ozone/public/client_native_pixmap_factory.h" | 209 #include "ui/ozone/public/client_native_pixmap_factory.h" |
205 #include "ui/ozone/public/ozone_platform.h" | 210 #include "ui/ozone/public/ozone_platform.h" |
206 #include "ui/ozone/public/ozone_switches.h" | 211 #include "ui/ozone/public/ozone_switches.h" |
207 #endif | 212 #endif |
208 | 213 |
209 #if defined(ENABLE_BROWSER_CDMS) | 214 #if defined(ENABLE_BROWSER_CDMS) |
210 #include "content/browser/media/cdm/browser_cdm_manager.h" | 215 #include "content/browser/media/cdm/browser_cdm_manager.h" |
211 #endif | 216 #endif |
212 | 217 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 const base::string16& sid = | 386 const base::string16& sid = |
382 GetContentClient()->browser()->GetAppContainerSidForSandboxType( | 387 GetContentClient()->browser()->GetAppContainerSidForSandboxType( |
383 GetSandboxType()); | 388 GetSandboxType()); |
384 if (!sid.empty()) | 389 if (!sid.empty()) |
385 AddAppContainerPolicy(policy, sid.c_str()); | 390 AddAppContainerPolicy(policy, sid.c_str()); |
386 | 391 |
387 return GetContentClient()->browser()->PreSpawnRenderer(policy); | 392 return GetContentClient()->browser()->PreSpawnRenderer(policy); |
388 } | 393 } |
389 | 394 |
390 #elif defined(OS_POSIX) | 395 #elif defined(OS_POSIX) |
391 bool ShouldUseZygote() override { | 396 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) |
| 397 ZygoteHandle* GetZygote() override { |
392 const base::CommandLine& browser_command_line = | 398 const base::CommandLine& browser_command_line = |
393 *base::CommandLine::ForCurrentProcess(); | 399 *base::CommandLine::ForCurrentProcess(); |
394 base::CommandLine::StringType renderer_prefix = | 400 base::CommandLine::StringType renderer_prefix = |
395 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); | 401 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); |
396 return renderer_prefix.empty(); | 402 if (!renderer_prefix.empty()) |
| 403 return nullptr; |
| 404 |
| 405 static ZygoteHandle zygote; |
| 406 if (zygote == nullptr) { |
| 407 zygote = new ZygoteCommunication(); |
| 408 zygote->Init(); |
| 409 // TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a |
| 410 // proxy. It is currently done this way due to concerns about race |
| 411 // conditions. |
| 412 ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus( |
| 413 zygote->GetSandboxStatus()); |
| 414 } |
| 415 return &zygote; |
397 } | 416 } |
| 417 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) |
398 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } | 418 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } |
399 #endif // OS_WIN | 419 #endif // OS_WIN |
400 | 420 |
401 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; } | 421 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; } |
402 | 422 |
403 private: | 423 private: |
404 #if defined(OS_POSIX) | 424 #if defined(OS_POSIX) |
405 base::ScopedFD ipc_fd_; | 425 base::ScopedFD ipc_fd_; |
406 #endif // OS_POSIX | 426 #endif // OS_POSIX |
407 }; | 427 }; |
(...skipping 2333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2741 void RenderProcessHostImpl::GetAudioOutputControllers( | 2761 void RenderProcessHostImpl::GetAudioOutputControllers( |
2742 const GetAudioOutputControllersCallback& callback) const { | 2762 const GetAudioOutputControllersCallback& callback) const { |
2743 audio_renderer_host()->GetOutputControllers(callback); | 2763 audio_renderer_host()->GetOutputControllers(callback); |
2744 } | 2764 } |
2745 | 2765 |
2746 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { | 2766 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { |
2747 return bluetooth_dispatcher_host_.get(); | 2767 return bluetooth_dispatcher_host_.get(); |
2748 } | 2768 } |
2749 | 2769 |
2750 } // namespace content | 2770 } // namespace content |
OLD | NEW |