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
3 // found in the LICENSE file.
5 #include "content/renderer/pepper/pepper_proxy_channel_delegate_impl.h"
7 #include "content/child/child_process.h"
8 #include "content/common/sandbox_util.h"
10 #if defined(OS_WIN) || defined(OS_MACOSX)
11 #include "content/public/common/sandbox_init.h"
12 #endif // defined(OS_WIN) || defined(OS_MACOSX)
16 PepperProxyChannelDelegateImpl::~PepperProxyChannelDelegateImpl() {}
18 base::SingleThreadTaskRunner
*
19 PepperProxyChannelDelegateImpl::GetIPCTaskRunner() {
20 // This is called only in the renderer so we know we have a child process.
21 DCHECK(ChildProcess::current()) << "Must be in the renderer.";
22 return ChildProcess::current()->io_task_runner();
25 base::WaitableEvent
* PepperProxyChannelDelegateImpl::GetShutdownEvent() {
26 DCHECK(ChildProcess::current()) << "Must be in the renderer.";
27 return ChildProcess::current()->GetShutDownEvent();
30 IPC::PlatformFileForTransit
31 PepperProxyChannelDelegateImpl::ShareHandleWithRemote(
32 base::PlatformFile handle
,
33 base::ProcessId remote_pid
,
34 bool should_close_source
) {
35 return BrokerGetFileHandleForProcess(handle
, remote_pid
, should_close_source
);
38 base::SharedMemoryHandle
39 PepperProxyChannelDelegateImpl::ShareSharedMemoryHandleWithRemote(
40 const base::SharedMemoryHandle
& handle
,
41 base::ProcessId remote_pid
) {
42 #if defined(OS_WIN) || defined(OS_MACOSX)
43 base::SharedMemoryHandle duped_handle
;
45 BrokerDuplicateSharedMemoryHandle(handle
, remote_pid
, &duped_handle
);
48 return base::SharedMemory::NULLHandle();
50 return base::SharedMemory::DuplicateHandle(handle
);
51 #endif // defined(OS_WIN) || defined(OS_MACOSX)
54 } // namespace content