This source file includes following definitions.
- BrokerGetFileHandleForProcess
#include "content/common/sandbox_util.h"
#if defined(OS_POSIX)
#include <unistd.h>
#endif
#include "content/public/common/sandbox_init.h"
namespace content {
IPC::PlatformFileForTransit BrokerGetFileHandleForProcess(
base::PlatformFile handle,
base::ProcessId target_process_id,
bool should_close_source) {
IPC::PlatformFileForTransit out_handle;
#if defined(OS_WIN)
DWORD options = DUPLICATE_SAME_ACCESS;
if (should_close_source)
options |= DUPLICATE_CLOSE_SOURCE;
if (!content::BrokerDuplicateHandle(handle, target_process_id, &out_handle,
0, options)) {
out_handle = IPC::InvalidPlatformFileForTransit();
}
#elif defined(OS_POSIX)
int fd = should_close_source ? handle : ::dup(handle);
out_handle = base::FileDescriptor(fd, true);
#else
#error Not implemented.
#endif
return out_handle;
}
}