1 // Copyright 2013 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 #ifndef COMPONENTS_NACL_COMMON_NACL_TYPES_H_
6 #define COMPONENTS_NACL_COMMON_NACL_TYPES_H_
11 #include "base/basictypes.h"
12 #include "base/process/process_handle.h"
13 #include "build/build_config.h"
14 #include "ipc/ipc_channel.h"
17 #include "base/file_descriptor_posix.h"
21 #include <windows.h> // for HANDLE
24 // TODO(gregoryd): add a Windows definition for base::FileDescriptor
28 typedef HANDLE FileDescriptor;
29 inline HANDLE ToNativeHandle(const FileDescriptor& desc) {
32 #elif defined(OS_POSIX)
33 typedef base::FileDescriptor FileDescriptor;
34 inline int ToNativeHandle(const FileDescriptor& desc) {
40 // Parameters sent to the NaCl process when we start it.
41 struct NaClStartParams {
45 std::vector<FileDescriptor> handles;
46 FileDescriptor debug_stub_server_bound_socket;
48 bool validation_cache_enabled;
49 std::string validation_cache_key;
50 // Chrome version string. Sending the version string over IPC avoids linkage
51 // issues in cases where NaCl is not compiled into the main Chromium
55 bool enable_exception_handling;
56 bool enable_debug_stub;
57 bool enable_ipc_proxy;
59 bool enable_dyncode_syscalls;
60 // NOTE: Any new fields added here must also be added to the IPC
61 // serialization in nacl_messages.h and (for POD fields) the constructor
65 // Parameters sent to the browser process to have it launch a NaCl process.
67 // If you change this, you will also need to update the IPC serialization in
68 // nacl_host_messages.h.
69 struct NaClLaunchParams {
71 NaClLaunchParams(const std::string& u, int r, uint32 p,
73 bool uses_nonsfi_mode,
74 bool enable_dyncode_syscalls,
75 bool enable_exception_handling,
76 bool enable_crash_throttling);
77 NaClLaunchParams(const NaClLaunchParams& l);
80 std::string manifest_url;
82 uint32 permission_bits;
84 bool uses_nonsfi_mode;
85 bool enable_dyncode_syscalls;
86 bool enable_exception_handling;
87 bool enable_crash_throttling;
90 struct NaClLaunchResult {
93 FileDescriptor imc_channel_handle,
94 const IPC::ChannelHandle& ppapi_ipc_channel_handle,
95 const IPC::ChannelHandle& trusted_ipc_channel_handle,
96 const IPC::ChannelHandle& manifest_service_ipc_channel_handle,
97 base::ProcessId plugin_pid,
101 // For plugin loader <-> renderer IMC communication.
102 FileDescriptor imc_channel_handle;
104 // For plugin <-> renderer PPAPI communication.
105 IPC::ChannelHandle ppapi_ipc_channel_handle;
107 // For plugin loader <-> renderer control communication (loading and
109 IPC::ChannelHandle trusted_ipc_channel_handle;
111 // For plugin <-> renderer ManifestService communication.
112 IPC::ChannelHandle manifest_service_ipc_channel_handle;
114 base::ProcessId plugin_pid;
120 #endif // COMPONENTS_NACL_COMMON_NACL_TYPES_H_