Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Side by Side Diff: native_client_sdk/doc_generated/reference/nacl-manifest-format.html

Issue 438403003: [NaCl SDK Docs] Only generate one top-level <section> element. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 {{+bindTo:partials.standard_nacl_article}} 1 {{+bindTo:partials.standard_nacl_article}}
2 2
3 <section id="native-client-manifest-nmf-format"> 3 <section id="native-client-manifest-nmf-format">
4 <h1 id="native-client-manifest-nmf-format">Native Client Manifest (nmf) Format</ h1> 4 <h1 id="native-client-manifest-nmf-format">Native Client Manifest (nmf) Format</ h1>
5 <div class="contents local" id="contents" style="display: none"> 5 <div class="contents local" id="contents" style="display: none">
6 <ul class="small-gap"> 6 <ul class="small-gap">
7 <li><a class="reference internal" href="#overview" id="id1">Overview</a></li> 7 <li><a class="reference internal" href="#overview" id="id1">Overview</a></li>
8 <li><a class="reference internal" href="#field-summary" id="id2">Field summary</ a></li> 8 <li><a class="reference internal" href="#field-summary" id="id2">Field summary</ a></li>
9 <li><p class="first"><a class="reference internal" href="#field-details" id="id3 ">Field details</a></p> 9 <li><p class="first"><a class="reference internal" href="#field-details" id="id3 ">Field details</a></p>
10 <ul class="small-gap"> 10 <ul class="small-gap">
11 <li><a class="reference internal" href="#program" id="id4">program</a></li> 11 <li><a class="reference internal" href="#program" id="id4">program</a></li>
12 <li><a class="reference internal" href="#files" id="id5">files</a></li> 12 <li><a class="reference internal" href="#files" id="id5">files</a></li>
13 </ul> 13 </ul>
14 </li> 14 </li>
15 <li><p class="first"><a class="reference internal" href="#semantics" id="id6">Se mantics</a></p> 15 <li><p class="first"><a class="reference internal" href="#semantics" id="id6">Se mantics</a></p>
16 <ul class="small-gap"> 16 <ul class="small-gap">
17 <li><a class="reference internal" href="#schema-validation" id="id7">Schema vali dation</a></li> 17 <li><a class="reference internal" href="#schema-validation" id="id7">Schema vali dation</a></li>
18 <li><a class="reference internal" href="#nexe-matching" id="id8">Nexe matching</ a></li> 18 <li><a class="reference internal" href="#nexe-matching" id="id8">Nexe matching</ a></li>
19 <li><a class="reference internal" href="#file-matching" id="id9">File matching</ a></li> 19 <li><a class="reference internal" href="#file-matching" id="id9">File matching</ a></li>
20 <li><a class="reference internal" href="#url-of-the-nmf-file-from-embed-src-and- data-uri" id="id10">URL of the nmf file, from <code>&lt;embed&gt;</code> src, an d data URI</a></li> 20 <li><a class="reference internal" href="#url-of-the-nmf-file-from-embed-src-and- data-uri" id="id10">URL of the nmf file, from <code>&lt;embed&gt;</code> src, an d data URI</a></li>
21 <li><a class="reference internal" href="#url-resolution" id="id11">URL resolutio n</a></li> 21 <li><a class="reference internal" href="#url-resolution" id="id11">URL resolutio n</a></li>
22 </ul> 22 </ul>
23 </li> 23 </li>
24 </ul> 24 </ul>
25 25
26 </div><section id="overview"> 26 </div><h2 id="overview">Overview</h2>
27 <h2 id="overview">Overview</h2>
28 <p>Every Native Client application has a <a class="reference external" href="htt p://www.json.org/">JSON-formatted</a> 27 <p>Every Native Client application has a <a class="reference external" href="htt p://www.json.org/">JSON-formatted</a>
29 NaCl Manifest File (<code>nmf</code>). The <code>nmf</code> tells the browser wh ere to 28 NaCl Manifest File (<code>nmf</code>). The <code>nmf</code> tells the browser wh ere to
30 download and load your Native Client application files and libraries. 29 download and load your Native Client application files and libraries.
31 The file can also contain configuration options.</p> 30 The file can also contain configuration options.</p>
32 </section><section id="field-summary">
33 <h2 id="field-summary">Field summary</h2> 31 <h2 id="field-summary">Field summary</h2>
34 <p>The following shows the supported top-level manifest fields. There is one 32 <p>The following shows the supported top-level manifest fields. There is one
35 section that discusses each field in detail. The only field that is required 33 section that discusses each field in detail. The only field that is required
36 is the <code>program</code> field.</p> 34 is the <code>program</code> field.</p>
37 <pre class="prettyprint"> 35 <pre class="prettyprint">
38 { 36 {
39 // Required 37 // Required
40 &quot;program&quot;: { ... } 38 &quot;program&quot;: { ... }
41 39
42 // Only required for glibc 40 // Only required for glibc
43 &quot;files&quot;: { ... } 41 &quot;files&quot;: { ... }
44 } 42 }
45 </pre> 43 </pre>
46 </section><section id="field-details">
47 <h2 id="field-details">Field details</h2> 44 <h2 id="field-details">Field details</h2>
48 <section id="program">
49 <h3 id="program">program</h3> 45 <h3 id="program">program</h3>
50 <p>The <code>program</code> field specifies the main program that will be loaded 46 <p>The <code>program</code> field specifies the main program that will be loaded
51 in the Native Client runtime environment. For a Portable Native Client 47 in the Native Client runtime environment. For a Portable Native Client
52 application, this is a URL for the statically linked bitcode <code>pexe</code> f ile. 48 application, this is a URL for the statically linked bitcode <code>pexe</code> f ile.
53 For architecture-specific Native Client applications, this is a list 49 For architecture-specific Native Client applications, this is a list
54 of URLs, one URL for each supported architecture (currently the choices 50 of URLs, one URL for each supported architecture (currently the choices
55 are &#8220;arm&#8221;, &#8220;x86-32&#8221;, and &#8220;x86-64&#8221;). For a dy namically linked executable, 51 are &#8220;arm&#8221;, &#8220;x86-32&#8221;, and &#8220;x86-64&#8221;). For a dy namically linked executable,
56 <code>program</code> is the dynamic loader used to load the dynamic executable 52 <code>program</code> is the dynamic loader used to load the dynamic executable
57 and its dynamic libraries. See the <a class="reference internal" href="#nmf-url -resolution"><em>semantics</em></a> 53 and its dynamic libraries. See the <a class="reference internal" href="#nmf-url -resolution"><em>semantics</em></a>
58 section for the rules on URL resolution.</p> 54 section for the rules on URL resolution.</p>
59 <section id="example-of-a-program-for-portable-native-client">
60 <h4 id="example-of-a-program-for-portable-native-client">Example of a <code>prog ram</code> for Portable Native Client:</h4> 55 <h4 id="example-of-a-program-for-portable-native-client">Example of a <code>prog ram</code> for Portable Native Client:</h4>
61 <pre class="prettyprint"> 56 <pre class="prettyprint">
62 { 57 {
63 &quot;program&quot;: { 58 &quot;program&quot;: {
64 &quot;portable&quot;: { 59 &quot;portable&quot;: {
65 // Required 60 // Required
66 &quot;pnacl-translate&quot;: { 61 &quot;pnacl-translate&quot;: {
67 // url is required 62 // url is required
68 &quot;url&quot;: &quot;url_to_my_pexe&quot;, 63 &quot;url&quot;: &quot;url_to_my_pexe&quot;,
69 64
(...skipping 20 matching lines...) Expand all
90 The default is <code>optlevel</code> is currently <code>2</code>, and values hig her 85 The default is <code>optlevel</code> is currently <code>2</code>, and values hig her
91 than 2 are no different than 2. If compute speed is not as important 86 than 2 are no different than 2. If compute speed is not as important
92 as first load speed, an application could specify an <code>optlevel</code> 87 as first load speed, an application could specify an <code>optlevel</code>
93 of <code>0</code>. Note that <code>optlevel</code> is only a <em>hint</em>. In t he future, the 88 of <code>0</code>. Note that <code>optlevel</code> is only a <em>hint</em>. In t he future, the
94 Portable Native Client translator and runtime may <em>automatically</em> choose 89 Portable Native Client translator and runtime may <em>automatically</em> choose
95 an <code>optlevel</code> to best balance load time and application performance.< /p> 90 an <code>optlevel</code> to best balance load time and application performance.< /p>
96 <p>A <code>pnacl-debug</code> section can specify an unfinalized pnacl llvm bitc ode file 91 <p>A <code>pnacl-debug</code> section can specify an unfinalized pnacl llvm bitc ode file
97 for debugging. The <code>url</code> provided in this section will be used when N ative 92 for debugging. The <code>url</code> provided in this section will be used when N ative
98 Client debugging is enabled with either the <code>--enable-nacl-debug</code> Chr ome 93 Client debugging is enabled with either the <code>--enable-nacl-debug</code> Chr ome
99 command line switch, or via <code>about://flags</code>.</p> 94 command line switch, or via <code>about://flags</code>.</p>
100 </section><section id="example-of-a-program-for-statically-linked-native-client- executables">
101 <h4 id="example-of-a-program-for-statically-linked-native-client-executables">Ex ample of a <code>program</code> for statically linked Native Client executables< /h4> 95 <h4 id="example-of-a-program-for-statically-linked-native-client-executables">Ex ample of a <code>program</code> for statically linked Native Client executables< /h4>
102 <pre class="prettyprint"> 96 <pre class="prettyprint">
103 { 97 {
104 &quot;program&quot;: { 98 &quot;program&quot;: {
105 // Required: at least one entry 99 // Required: at least one entry
106 // Add one of these for each architecture supported by the application. 100 // Add one of these for each architecture supported by the application.
107 &quot;arm&quot;: { &quot;url&quot;: &quot;url_to_arm_nexe&quot; }, 101 &quot;arm&quot;: { &quot;url&quot;: &quot;url_to_arm_nexe&quot; },
108 &quot;x86-32&quot;: { &quot;url&quot;: &quot;url_to_x86_32_nexe&quot; }, 102 &quot;x86-32&quot;: { &quot;url&quot;: &quot;url_to_x86_32_nexe&quot; },
109 &quot;x86-64&quot;: { &quot;url&quot;: &quot;url_to_x86_64_nexe&quot; } 103 &quot;x86-64&quot;: { &quot;url&quot;: &quot;url_to_x86_64_nexe&quot; }
110 } 104 }
111 } 105 }
112 </pre> 106 </pre>
113 </section><section id="example-of-a-program-for-dynamically-linked-native-client -executables">
114 <h4 id="example-of-a-program-for-dynamically-linked-native-client-executables">E xample of a <code>program</code> for dynamically linked Native Client executable s</h4> 107 <h4 id="example-of-a-program-for-dynamically-linked-native-client-executables">E xample of a <code>program</code> for dynamically linked Native Client executable s</h4>
115 <pre class="prettyprint"> 108 <pre class="prettyprint">
116 { 109 {
117 &quot;program&quot;: { 110 &quot;program&quot;: {
118 // Required: at least one entry 111 // Required: at least one entry
119 // Add one of these for each architecture supported by the application. 112 // Add one of these for each architecture supported by the application.
120 &quot;x86-32&quot;: { &quot;url&quot;: &quot;lib32/runnable-ld.so&quot; }, 113 &quot;x86-32&quot;: { &quot;url&quot;: &quot;lib32/runnable-ld.so&quot; },
121 &quot;x86-64&quot;: { &quot;url&quot;: &quot;lib64/runnable-ld.so&quot; } 114 &quot;x86-64&quot;: { &quot;url&quot;: &quot;lib64/runnable-ld.so&quot; }
122 }, 115 },
123 // discussed in next section 116 // discussed in next section
124 &quot;files&quot;: { 117 &quot;files&quot;: {
125 &quot;main.nexe&quot;: { 118 &quot;main.nexe&quot;: {
126 &quot;x86-32&quot;: { &quot;url&quot;: &quot;url_to_x86_32_nexe&quot; }, 119 &quot;x86-32&quot;: { &quot;url&quot;: &quot;url_to_x86_32_nexe&quot; },
127 &quot;x86-64&quot;: { &quot;url&quot;: &quot;url_to_x86_64_nexe&quot; } 120 &quot;x86-64&quot;: { &quot;url&quot;: &quot;url_to_x86_64_nexe&quot; }
128 }, 121 },
129 // ... 122 // ...
130 } 123 }
131 } 124 }
132 </pre> 125 </pre>
133 </section></section><section id="files">
134 <h3 id="files">files</h3> 126 <h3 id="files">files</h3>
135 <p>The <code>files</code> field specifies a dictionary of file resources to be u sed by a 127 <p>The <code>files</code> field specifies a dictionary of file resources to be u sed by a
136 Native Client application. This is not supported and not needed by Portable 128 Native Client application. This is not supported and not needed by Portable
137 Native Client applications (use the PPAPI <a class="reference external" href="/n ative-client/pepper_stable/cpp/classpp_1_1_u_r_l_loader">URL Loader interfaces</ a> to load resources 129 Native Client applications (use the PPAPI <a class="reference external" href="/n ative-client/pepper_stable/cpp/classpp_1_1_u_r_l_loader">URL Loader interfaces</ a> to load resources
138 instead). However, the <code>files</code> manifest field is important for dynami cally 130 instead). However, the <code>files</code> manifest field is important for dynami cally
139 linked executables, which must load files before PPAPI is initialized. The 131 linked executables, which must load files before PPAPI is initialized. The
140 <code>files</code> dictionary should include the main dynamic program and its dy namic 132 <code>files</code> dictionary should include the main dynamic program and its dy namic
141 libraries. There should be one file entry that corresponds to each a dynamic 133 libraries. There should be one file entry that corresponds to each a dynamic
142 library. Each file entry is a dictionary of supported architectures and the 134 library. Each file entry is a dictionary of supported architectures and the
143 URLs where the appropriate Native Client shared object (<code>.so</code>) for th at 135 URLs where the appropriate Native Client shared object (<code>.so</code>) for th at
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 </pre> 178 </pre>
187 <p>Dynamic libraries that the dynamic program depends upon and links in at progr am 179 <p>Dynamic libraries that the dynamic program depends upon and links in at progr am
188 startup must be listed in the <code>files</code> dictionary. Library files that are 180 startup must be listed in the <code>files</code> dictionary. Library files that are
189 loaded after startup using <code>dlopen()</code> should either be listed in the <code>files</code> 181 loaded after startup using <code>dlopen()</code> should either be listed in the <code>files</code>
190 dictionary, or should be made accessible by the <code>nacl_io</code> library. T he 182 dictionary, or should be made accessible by the <code>nacl_io</code> library. T he
191 <code>nacl_io</code> library provides various file system <em>mounts</em> such a s HTTP-based 183 <code>nacl_io</code> library provides various file system <em>mounts</em> such a s HTTP-based
192 file systems and memory-based file systems. The Native Client SDK includes 184 file systems and memory-based file systems. The Native Client SDK includes
193 helpful tools for determining library dependencies and generating NaCl manifest 185 helpful tools for determining library dependencies and generating NaCl manifest
194 files for programs that that use dynamic linking. See 186 files for programs that that use dynamic linking. See
195 <a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loa ding.html#dynamic-loading-manifest"><em>Generating a Native Client manifest file for a dynamically linked application</em></a>.</p> 187 <a class="reference internal" href="/native-client/devguide/devcycle/dynamic-loa ding.html#dynamic-loading-manifest"><em>Generating a Native Client manifest file for a dynamically linked application</em></a>.</p>
196 </section></section><section id="semantics">
197 <h2 id="semantics">Semantics</h2> 188 <h2 id="semantics">Semantics</h2>
198 <section id="schema-validation">
199 <h3 id="schema-validation">Schema validation</h3> 189 <h3 id="schema-validation">Schema validation</h3>
200 <p>Manifests are validated before the program files are downloaded. 190 <p>Manifests are validated before the program files are downloaded.
201 Schema validation checks the following properties:</p> 191 Schema validation checks the following properties:</p>
202 <ul class="small-gap"> 192 <ul class="small-gap">
203 <li>The schema must be valid JSON.</li> 193 <li>The schema must be valid JSON.</li>
204 <li>The schema must conform to the grammar given above.</li> 194 <li>The schema must conform to the grammar given above.</li>
205 <li>If the program is not a PNaCl program, then the manifest 195 <li>If the program is not a PNaCl program, then the manifest
206 must contain at least one applicable match for the current ISA 196 must contain at least one applicable match for the current ISA
207 in &#8220;program&#8221; and in every entry within &#8220;files&#8221;.</li> 197 in &#8220;program&#8221; and in every entry within &#8220;files&#8221;.</li>
208 </ul> 198 </ul>
209 <p>If the manifest contains a field that is not in the official 199 <p>If the manifest contains a field that is not in the official
210 set of supported fields, it is ignored. This allows the grammar to be 200 set of supported fields, it is ignored. This allows the grammar to be
211 extended without breaking compatibility with older browsers.</p> 201 extended without breaking compatibility with older browsers.</p>
212 </section><section id="nexe-matching">
213 <h3 id="nexe-matching">Nexe matching</h3> 202 <h3 id="nexe-matching">Nexe matching</h3>
214 <p>For Portable Native Client, there are no architecture variations, so 203 <p>For Portable Native Client, there are no architecture variations, so
215 matching is simple.</p> 204 matching is simple.</p>
216 <p>For Native Client, the main nexe for the application is determined by 205 <p>For Native Client, the main nexe for the application is determined by
217 looking up the browser&#8217;s current architecture in the <code>&quot;program&q uot;</code> 206 looking up the browser&#8217;s current architecture in the <code>&quot;program&q uot;</code>
218 dictionary. Failure to provide an entry for the browser&#8217;s architecture 207 dictionary. Failure to provide an entry for the browser&#8217;s architecture
219 will result in a load error.</p> 208 will result in a load error.</p>
220 </section><section id="file-matching">
221 <h3 id="file-matching">File matching</h3> 209 <h3 id="file-matching">File matching</h3>
222 <p>All files (shared objects and other assets, typically) are looked up 210 <p>All files (shared objects and other assets, typically) are looked up
223 by a UTF8 string that is the file name. To load a library with a certain 211 by a UTF8 string that is the file name. To load a library with a certain
224 file name, the browser searches the <code>&quot;files&quot;</code> dictionary fo r an entry 212 file name, the browser searches the <code>&quot;files&quot;</code> dictionary fo r an entry
225 corresponding to that file name. Failure to find that name in the 213 corresponding to that file name. Failure to find that name in the
226 <code>&quot;files&quot;</code> dictionary is a run-time error. The architecture matching 214 <code>&quot;files&quot;</code> dictionary is a run-time error. The architecture matching
227 rule for all files is from most to least specific. That is, if there 215 rule for all files is from most to least specific. That is, if there
228 is an exact match for the current architecture (e.g., &#8220;x86-32&#8221;) it i s 216 is an exact match for the current architecture (e.g., &#8220;x86-32&#8221;) it i s
229 used in preference to more general &#8220;portable&#8221;. This is useful for 217 used in preference to more general &#8220;portable&#8221;. This is useful for
230 non-architecture-specific asset files. Note that <code>&quot;files&quot;</code> is only 218 non-architecture-specific asset files. Note that <code>&quot;files&quot;</code> is only
231 useful for files that must be loaded early in application startup 219 useful for files that must be loaded early in application startup
232 (before PPAPI interfaces are initialized to provide the standard 220 (before PPAPI interfaces are initialized to provide the standard
233 file loading mechanisms).</p> 221 file loading mechanisms).</p>
234 </section><section id="url-of-the-nmf-file-from-embed-src-and-data-uri">
235 <h3 id="url-of-the-nmf-file-from-embed-src-and-data-uri">URL of the nmf file, fr om <code>&lt;embed&gt;</code> src, and data URI</h3> 222 <h3 id="url-of-the-nmf-file-from-embed-src-and-data-uri">URL of the nmf file, fr om <code>&lt;embed&gt;</code> src, and data URI</h3>
236 <p>The URL for the manifest file should be specified by the <code>src</code> att ribute 223 <p>The URL for the manifest file should be specified by the <code>src</code> att ribute
237 of the <code>&lt;embed&gt;</code> tag for a Native Client module instance. The U RL for 224 of the <code>&lt;embed&gt;</code> tag for a Native Client module instance. The U RL for
238 a manifest file can refer to an actual file, or it can be a 225 a manifest file can refer to an actual file, or it can be a
239 <a class="reference external" href="http://en.wikipedia.org/wiki/Data_URI_scheme ">data URI</a> 226 <a class="reference external" href="http://en.wikipedia.org/wiki/Data_URI_scheme ">data URI</a>
240 representing the contents of the file. Specifying the <code>nmf</code> contents 227 representing the contents of the file. Specifying the <code>nmf</code> contents
241 inline with a data URI can help reduce the amount of network traffic 228 inline with a data URI can help reduce the amount of network traffic
242 required to load the Native Client application.</p> 229 required to load the Native Client application.</p>
243 </section><section id="url-resolution"> 230 <h3 id="url-resolution"><span id="nmf-url-resolution"></span>URL resolution</h3>
244 <span id="nmf-url-resolution"></span><h3 id="url-resolution"><span id="nmf-url-r esolution"></span>URL resolution</h3>
245 <p>All URLs contained in a manifest are resolved relative to the URL of 231 <p>All URLs contained in a manifest are resolved relative to the URL of
246 the manifest. If the manifest was specified as a data URI, the URLs must 232 the manifest. If the manifest was specified as a data URI, the URLs must
247 all be absolute.</p> 233 all be absolute.</p>
248 </section></section></section> 234 </section>
249 235
250 {{/partials.standard_nacl_article}} 236 {{/partials.standard_nacl_article}}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698