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

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: Fetch sandbox status Created 5 years 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 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 #include "sandbox/win/src/sandbox_policy.h" 192 #include "sandbox/win/src/sandbox_policy.h"
193 #include "ui/gfx/win/dpi.h" 193 #include "ui/gfx/win/dpi.h"
194 #endif 194 #endif
195 195
196 #if defined(OS_MACOSX) && !defined(OS_IOS) 196 #if defined(OS_MACOSX) && !defined(OS_IOS)
197 #include "content/browser/bootstrap_sandbox_manager_mac.h" 197 #include "content/browser/bootstrap_sandbox_manager_mac.h"
198 #include "content/browser/browser_io_surface_manager_mac.h" 198 #include "content/browser/browser_io_surface_manager_mac.h"
199 #include "content/browser/mach_broker_mac.h" 199 #include "content/browser/mach_broker_mac.h"
200 #endif 200 #endif
201 201
202 #if defined(OS_POSIX)
203 #include "content/browser/zygote_host/zygote_communication_linux.h"
204 #include "content/browser/zygote_host/zygote_host_impl_linux.h"
205 #endif // defined(OS_POSIX)
206
202 #if defined(USE_OZONE) 207 #if defined(USE_OZONE)
203 #include "ui/ozone/public/client_native_pixmap_factory.h" 208 #include "ui/ozone/public/client_native_pixmap_factory.h"
204 #include "ui/ozone/public/ozone_platform.h" 209 #include "ui/ozone/public/ozone_platform.h"
205 #include "ui/ozone/public/ozone_switches.h" 210 #include "ui/ozone/public/ozone_switches.h"
206 #endif 211 #endif
207 212
208 #if defined(ENABLE_BROWSER_CDMS) 213 #if defined(ENABLE_BROWSER_CDMS)
209 #include "content/browser/media/cdm/browser_cdm_manager.h" 214 #include "content/browser/media/cdm/browser_cdm_manager.h"
210 #endif 215 #endif
211 216
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 const base::string16& sid = 385 const base::string16& sid =
381 GetContentClient()->browser()->GetAppContainerSidForSandboxType( 386 GetContentClient()->browser()->GetAppContainerSidForSandboxType(
382 GetSandboxType()); 387 GetSandboxType());
383 if (!sid.empty()) 388 if (!sid.empty())
384 AddAppContainerPolicy(policy, sid.c_str()); 389 AddAppContainerPolicy(policy, sid.c_str());
385 390
386 return GetContentClient()->browser()->PreSpawnRenderer(policy); 391 return GetContentClient()->browser()->PreSpawnRenderer(policy);
387 } 392 }
388 393
389 #elif defined(OS_POSIX) 394 #elif defined(OS_POSIX)
390 bool ShouldUseZygote() override { 395 ZygoteHandle* GetZygote() override {
391 const base::CommandLine& browser_command_line = 396 const base::CommandLine& browser_command_line =
392 *base::CommandLine::ForCurrentProcess(); 397 *base::CommandLine::ForCurrentProcess();
393 base::CommandLine::StringType renderer_prefix = 398 base::CommandLine::StringType renderer_prefix =
394 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); 399 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix);
395 return renderer_prefix.empty(); 400 if (renderer_prefix.empty()) {
401 static ZygoteHandle zygote;
402 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
mdempsky 2015/12/22 21:21:33 We don't need the GetZygote function on OS X or An
Greg K 2016/01/05 21:42:13 Done.
403 if (zygote == nullptr) {
404 zygote = new ZygoteCommunication();
405 zygote->Init();
406 ZygoteHostImpl::GetInstance()->SetRendererSandboxStatus(
mdempsky 2015/12/22 21:21:33 This is kind of clunky, though I don't have a bett
Greg K 2016/01/05 21:42:13 Done.
407 zygote->GetSandboxStatus());
408 }
409 #endif // !OS_MACOSX && !defined(OS_ANDROID)
410 return &zygote;
411 }
412 return nullptr;
396 } 413 }
397 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); } 414 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
398 #endif // OS_WIN 415 #endif // OS_WIN
399 416
400 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; } 417 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; }
401 418
402 private: 419 private:
403 #if defined(OS_POSIX) 420 #if defined(OS_POSIX)
404 base::ScopedFD ipc_fd_; 421 base::ScopedFD ipc_fd_;
405 #endif // OS_POSIX 422 #endif // OS_POSIX
(...skipping 2259 matching lines...) Expand 10 before | Expand all | Expand 10 after
2665 void RenderProcessHostImpl::GetAudioOutputControllers( 2682 void RenderProcessHostImpl::GetAudioOutputControllers(
2666 const GetAudioOutputControllersCallback& callback) const { 2683 const GetAudioOutputControllersCallback& callback) const {
2667 audio_renderer_host()->GetOutputControllers(callback); 2684 audio_renderer_host()->GetOutputControllers(callback);
2668 } 2685 }
2669 2686
2670 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() { 2687 BluetoothDispatcherHost* RenderProcessHostImpl::GetBluetoothDispatcherHost() {
2671 return bluetooth_dispatcher_host_.get(); 2688 return bluetooth_dispatcher_host_.get();
2672 } 2689 }
2673 2690
2674 } // namespace content 2691 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698