12a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
22a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * Use of this source code is governed by a BSD-style license that can be
32a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) * found in the LICENSE file.
42a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) */
52a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
6c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)/* This file contains NaCl private interfaces. This interface is not versioned
7c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) * and is for internal Chrome use. It may change without notice. */
82a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
9424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)label Chrome {
10424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)  M25 = 1.0
11424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)};
12424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles)
132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#inline c
142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ppapi/c/private/pp_file_handle.h"
15a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch#include "ppapi/c/private/ppb_instance_private.h"
162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#endinl
172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
18a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)/** NaCl-specific errors that should be reported to the user.
19a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *  These error codes are reported via UMA so, if you edit them:
20a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *   1) make sure you understand UMA first.
21a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *   2) update src/tools/metrics/histograms/histograms.xml
22a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *  Values are explicitly specified to make sure they don't shift around when
23a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) *  edited, and also to make reading about:histograms easier.
24a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) */
252a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)enum PP_NaClError {
26a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_LOAD_SUCCESS = 0,
27a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_LOAD_ABORTED = 1,
28a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_UNKNOWN = 2,
29a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_RESOLVE_URL = 3,
30a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_LOAD_URL = 4,
31a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_STAT = 5,
32a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_TOO_LARGE = 6,
33a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_OPEN = 7,
34a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_MEMORY_ALLOC = 8,
35a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_READ = 9,
36a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_PARSING = 10,
37a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_SCHEMA_VALIDATE = 11,
38a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_GET_NEXE_URL = 12,
39a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_LOAD_URL = 13,
40a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_ORIGIN_PROTOCOL = 14,
41a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_FH_DUP = 15,
42a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_STAT = 16,
43a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_ELF_CHECK_IO = 17,
44a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_ELF_CHECK_FAIL = 18,
45a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_INIT = 19,
46a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_CREATE_LAUNCHER = 20,
47a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_FD = 21,
48a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_LAUNCH = 22,
49a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Deprecated, safe to reuse the value because it's never logged in UMA.
50a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION = 23, */
51a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_SEND_NEXE = 24,
52a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_HANDLE_PASSING = 25,
53a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_START_MODULE = 26,
54a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_START_STATUS = 27,
55a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SRPC_CONNECTION_FAIL = 28,
56a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_CHECK_PPP = 29,
57a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_ALLOC = 30,
58a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_MODULE = 31,
59a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_INSTANCE = 32,
60a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_CMD_CHANNEL = 33,
61a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SETUP = 34,
62a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_WRAPPER = 35,
63a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_SEL_LDR_COMMUNICATION_REV_SERVICE = 36,
64a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_START_PROXY_CRASH = 37,
65a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_PROGRAM_MISSING_ARCH = 38,
66a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_INPROGRESS = 39,
67a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_NOACCESS = 40,
68a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_NOQUOTA = 41,
69a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_NOSPACE = 42,
70a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_OPEN_OTHER = 43,
71a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_DIRECTORY_CREATE = 44,
72a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOACCESS = 45,
73a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOQUOTA = 46,
74a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOSPACE = 47,
75a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_NOTAFILE = 48,
76a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FILEOPEN_OTHER = 49,
77a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FETCH_NOACCESS = 50,
78a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FETCH_NOTFOUND = 51,
79a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FETCH_OTHER = 52,
80a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOQUOTA = 53,
81a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_NOSPACE = 54,
82a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_COPY_OTHER = 55,
83a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_NOACCESS = 56,
84a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CACHE_FINALIZE_RENAME_OTHER = 57,
85a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_RESOURCE_FETCH = 58,
86a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_PEXE_FETCH_ABORTED = 59,
87a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_PEXE_FETCH_NOACCESS = 60,
88a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_PEXE_FETCH_OTHER = 61,
89a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_THREAD_CREATE = 62,
90a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LLC_SETUP = 63,
91a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LD_SETUP = 64,
92a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LLC_INTERNAL = 65,
93a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_LD_INTERNAL = 66,
94a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CREATE_TEMP = 67,
95a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* This entry is no longer used, but should not be removed, because UMA
96a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)     numbers need to be kept consistent. */
97a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_NOT_ENABLED = 68,
98a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MANIFEST_NOACCESS_URL = 69,
99a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_NEXE_NOACCESS_URL = 70,
100a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_PNACL_CRASH_THROTTLED = 71,
101a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
102a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* If you add a code, read the enum comment above on how to update
103a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)     histograms. */
104a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_NACL_ERROR_MAX
1052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
1062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
107f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)/** Event types that NaCl may use when reporting load progress or errors. */
108f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)enum PP_NaClEventType {
109f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_LOADSTART,
110f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_PROGRESS,
111f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_ERROR,
112f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_ABORT,
113f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_LOAD,
114f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_LOADEND,
115f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  PP_NACL_EVENT_CRASH
116f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)};
117f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
11823730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)enum PP_UrlSchemeType {
11923730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  PP_SCHEME_CHROME_EXTENSION,
12023730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  PP_SCHEME_DATA,
12123730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  PP_SCHEME_OTHER
12223730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)};
12323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
124effb81e5f8246d0db0270817048dc992db66e9fbBen Murdochenum PP_NaClReadyState {
125effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The trusted plugin begins in this ready state. */
126effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_UNSENT = 0,
127effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The manifest file has been requested, but not yet received. */
128effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_OPENED = 1,
129effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The manifest file has been received and the nexe successfully requested. */
130effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_LOADING = 3,
131effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* The nexe has been loaded and the proxy started, so it is ready for
132effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch     interaction with the page. */
133effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NACL_READY_STATE_DONE = 4
134effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch};
135effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
1360529e5d033099cbfc42635f6f6183833b09dff6eBen Murdochstruct PP_PNaClOptions {
1370529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  PP_Bool translate;
1380529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  PP_Bool is_debug;
1390529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  int32_t opt_level;
1400529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch};
1410529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
142010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)/* Callback invoked upon completion of PPP_ManifestService::OpenResource(). */
143010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)typedef void PP_OpenResourceCompletionCallback([inout] mem_t user_data,
144010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                               [in] PP_FileHandle file_handle);
145010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
146cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)/* Corresponds to NaClFileInfo in
147cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) * native_client/src/trusted/validator/nacl_file_info.h */
148cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)struct PP_NaClFileInfo {
149cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  PP_FileHandle handle;
150cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
151cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  /* See NaClFileToken comment in nacl_file_info.h */
152cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  uint64_t token_lo;
153cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  uint64_t token_hi;
154cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)};
155cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
1562a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)/* PPB_NaCl_Private */
1572a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)interface PPB_NaCl_Private {
158a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch  /* Launches NaCl's sel_ldr process.  Returns PP_EXTERNAL_PLUGIN_OK on success
159a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch   * and writes a NaClHandle to imc_handle. Returns PP_EXTERNAL_PLUGIN_FAILED on
160a3f7b4e666c476898878fa745f637129375cd889Ben Murdoch   * failure. The |enable_ppapi_dev| parameter controls whether GetInterface
1612a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * returns 'Dev' interfaces to the NaCl plugin.  The |uses_ppapi| flag
1622a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * indicates that the nexe run by sel_ldr will use the PPAPI APIs.
1632a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * This implies that LaunchSelLdr is run from the main thread.  If a nexe
1642a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * does not need PPAPI, then it can run off the main thread.
165116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * The |nexe_file_info| is currently used only in non-SFI mode. It is the
166116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * file handle for the main nexe file, which should be initially loaded.
167116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * LaunchSelLdr takes the ownership of the file handle.
1682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * The |uses_irt| flag indicates whether the IRT should be loaded in this
1692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * NaCl process.  This is true for ABI stable nexes.
170a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   * The |uses_nonsfi_mode| flag indicates whether or not nonsfi-mode should
171a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   * be used with the binary pointed by the url.
172c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)   * The |enable_dyncode_syscalls| flag indicates whether or not the nexe
173c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles)   * will be able to use dynamic code system calls (e.g., mmap with PROT_EXEC).
1747d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)   * The |enable_exception_handling| flag indicates whether or not the nexe
1757d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles)   * will be able to use hardware exception handling.
1763551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)   * The |enable_crash_throttling| flag indicates whether or not crashes of
1773551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)   * the nexe contribute to crash throttling statisics and whether nexe starts
1783551c9c881056c480085172ff9840cab31610854Torne (Richard Coles)   * are throttled by crash throttling.
1792a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
1805d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  void LaunchSelLdr([in] PP_Instance instance,
181cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                    [in] PP_Bool main_service_runtime,
1825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] str_t alleged_url,
183116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                    [in] PP_NaClFileInfo nexe_file_info,
1845d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_Bool uses_irt,
1855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_Bool uses_ppapi,
186a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                    [in] PP_Bool uses_nonsfi_mode,
1875d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_Bool enable_ppapi_dev,
1885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_Bool enable_dyncode_syscalls,
1895d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_Bool enable_exception_handling,
1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_Bool enable_crash_throttling,
1915d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [out] mem_t imc_handle,
1925d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                    [in] PP_CompletionCallback callback);
1932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1942a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* This function starts the IPC proxy so the nexe can communicate with the
195c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch   * browser.
1962a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
197c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  PP_Bool StartPpapiProxy(PP_Instance instance);
1982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
1992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* On POSIX systems, this function returns the file descriptor of
2002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * /dev/urandom.  On non-POSIX systems, this function returns 0.
2012a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int32_t UrandomFD();
2032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2042a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* Whether the Pepper 3D interfaces should be disabled in the NaCl PPAPI
2052a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * proxy. This is so paranoid admins can effectively prevent untrusted shader
2062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * code to be processed by the graphics stack.
2072a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2082a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PP_Bool Are3DInterfacesDisabled();
2092a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* This is Windows-specific.  This is a replacement for DuplicateHandle() for
2112a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * use inside the Windows sandbox.  Note that we provide this via dependency
2122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * injection only to avoid the linkage problems that occur because the NaCl
2132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * plugin is built as a separate DLL/DSO
2142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * (see http://code.google.com/p/chromium/issues/detail?id=114439#c8).
2152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  int32_t BrokerDuplicateHandle([in] PP_FileHandle source_handle,
2172a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                [in] uint32_t process_id,
2182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                [out] PP_FileHandle target_handle,
2192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                [in] uint32_t desired_access,
2202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)                                [in] uint32_t options);
2212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
222116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Returns a read-only (but executable) file descriptor / file info for
223116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * a url for pnacl translator tools. Returns an invalid handle on failure.
2242a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
225116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void GetReadExecPnaclFd([in] str_t url,
226116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                          [out] PP_NaClFileInfo out_file_info);
2272a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2282a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  /* This creates a temporary file that will be deleted by the time
2292a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * the last handle is closed (or earlier on POSIX systems), and
2302a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   * returns a posix handle to that temporary file.
2312a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)   */
2322a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)  PP_FileHandle CreateTemporaryFile([in] PP_Instance instance);
2332a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)
2345d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  /* Return the number of processors in the system as reported by the OS */
2355d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)  int32_t GetNumberOfProcessors();
2365d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)
237a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Return whether the non-SFI mode is enabled. */
238a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  PP_Bool IsNonSFIModeEnabled();
239a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
240eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch  /* Report to the browser that translation of the pexe for |instance|
241bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * has finished, or aborted with an error. If |success| is true, the
242bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * browser may then store the translation in the cache. The renderer
243bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * must first have called GetNexeFd for the same instance. (The browser is
244bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * not guaranteed to store the nexe even if |success| is true; if there is
245bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * an error on the browser side, or the file is too big for the cache, or
246bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * the browser is in incognito mode, no notification will be delivered to
247bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch   * the plugin.)
248eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch   */
249bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch  void ReportTranslationFinished([in] PP_Instance instance,
250f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                                 [in] PP_Bool success,
251f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                                 [in] int32_t opt_level,
252f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                                 [in] int64_t pexe_size,
253116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                                 [in] int64_t compile_time_us);
254eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch
255f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  /* Dispatch a progress event on the DOM element where the given instance is
256f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)   * embedded.
257f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)   */
258f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)  void DispatchEvent([in] PP_Instance instance,
259f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                     [in] PP_NaClEventType event_type,
2605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)                     [in] str_t resource_url,
261f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                     [in] PP_Bool length_is_computable,
262f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                     [in] uint64_t loaded_bytes,
263f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)                     [in] uint64_t total_bytes);
264f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)
265e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  /* Report that the nexe loaded successfully. */
266e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  void ReportLoadSuccess([in] PP_Instance instance,
267e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch                         [in] uint64_t loaded_bytes,
268e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch                         [in] uint64_t total_bytes);
269e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch
270a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Report an error that occured while attempting to load a nexe. */
271a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void ReportLoadError([in] PP_Instance instance,
272a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)                       [in] PP_NaClError error,
27346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                       [in] str_t error_message);
274effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
275e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  /* Reports that loading a nexe was aborted. */
276e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch  void ReportLoadAbort([in] PP_Instance instance);
277e5d81f57cb97b3b6b7fccc9c5610d21eb81db09dBen Murdoch
278effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* Performs internal setup when an instance is created. */
279effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  void InstanceCreated([in] PP_Instance instance);
280a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
281a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Performs internal cleanup when an instance is destroyed. */
282a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  void InstanceDestroyed([in] PP_Instance instance);
283a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
284effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* Return true if the NaCl debug stub is enabled and the app loaded from
285effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch   * alleged_nmf_url will be attached to a debugger.
286a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   */
287effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_Bool NaClDebugEnabledForURL([in] str_t alleged_nmf_url);
288a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)
289a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  /* Returns the kind of SFI sandbox implemented by NaCl on this
290cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * platform.
291a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)   */
292a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles)  str_t GetSandboxArch();
29323730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)
29423730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  /* Logs the message to the console. */
29523730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)  void LogToConsole([in] PP_Instance instance,
29623730a6e56a168d1879203e4b3819bb36e3d8f1fTorne (Richard Coles)                    [in] str_t message);
297effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
298effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  /* Returns the NaCl readiness status for this instance. */
299effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch  PP_NaClReadyState GetNaClReadyState([in] PP_Instance instance);
300effb81e5f8246d0db0270817048dc992db66e9fbBen Murdoch
301c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  /* Logs the message via VLOG. */
302c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  void Vlog([in] str_t message);
303c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
3040529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  /* Initializes internal state for a NaCl plugin. */
3055c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  void InitializePlugin([in] PP_Instance instance,
3065c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                        [in] uint32_t argc,
3075c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                        [in, size_as=argc] str_t[] argn,
3085c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu                        [in, size_as=argv] str_t[] argv);
309c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
310c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  /* Returns the size of the nexe. */
311c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch  int64_t GetNexeSize([in] PP_Instance instance);
312c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch
31346d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  /* Requests the NaCl manifest specified in the plugin arguments. */
314cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void RequestNaClManifest([in] PP_Instance instance,
315cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                           [in] PP_CompletionCallback callback);
3160529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
3170529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  PP_Var GetManifestBaseURL([in] PP_Instance instance);
3180529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch
3190529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  /* Processes the NaCl manifest once it's been retrieved.
3200529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch   * TODO(teravest): Move the rest of the supporting logic out of the trusted
3210529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch   * plugin.
3220529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch   */
3230529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch  void ProcessNaClManifest([in] PP_Instance instance,
3240529e5d033099cbfc42635f6f6183833b09dff6eBen Murdoch                           [in] str_t program_url);
3255c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu
3265c02ac1a9c1b504631c0a3d2b6e737b5d738bae1Bo Liu  PP_Bool DevInterfacesEnabled([in] PP_Instance instance);
327010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
328010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Bool GetManifestProgramURL([in] PP_Instance instance,
329010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                [out] PP_Var full_url,
330010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                [out] PP_PNaClOptions pnacl_options,
331010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                                [out] PP_Bool uses_nonsfi_mode);
332010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
333116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Returns the filenames for the llc and ld tools. */
334010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Bool GetPnaclResourceInfo([in] PP_Instance instance,
335010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                               [out] PP_Var llc_tool_name,
336010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)                               [out] PP_Var ld_tool_name);
337010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)
338010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  // PP_Var string of attributes describing the CPU features supported
339010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  // by the current architecture. The string is a comma-delimited list
340010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  // of attributes supported by LLVM in its -mattr= option:
341010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  //   http://llvm.org/docs/CommandGuide/llc.html#cmdoption-mattr
342010d83a9304c5a91596085d917d248abff47903aTorne (Richard Coles)  PP_Var GetCpuFeatureAttrs();
343cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
344cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  /* Downloads the .nexe file at the given URL to a file, and sets |file_info|
345cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * to information for a handle to a file containing its contents.
346cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * If metadata for identity-based validation caching is available
347cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   * then it sets token information in |file_info| (otherwise left untouched).
348cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)   */
349cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)  void DownloadNexe([in] PP_Instance instance,
350cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                    [in] str_t url,
351cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                    [out] PP_NaClFileInfo file_info,
352cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)                    [in] PP_CompletionCallback callback);
353cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)
35446d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  /* Reports the status of sel_ldr for UMA reporting.
35546d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   * |max_status| has to be provided because the implementation of this
35646d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   * interface can't access the NaClErrorCode enum.
35746d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)   */
35846d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)  void ReportSelLdrStatus([in] PP_Instance instance,
35946d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                          [in] int32_t load_status,
36046d4c2bc3267f3f028f39e7e311b0f89aba2e4fdTorne (Richard Coles)                          [in] int32_t max_status);
361f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)
362f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  /* Logs time taken by an operation to UMA histograms.
363f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)   * This function is safe to call on any thread.
364f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)   */
365f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)  void LogTranslateTime([in] str_t histogram_name,
366f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles)                        [in] int64_t time_us);
367116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
368116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Opens a manifest entry for the given instance. If this is for a helper
369116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * process, we consult our internal pnacl.json instead of the user-supplied
370116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * NMF.
371116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * Fails for files which require PNaCl translation.
372116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   */
373116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void OpenManifestEntry([in] PP_Instance instance,
374116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                         [in] PP_Bool is_helper_process,
375116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                         [in] str_t key,
376116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                         [out] PP_NaClFileInfo file_info,
377116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch                         [in] PP_CompletionCallback callback);
378116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch
379116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  /* Sets the start time for PNaCl downloading and translation to the current
380116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   * time.
381116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch   */
382116680a4aac90f2aa7413d9095a592090648e557Ben Murdoch  void SetPNaClStartTime([in] PP_Instance instance);
3835f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)
3845f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  /* Downloads and streams a pexe file for PNaCl translation.
3855f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * Fetches the content at |pexe_url| for the given instance and opt_level.
3865f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * If a translated cached nexe is already available, |cache_hit_handle|
3875f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * is set and |cache_hit_callback| is called.
3885f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * Otherwise, |stream_callback| is called repeatedly with blocks of data
3895f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * as they are received. |stream_finished_callback| is called after all
3905f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   * data has been received and dispatched to |stream_callback|.
3915f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)   */
3925f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)  void StreamPexe([in] PP_Instance instance,
3935f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                  [in] str_t pexe_url,
3945f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                  [in] int32_t opt_level,
3955f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                  [in] PPP_PexeStreamHandler stream_handler,
3965f1c94371a64b3196d4be9466099bb892df9b88eTorne (Richard Coles)                  [inout] mem_t stream_handler_user_data);
3972a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)};
398