| OLD | NEW |
| 1 .. _devcycle-progress-events: | 1 .. _devcycle-progress-events: |
| 2 | 2 |
| 3 :template: standard_nacl_api | |
| 4 | |
| 5 ############### | 3 ############### |
| 6 Progress Events | 4 Progress Events |
| 7 ############### | 5 ############### |
| 8 | 6 |
| 9 .. contents:: | 7 .. contents:: |
| 10 :local: | 8 :local: |
| 11 :backlinks: none | 9 :backlinks: none |
| 12 :depth: 2 | 10 :depth: 2 |
| 13 | 11 |
| 14 There are five types of events that developers can respond to in Native Client: | 12 There are five types of events that developers can respond to in Native Client: |
| (...skipping 13 matching lines...) Expand all Loading... |
| 28 Module loading and progress events | 26 Module loading and progress events |
| 29 ================================== | 27 ================================== |
| 30 | 28 |
| 31 The Native Client runtime reports a set of state changes during the module | 29 The Native Client runtime reports a set of state changes during the module |
| 32 loading process by means of DOM progress events. This set of events is a direct | 30 loading process by means of DOM progress events. This set of events is a direct |
| 33 port of the proposed W3C `Progress Events | 31 port of the proposed W3C `Progress Events |
| 34 <http://www.w3.org/TR/progress-events/>`_ standard (except for the ``crash`` | 32 <http://www.w3.org/TR/progress-events/>`_ standard (except for the ``crash`` |
| 35 event which is an extension of the W3C standard). The following table lists the | 33 event which is an extension of the W3C standard). The following table lists the |
| 36 events types reported by the Native Client runtime: | 34 events types reported by the Native Client runtime: |
| 37 | 35 |
| 38 +-------------+--------------------+-----------+---------------+---------------+ | 36 +----------------------------------+-----------+---------------+---------------+ |
| 39 | Event | Description | Number of | When event is | How you might | | 37 | Event | Times | When | How you might | |
| 40 | | | times | triggered | react to | | 38 | | triggered | triggered | respond | |
| 41 | | | triggered | | event | | 39 +==================================+===========+===============+===============+ |
| 42 +=============+====================+===========+===============+===============+ | 40 |``loadstart`` | once | The | Display a | |
| 43 |``loadstart``| Native Client has | once | This is the | Display a | | 41 | Native Client has started to | | first | status | |
| 44 | | started to load a | | first | status | | 42 | load a Native Client module. | | progress | message, such | |
| 45 | | Native Client | | progress | message, such | | 43 | | | event | as | |
| 46 | | module. | | event | as | | 44 | | | after the | "Loading..." | |
| 47 | | | | triggered | "Loading..." | | 45 | | | Native Client | | |
| 48 | | | | after the | | | 46 | | | module is | | |
| 49 | | | | Native Client | | | 47 | | | instantiated | | |
| 50 | | | | module is | | | 48 | | | and | | |
| 51 | | | | instantiated | | | 49 | | | initialized. | | |
| 52 | | | | and | | | 50 +----------------------------------+-----------+---------------+---------------+ |
| 53 | | | | initialized. | | | 51 |``progress`` | zero or | After | Display a | |
| 54 +-------------+--------------------+-----------+---------------+---------------+ | 52 | Part of the module has been | more | ``loadstart`` | progress bar. | |
| 55 |``progress`` | Part of the module | zero or | After | Display a | | 53 | loaded. | | has been | | |
| 56 | | has been loaded. | more | ``loadstart`` | progress bar. | | 54 | | | dispatched. | | |
| 57 | | | | has been | | | 55 +----------------------------------+-----------+---------------+---------------+ |
| 58 | | | | dispatched. | | | 56 |``error`` | zero or | After the last| Inform user | |
| 59 +-------------+--------------------+-----------+---------------+---------------+ | 57 | The Native Client module failed | once | ``progress`` | that the | |
| 60 |``error`` | The Native Client | zero or | After the | Inform user | | 58 | to start execution (includes any| | event has been| application | |
| 61 | | module failed to | once | last | that the | | 59 | error before or during | | dispatched, | failed to | |
| 62 | | start execution | | ``progress`` | application | | 60 | initialization of the module). | | or after | load. | |
| 63 | | (includes any | | event has | failed to | | 61 | The ``lastError`` attribute | | ``loadstart`` | | |
| 64 | | error before or | | been | load. | | 62 | (mentioned later) provides | | if no | | |
| 65 | | during | | dispatched, | | | 63 | details on the error | | ``progress`` | | |
| 66 | | initialization of | | or after | | | 64 | (initialization failed, sel_ldr | | event was | | |
| 67 | | the module). The | | ``loadstart`` | | | 65 | did not start, and so on). | | dispatched. | | |
| 68 | | ``lastError`` | | if no | | | 66 +----------------------------------+-----------+---------------+---------------+ |
| 69 | | attribute | | ``progress`` | | | 67 |``abort`` | zero or | After the last| It's not | |
| 70 | | (mentioned later) | | event was | | | 68 | Loading of the NativeClient | once | ``progress`` | likely you | |
| 71 | | provides details | | dispatched. | | | 69 | module was aborted by the user. | | event has been| will want to | |
| 72 | | on the error | | | | | 70 | | | dispatched, or| | |
| 73 | | (initialization | | | | | 71 | | | after | | |
| 74 | | failed, sel_ldr | | | | | 72 | | | ``loadstart`` | | |
| 75 | | did not start, | | | | | 73 | | | if no | | |
| 76 | | and so on). | | | | | 74 | | | ``progress`` | | |
| 77 +-------------+--------------------+-----------+---------------+---------------+ | 75 | | | event was | | |
| 78 |``abort`` | Loading of the | zero or | After the | It's not | | 76 | | | dispatched. | | |
| 79 | | Native Client | once | last | likely you | | 77 +----------------------------------+-----------+---------------+---------------+ |
| 80 | | module was | | ``progress`` | will want to | | 78 |``load`` | zero or | After the | Remove the | |
| 81 | | aborted by the | | event has | respond to | | 79 | The Native Client module was | once | last | progress bar. | |
| 82 | | user. | | been | this event. | | 80 | successfully loaded, and | | ``progress`` | | |
| 83 | | | | dispatched, | | | 81 | execution was started. | | event has been| | |
| 84 | | | | or after | | | 82 | (The module was initialized | | dispatched, or| | |
| 85 | | | | ``loadstart`` | | | 83 | successfully.) | | after | | |
| 86 | | | | if no | | | 84 | | | ``loadstart`` | | |
| 87 | | | | ``progress`` | | | 85 | | | if no | | |
| 88 | | | | event was | | | 86 | | | ``progress`` | | |
| 89 | | | | dispatched. | | | 87 | | | event was | | |
| 90 +-------------+--------------------+-----------+---------------+---------------+ | 88 | | | dispatched. | | |
| 91 |``load`` | The Native Client | zero or | After the | Remove the | | 89 +----------------------------------+-----------+---------------+---------------+ |
| 92 | | module was | once | last | progress bar. | | 90 |``loadend`` | once | After an | Indicate | |
| 93 | | successfully | | ``progress`` | | | 91 | Loading of the Native Client | | ``error``, | loading is | |
| 94 | | loaded, and | | event has | | | 92 | module has stopped. Load | | ``abort``, or | over | |
| 95 | | execution was | | been | | | 93 | succeeded (``load``), failed | | ``load`` | (regardless of| |
| 96 | | started. (The | | dispatched, | | | 94 | (``error``), or was aborted | | event was | failure or | |
| 97 | | module was | | or after | | | 95 | (``abort``). | | dispatched. | not). |
|
| 98 | | initialized | | ``loadstart`` | | | 96 +----------------------------------+-----------+---------------+---------------+ |
| 99 | | successfully.) | | if no | | | 97 |``crash`` | zero or | After a | Notify user | |
| 100 | | | | ``progress`` | | | 98 | The Native Client module is not | once | ``loadend``. | that the | |
| 101 | | | | event was | | | 99 | responding (died on an | | | module did | |
| 102 | | | | dispatched. | | | 100 | ``assert()`` or ``exit()``) | | | something | |
| 103 +-------------+--------------------+-----------+---------------+---------------+ | 101 | after a successful load. This | | | illegal. | |
| 104 |``loadend`` | Loading of the | once | After an | Indicate | | 102 | event is unique to Native Client| | | | |
| 105 | | Native Client | | ``error``, | loading is | | 103 | and is not part of the W3C | | | | |
| 106 | | module has | | ``abort``, or | over | | 104 | Progress Events standard. The | | | | |
| 107 | | stopped. Load | | ``load`` | (regardless | | 105 | ``exitStatus`` attribute | | | | |
| 108 | | succeeded | | event was | of failure or | | 106 | provides the numeric exit | | | | |
| 109 | | (``load``), | | dispatched. | not). | | 107 | status. | | | | |
| 110 | | failed | | | | | 108 +----------------------------------+-----------+---------------+---------------+ |
| 111 | | (``error``), or | | | | | |
| 112 | | was aborted | | | | | |
| 113 | | (``abort``). | | | | | |
| 114 +-------------+--------------------+-----------+---------------+---------------+ | |
| 115 |``crash`` | The Native Client | zero or | After a | Notify user | | |
| 116 | | module is not | once | ``loadend``. | that the | | |
| 117 | | responding (died | | | module did | | |
| 118 | | on an | | | something | | |
| 119 | | ``assert()`` or | | | illegal. | | |
| 120 | | ``exit()``) after | | | | | |
| 121 | | a successful | | | | | |
| 122 | | load. This event | | | | | |
| 123 | | is unique to | | | | | |
| 124 | | Native Client and | | | | | |
| 125 | | is not part of | | | | | |
| 126 | | the W3C Progress | | | | | |
| 127 | | Events standard. | | | | | |
| 128 | | The ``exitStatus`` | | | | | |
| 129 | | attribute provides | | | | | |
| 130 | | the numeric exit | | | | | |
| 131 | | status value. | | | | | |
| 132 +-------------+--------------------+-----------+---------------+---------------+ | |
| 133 | 109 |
| 134 The sequence of events for a successful module load is as follows: | 110 The sequence of events for a successful module load is as follows: |
| 135 | 111 |
| 136 =============================== =============================== | 112 =============================== =============================== |
| 137 Event is dispatched ... then this task is attempted | 113 Event is dispatched ... then this task is attempted |
| 138 =============================== =============================== | 114 =============================== =============================== |
| 139 ``loadstart`` load the manifest file | 115 ``loadstart`` load the manifest file |
| 140 ``progress`` (first time) load the module | 116 ``progress`` (first time) load the module |
| 141 ``progress`` (subsequent times) | 117 ``progress`` (subsequent times) |
| 142 ``load`` start executing the module | 118 ``load`` start executing the module |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 crash, the ``crash`` progress event is issued and the ``exitStatus`` attribute | 290 crash, the ``crash`` progress event is issued and the ``exitStatus`` attribute |
| 315 will contain the numeric value of the exit status: | 291 will contain the numeric value of the exit status: |
| 316 | 292 |
| 317 * In the case of explicit calls to ``exit(n)``, the numeric value will be | 293 * In the case of explicit calls to ``exit(n)``, the numeric value will be |
| 318 ``n`` (between 0 and 255). | 294 ``n`` (between 0 and 255). |
| 319 * In the case of crashes and calls to ``abort()``, the numeric value will | 295 * In the case of crashes and calls to ``abort()``, the numeric value will |
| 320 be non-zero, but the exact value will depend on the chosen libc and the | 296 be non-zero, but the exact value will depend on the chosen libc and the |
| 321 target architecture, and may change in the future. Applications should not | 297 target architecture, and may change in the future. Applications should not |
| 322 rely on the ``exitStatus`` value being stable in these cases, but the value | 298 rely on the ``exitStatus`` value being stable in these cases, but the value |
| 323 may nevertheless be useful for temporary debugging. | 299 may nevertheless be useful for temporary debugging. |
| OLD | NEW |