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

Side by Side Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 1532423003: Have each SandboxedProcessLauncherDelegate maintain a zygote. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 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 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
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/browser_io_surface_manager_mac.h" 200 #include "content/browser/browser_io_surface_manager_mac.h"
201 #include "content/browser/mach_broker_mac.h" 201 #include "content/browser/mach_broker_mac.h"
202 #endif 202 #endif
203 203
204 #if defined(OS_POSIX)
205 #include "content/browser/zygote_host/zygote_communication_linux.h"
206 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
207 #endif // defined(OS_POSIX)
208
204 #if defined(USE_OZONE) 209 #if defined(USE_OZONE)
205 #include "ui/ozone/public/client_native_pixmap_factory.h" 210 #include "ui/ozone/public/client_native_pixmap_factory.h"
206 #include "ui/ozone/public/ozone_platform.h" 211 #include "ui/ozone/public/ozone_platform.h"
207 #include "ui/ozone/public/ozone_switches.h" 212 #include "ui/ozone/public/ozone_switches.h"
208 #endif 213 #endif
209 214
210 #if defined(ENABLE_BROWSER_CDMS) 215 #if defined(ENABLE_BROWSER_CDMS)
211 #include "content/browser/media/cdm/browser_cdm_manager.h" 216 #include "content/browser/media/cdm/browser_cdm_manager.h"
212 #endif 217 #endif
213 218
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
382 const base::string16& sid = 387 const base::string16& sid =
383 GetContentClient()->browser()->GetAppContainerSidForSandboxType( 388 GetContentClient()->browser()->GetAppContainerSidForSandboxType(
384 GetSandboxType()); 389 GetSandboxType());
385 if (!sid.empty()) 390 if (!sid.empty())
386 AddAppContainerPolicy(policy, sid.c_str()); 391 AddAppContainerPolicy(policy, sid.c_str());
387 392
388 return GetContentClient()->browser()->PreSpawnRenderer(policy); 393 return GetContentClient()->browser()->PreSpawnRenderer(policy);
389 } 394 }
390 395
391 #elif defined(OS_POSIX) 396 #elif defined(OS_POSIX)
392 bool ShouldUseZygote() override { 397 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
398 ZygoteHandle* GetZygote() override {
393 const base::CommandLine& browser_command_line = 399 const base::CommandLine& browser_command_line =
394 *base::CommandLine::ForCurrentProcess(); 400 *base::CommandLine::ForCurrentProcess();
395 base::CommandLine::StringType renderer_prefix = 401 base::CommandLine::StringType renderer_prefix =
396 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); 402 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix);
397 return renderer_prefix.empty(); 403 if (!renderer_prefix.empty())
404 return nullptr;
405
406 static ZygoteHandle zygote;
407 if (zygote == nullptr) {
408 zygote = new ZygoteCommunication();
409 zygote->Init();
410 //TODO(kerrnel): Investigate doing this without the ZygoteHostImpl as a
411 //proxy. It is currently done this way due to concerns about race
412 //conditions.
413 ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus(
414 zygote->GetSandboxStatus());
415 }
416 return &zygote;
398 } 417 }
418 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID)
399 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } 419 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
400 #endif // OS_WIN 420 #endif // OS_WIN
401 421
402 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; } 422 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; }
403 423
404 private: 424 private:
405 #if defined(OS_POSIX) 425 #if defined(OS_POSIX)
406 base::ScopedFD ipc_fd_; 426 base::ScopedFD ipc_fd_;
407 #endif // OS_POSIX 427 #endif // OS_POSIX
408 }; 428 };
(...skipping 2348 matching lines...) Expand 10 before | Expand all | Expand 10 after
2757 void RenderProcessHostImpl::GetAudioOutputControllers( 2777 void RenderProcessHostImpl::GetAudioOutputControllers(
2758 const GetAudioOutputControllersCallback& callback) const { 2778 const GetAudioOutputControllersCallback& callback) const {
2759 audio_renderer_host()->GetOutputControllers(callback); 2779 audio_renderer_host()->GetOutputControllers(callback);
2760 } 2780 }
2761 2781
2762 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { 2782 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() {
2763 return bluetooth_dispatcher_host_.get(); 2783 return bluetooth_dispatcher_host_.get();
2764 } 2784 }
2765 2785
2766 } // namespace content 2786 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698