cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / api / private / ppb_nacl_private.idl
blob755b8d7ecd465f1df20de535a44d1c84acb4784b
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.
4 */
6 /* This file contains NaCl private interfaces. This interface is not versioned
7 * and is for internal Chrome use. It may change without notice. */
9 label Chrome {
10 M25 = 1.0
13 #inline c
14 #include "ppapi/c/private/pp_file_handle.h"
15 #include "ppapi/c/private/ppb_instance_private.h"
16 #endinl
18 /** NaCl-specific errors that should be reported to the user */
19 enum PP_NaClError {
20 /**
21 * The manifest program element does not contain a program usable on the
22 * user's architecture
24 PP_NACL_MANIFEST_MISSING_ARCH = 0
27 /* PPB_NaCl_Private */
28 interface PPB_NaCl_Private {
29 /* Launches NaCl's sel_ldr process. Returns PP_EXTERNAL_PLUGIN_OK on success
30 * and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
31 * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
32 * returns 'Dev' interfaces to the NaCl plugin. The |uses_ppapi| flag
33 * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
34 * This implies that LaunchSelLdr is run from the main thread. If a nexe
35 * does not need PPAPI, then it can run off the main thread.
36 * The |uses_irt| flag indicates whether the IRT should be loaded in this
37 * NaCl process. This is true for ABI stable nexes.
38 * The |enable_dyncode_syscalls| flag indicates whether or not the nexe
39 * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
40 * The |enable_exception_handling| flag indicates whether or not the nexe
41 * will be able to use hardware exception handling.
42 * The |enable_crash_throttling| flag indicates whether or not crashes of
43 * the nexe contribute to crash throttling statisics and whether nexe starts
44 * are throttled by crash throttling.
46 PP_ExternalPluginResult LaunchSelLdr([in] PP_Instance instance,
47 [in] str_t alleged_url,
48 [in] PP_Bool uses_irt,
49 [in] PP_Bool uses_ppapi,
50 [in] PP_Bool enable_ppapi_dev,
51 [in] PP_Bool enable_dyncode_syscalls,
52 [in] PP_Bool enable_exception_handling,
53 [in] PP_Bool enable_crash_throttling,
54 [out] mem_t imc_handle,
55 [out] PP_Var error_message);
57 /* This function starts the IPC proxy so the nexe can communicate with the
58 * browser. Returns PP_EXTERNAL_PLUGIN_OK on success, otherwise a result code
59 * indicating the failure. PP_EXTERNAL_PLUGIN_FAILED is returned if
60 * LaunchSelLdr wasn't called with the instance.
61 * PP_EXTERNAL_PLUGIN_ERROR_MODULE is returned if the module can't be
62 * initialized. PP_EXTERNAL_PLUGIN_ERROR_INSTANCE is returned if the instance
63 * can't be initialized.
65 PP_ExternalPluginResult StartPpapiProxy(PP_Instance instance);
67 /* On POSIX systems, this function returns the file descriptor of
68 * /dev/urandom. On non-POSIX systems, this function returns 0.
70 int32_t UrandomFD();
72 /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
73 * proxy. This is so paranoid admins can effectively prevent untrusted shader
74 * code to be processed by the graphics stack.
76 PP_Bool Are3DInterfacesDisabled();
78 /* This is Windows-specific. This is a replacement for DuplicateHandle() for
79 * use inside the Windows sandbox. Note that we provide this via dependency
80 * injection only to avoid the linkage problems that occur because the NaCl
81 * plugin is built as a separate DLL/DSO
82 * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
84 int32_t BrokerDuplicateHandle([in] PP_FileHandle source_handle,
85 [in] uint32_t process_id,
86 [out] PP_FileHandle target_handle,
87 [in] uint32_t desired_access,
88 [in] uint32_t options);
90 /* Check if PNaCl is installed and attempt to install if necessary.
91 * Callback is called when the check is done and PNaCl is already installed,
92 * or after an on-demand install is attempted. Called back with PP_OK if
93 * PNaCl is available. Called back with an error otherwise.
95 int32_t EnsurePnaclInstalled([in] PP_Instance instance,
96 [in] PP_CompletionCallback callback);
98 /* Returns a read-only file descriptor of a file rooted in the Pnacl
99 * component directory, or an invalid handle on failure.
101 PP_FileHandle GetReadonlyPnaclFd([in] str_t filename);
103 /* This creates a temporary file that will be deleted by the time
104 * the last handle is closed (or earlier on POSIX systems), and
105 * returns a posix handle to that temporary file.
107 PP_FileHandle CreateTemporaryFile([in] PP_Instance instance);
109 /* Create a temporary file, which will be deleted by the time the last
110 * handle is closed (or earlier on POSIX systems), to use for the nexe
111 * with the cache information given by |pexe_url|, |abi_version|, |opt_level|,
112 * |last_modified|, and |etag|. If the nexe is already present
113 * in the cache, |is_hit| is set to PP_TRUE and the contents of the nexe
114 * will be copied into the temporary file. Otherwise |is_hit| is set to
115 * PP_FALSE and the temporary file will be writeable.
116 * Currently the implementation is a stub, which always sets is_hit to false
117 * and calls the implementation of CreateTemporaryFile. In a subsequent CL
118 * it will call into the browser which will remember the association between
119 * the cache key and the fd, and copy the nexe into the cache after the
120 * translation finishes.
122 int32_t GetNexeFd([in] PP_Instance instance,
123 [in] str_t pexe_url,
124 [in] uint32_t abi_version,
125 [in] uint32_t opt_level,
126 [in] str_t last_modified,
127 [in] str_t etag,
128 [out] PP_Bool is_hit,
129 [out] PP_FileHandle nexe_handle,
130 [in] PP_CompletionCallback callback);
132 /* Report to the browser that translation of the pexe for |instance|
133 * has finished, or aborted with an error. If |success| is true, the
134 * browser may then store the translation in the cache. The renderer
135 * must first have called GetNexeFd for the same instance. (The browser is
136 * not guaranteed to store the nexe even if |success| is true; if there is
137 * an error on the browser side, or the file is too big for the cache, or
138 * the browser is in incognito mode, no notification will be delivered to
139 * the plugin.)
141 void ReportTranslationFinished([in] PP_Instance instance,
142 [in] PP_Bool success);
144 /* Return true if we are off the record.
146 PP_Bool IsOffTheRecord();
148 /* Return true if PNaCl is turned on.
150 PP_Bool IsPnaclEnabled();
152 /* Display a UI message to the user. */
153 PP_ExternalPluginResult ReportNaClError([in] PP_Instance instance,
154 [in] PP_NaClError message_id);
156 /* Opens a NaCl executable file in the application's extension directory
157 * corresponding to the file URL and returns a file descriptor, or an invalid
158 * handle on failure. |metadata| is left unchanged on failure.
160 PP_FileHandle OpenNaClExecutable([in] PP_Instance instance,
161 [in] str_t file_url,
162 [out] uint64_t file_token_lo,
163 [out] uint64_t file_token_hi);