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

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

Issue 2164883003: Delete SandboxedProcessLauncherDelegate::TakeIpcFd. Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-ppapi-channel-mojo
Patch Set: Created 4 years, 5 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 360 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 // This static member variable holds the zygote communication information for 371 // This static member variable holds the zygote communication information for
372 // the renderer. 372 // the renderer.
373 ZygoteHandle g_render_zygote; 373 ZygoteHandle g_render_zygote;
374 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX) 374 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) && !defined(OS_MACOSX)
375 375
376 // NOTE: changes to this class need to be reviewed by the security team. 376 // NOTE: changes to this class need to be reviewed by the security team.
377 class RendererSandboxedProcessLauncherDelegate 377 class RendererSandboxedProcessLauncherDelegate
378 : public SandboxedProcessLauncherDelegate { 378 : public SandboxedProcessLauncherDelegate {
379 public: 379 public:
380 explicit RendererSandboxedProcessLauncherDelegate(IPC::ChannelProxy* channel) 380 explicit RendererSandboxedProcessLauncherDelegate(IPC::ChannelProxy* channel)
381 #if defined(OS_POSIX) 381 {}
382 : ipc_fd_(channel->TakeClientFileDescriptor())
383 #endif // OS_POSIX
384 {
385 }
386 382
387 ~RendererSandboxedProcessLauncherDelegate() override {} 383 ~RendererSandboxedProcessLauncherDelegate() override {}
388 384
389 #if defined(OS_WIN) 385 #if defined(OS_WIN)
390 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override { 386 bool PreSpawnTarget(sandbox::TargetPolicy* policy) override {
391 AddBaseHandleClosePolicy(policy); 387 AddBaseHandleClosePolicy(policy);
392 388
393 const base::string16& sid = 389 const base::string16& sid =
394 GetContentClient()->browser()->GetAppContainerSidForSandboxType( 390 GetContentClient()->browser()->GetAppContainerSidForSandboxType(
395 GetSandboxType()); 391 GetSandboxType());
396 if (!sid.empty()) 392 if (!sid.empty())
397 AddAppContainerPolicy(policy, sid.c_str()); 393 AddAppContainerPolicy(policy, sid.c_str());
398 394
399 return GetContentClient()->browser()->PreSpawnRenderer(policy); 395 return GetContentClient()->browser()->PreSpawnRenderer(policy);
400 } 396 }
401 397
402 #elif defined(OS_POSIX) 398 #elif defined(OS_POSIX)
403 #if !defined(OS_MACOSX) && !defined(OS_ANDROID) 399 #if !defined(OS_MACOSX) && !defined(OS_ANDROID)
404 ZygoteHandle* GetZygote() override { 400 ZygoteHandle* GetZygote() override {
405 const base::CommandLine& browser_command_line = 401 const base::CommandLine& browser_command_line =
406 *base::CommandLine::ForCurrentProcess(); 402 *base::CommandLine::ForCurrentProcess();
407 base::CommandLine::StringType renderer_prefix = 403 base::CommandLine::StringType renderer_prefix =
408 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix); 404 browser_command_line.GetSwitchValueNative(switches::kRendererCmdPrefix);
409 if (!renderer_prefix.empty()) 405 if (!renderer_prefix.empty())
410 return nullptr; 406 return nullptr;
411 return GetGenericZygote(); 407 return GetGenericZygote();
412 } 408 }
413 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID) 409 #endif // !defined(OS_MACOSX) && !defined(OS_ANDROID)
414 base::ScopedFD TakeIpcFd() override { return std::move(ipc_fd_); }
415 #endif // OS_WIN 410 #endif // OS_WIN
416 411
417 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; } 412 SandboxType GetSandboxType() override { return SANDBOX_TYPE_RENDERER; }
418
419 private:
420 #if defined(OS_POSIX)
421 base::ScopedFD ipc_fd_;
422 #endif // OS_POSIX
423 }; 413 };
424 414
425 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey"; 415 const char kSessionStorageHolderKey[] = "kSessionStorageHolderKey";
426 416
427 class SessionStorageHolder : public base::SupportsUserData::Data { 417 class SessionStorageHolder : public base::SupportsUserData::Data {
428 public: 418 public:
429 SessionStorageHolder() {} 419 SessionStorageHolder() {}
430 ~SessionStorageHolder() override {} 420 ~SessionStorageHolder() override {}
431 421
432 void Hold(const SessionStorageNamespaceMap& sessions, int view_route_id) { 422 void Hold(const SessionStorageNamespaceMap& sessions, int view_route_id) {
(...skipping 2368 matching lines...) Expand 10 before | Expand all | Expand 10 after
2801 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error; 2791 LOG(ERROR) << "Terminating render process for bad Mojo message: " << error;
2802 2792
2803 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias 2793 // The ReceivedBadMessage call below will trigger a DumpWithoutCrashing. Alias
2804 // enough information here so that we can determine what the bad message was. 2794 // enough information here so that we can determine what the bad message was.
2805 base::debug::Alias(&error); 2795 base::debug::Alias(&error);
2806 bad_message::ReceivedBadMessage(process.get(), 2796 bad_message::ReceivedBadMessage(process.get(),
2807 bad_message::RPH_MOJO_PROCESS_ERROR); 2797 bad_message::RPH_MOJO_PROCESS_ERROR);
2808 } 2798 }
2809 2799
2810 } // namespace content 2800 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/ppapi_plugin_process_host.cc ('k') | content/browser/utility_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698