• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 // Multiply-included file, no traditional include guard.
6 
7 #include <string>
8 
9 #include "base/basictypes.h"
10 #include "base/process/process.h"
11 #include "build/build_config.h"
12 #include "components/nacl/common/nacl_types.h"
13 #include "components/nacl/common/pnacl_types.h"
14 #include "content/public/common/common_param_traits.h"
15 #include "ipc/ipc_channel_handle.h"
16 #include "ipc/ipc_message_macros.h"
17 #include "ipc/ipc_platform_file.h"
18 #include "url/gurl.h"
19 
20 #define IPC_MESSAGE_START NaClHostMsgStart
21 
22 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchParams)
23   IPC_STRUCT_TRAITS_MEMBER(manifest_url)
24   IPC_STRUCT_TRAITS_MEMBER(nexe_file)
25   IPC_STRUCT_TRAITS_MEMBER(nexe_token_lo)
26   IPC_STRUCT_TRAITS_MEMBER(nexe_token_hi)
27   IPC_STRUCT_TRAITS_MEMBER(render_view_id)
28   IPC_STRUCT_TRAITS_MEMBER(permission_bits)
29   IPC_STRUCT_TRAITS_MEMBER(uses_irt)
30   IPC_STRUCT_TRAITS_MEMBER(uses_nonsfi_mode)
31   IPC_STRUCT_TRAITS_MEMBER(enable_dyncode_syscalls)
32   IPC_STRUCT_TRAITS_MEMBER(enable_exception_handling)
33   IPC_STRUCT_TRAITS_MEMBER(enable_crash_throttling)
34 IPC_STRUCT_TRAITS_END()
35 
36 IPC_STRUCT_TRAITS_BEGIN(nacl::NaClLaunchResult)
37   IPC_STRUCT_TRAITS_MEMBER(imc_channel_handle)
38   IPC_STRUCT_TRAITS_MEMBER(ppapi_ipc_channel_handle)
39   IPC_STRUCT_TRAITS_MEMBER(trusted_ipc_channel_handle)
40   IPC_STRUCT_TRAITS_MEMBER(manifest_service_ipc_channel_handle)
41   IPC_STRUCT_TRAITS_MEMBER(plugin_pid)
42   IPC_STRUCT_TRAITS_MEMBER(plugin_child_id)
43   IPC_STRUCT_TRAITS_MEMBER(crash_info_shmem_handle)
44 IPC_STRUCT_TRAITS_END()
45 
46 IPC_STRUCT_TRAITS_BEGIN(nacl::PnaclCacheInfo)
47   IPC_STRUCT_TRAITS_MEMBER(pexe_url)
48   IPC_STRUCT_TRAITS_MEMBER(abi_version)
49   IPC_STRUCT_TRAITS_MEMBER(opt_level)
50   IPC_STRUCT_TRAITS_MEMBER(last_modified)
51   IPC_STRUCT_TRAITS_MEMBER(etag)
52   IPC_STRUCT_TRAITS_MEMBER(has_no_store_header)
53   IPC_STRUCT_TRAITS_MEMBER(sandbox_isa)
54   IPC_STRUCT_TRAITS_MEMBER(extra_flags)
55 IPC_STRUCT_TRAITS_END()
56 
57 // A renderer sends this to the browser process when it wants to start
58 // a new instance of the Native Client process. The browser will launch
59 // the process and return an IPC channel handle. This handle will only
60 // be valid if the NaCl IPC proxy is enabled.
61 IPC_SYNC_MESSAGE_CONTROL1_2(NaClHostMsg_LaunchNaCl,
62                             nacl::NaClLaunchParams /* launch_params */,
63                             nacl::NaClLaunchResult /* launch_result */,
64                             std::string /* error_message */)
65 
66 // A renderer sends this to the browser process when it wants to
67 // open a file for from the Pnacl component directory.
68 IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_GetReadonlyPnaclFD,
69                             std::string /* name of requested PNaCl file */,
70                             bool /* is_executable */,
71                             IPC::PlatformFileForTransit /* output file */,
72                             uint64_t /* file_token_lo */,
73                             uint64_t /* file_token_hi */)
74 
75 // A renderer sends this to the browser process when it wants to
76 // create a temporary file.
77 IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClCreateTemporaryFile,
78                             IPC::PlatformFileForTransit /* out file */)
79 
80 // A renderer sends this to the browser to request a file descriptor for
81 // a translated nexe.
82 IPC_MESSAGE_CONTROL3(NaClHostMsg_NexeTempFileRequest,
83                      int /* render_view_id */,
84                      int /* instance */,
85                      nacl::PnaclCacheInfo /* cache info */)
86 
87 // The browser replies to a renderer's temp file request with output_file,
88 // which is either a writeable temp file to use for translation, or a
89 // read-only file containing the translated nexe from the cache.
90 IPC_MESSAGE_CONTROL3(NaClViewMsg_NexeTempFileReply,
91                      int /* instance */,
92                      bool /* is_cache_hit */,
93                      IPC::PlatformFileForTransit /* output file */)
94 
95 // A renderer sends this to the browser to report that its translation has
96 // finished and its temp file contains the translated nexe.
97 IPC_MESSAGE_CONTROL2(NaClHostMsg_ReportTranslationFinished,
98                      int /* instance */,
99                      bool /* success */)
100 
101 // A renderer sends this to the browser process to report when the client
102 // architecture is not listed in the manifest.
103 IPC_MESSAGE_CONTROL1(NaClHostMsg_MissingArchError,
104                      int /* render_view_id */)
105 
106 // A renderer sends this to the browser process when it wants to
107 // open a NaCl executable file from an installed application directory.
108 IPC_SYNC_MESSAGE_CONTROL2_3(NaClHostMsg_OpenNaClExecutable,
109                             int /* render_view_id */,
110                             GURL /* URL of NaCl executable file */,
111                             IPC::PlatformFileForTransit /* output file */,
112                             uint64 /* file_token_lo */,
113                             uint64 /* file_token_hi */)
114 
115 // A renderer sends this to the browser process to determine how many
116 // processors are online.
117 IPC_SYNC_MESSAGE_CONTROL0_1(NaClHostMsg_NaClGetNumProcessors,
118                             int /* Number of processors */)
119 
120 // A renderer sends this to the browser process to determine if the
121 // NaCl application started from the given NMF URL will be debugged.
122 // If not (filtered out by commandline flags), it sets should_debug to false.
123 IPC_SYNC_MESSAGE_CONTROL1_1(NaClHostMsg_NaClDebugEnabledForURL,
124                             GURL /* alleged URL of NMF file */,
125                             bool /* should debug */)
126