diff options
author | jvoung@google.com <jvoung@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-17 19:23:56 +0000 |
---|---|---|
committer | jvoung@google.com <jvoung@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-17 19:23:56 +0000 |
commit | 235f2625e7144bae0564b5d9e04f940f556fdc10 (patch) | |
tree | 3e8096023c795792ef3d362f03d9fb89d262077f /native_client_sdk | |
parent | 1e5890fd8197cdf9f2eafba44070719dd99979d0 (diff) | |
download | chromium_src-235f2625e7144bae0564b5d9e04f940f556fdc10.zip chromium_src-235f2625e7144bae0564b5d9e04f940f556fdc10.tar.gz chromium_src-235f2625e7144bae0564b5d9e04f940f556fdc10.tar.bz2 |
[NaClDocs] Add a snippet about the exitStatus attribute (after crash)
Also add note about calling exit() being unnecessary.
BUG=323855
R=awatson@chromium.org, bsy@google.com
Review URL: https://codereview.chromium.org/108783002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@241331 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
3 files changed, 31 insertions, 2 deletions
diff --git a/native_client_sdk/src/doc/devguide/coding/application-structure.rst b/native_client_sdk/src/doc/devguide/coding/application-structure.rst index 5b673d5..14573f3 100644 --- a/native_client_sdk/src/doc/devguide/coding/application-structure.rst +++ b/native_client_sdk/src/doc/devguide/coding/application-structure.rst @@ -234,12 +234,20 @@ Below is the Instance class from the "Hello tutorial" example: As in the example above, the Instance class for your module will likely include -an implementation of the ``HandleMessage()`` funtion. The browser calls an +an implementation of the ``HandleMessage()`` function. The browser calls an instance's ``HandleMessage()`` function every time the JavaScript code in an application calls ``postMessage()`` to send a message to the instance. See the :doc:`Native Client messaging system<message-system>` for more information about how to send messages between JavaScript code and Native Client modules. +The NaCl code is only invoked to handle various browser-issued +events and callbacks. There is no need to shut down the NaCl instance by +calling the ``exit()`` function. NaCl modules will be shut down when the user +leaves the web page, or the NaCl module's ``<embed>`` is otherwise destroyed. +If the NaCl module does call the ``exit()`` function, the instance will +issue a ``crash`` event +:doc:`which can be handled in Javascript<progress-events>`. + While the ``CreateModule()`` factory function, the ``Module`` class, and the ``Instance`` class are required for a Native Client application, the code samples shown above don't actually do anything. Subsequent chapters in the diff --git a/native_client_sdk/src/doc/devguide/coding/native-client-modules.rst b/native_client_sdk/src/doc/devguide/coding/native-client-modules.rst index 3668167..ed2030d 100644 --- a/native_client_sdk/src/doc/devguide/coding/native-client-modules.rst +++ b/native_client_sdk/src/doc/devguide/coding/native-client-modules.rst @@ -184,7 +184,7 @@ Below is the Instance class from the "Hello tutorial" example: As in the example above, the Instance class for your module will likely include -an implementation of the ``HandleMessage()`` funtion. The browser calls an +an implementation of the ``HandleMessage()`` function. The browser calls an instance's ``HandleMessage()`` function every time the JavaScript code in an application calls ``postMessage()`` to send a message to the instance. See the :doc:`Native Client messaging system<message-system>` for more information about diff --git a/native_client_sdk/src/doc/devguide/coding/progress-events.rst b/native_client_sdk/src/doc/devguide/coding/progress-events.rst index ea6eccb..af0803f 100644 --- a/native_client_sdk/src/doc/devguide/coding/progress-events.rst +++ b/native_client_sdk/src/doc/devguide/coding/progress-events.rst @@ -123,6 +123,10 @@ events types reported by the Native Client runtime: | | is not part of | | | | | | the W3C Progress | | | | | | Events standard. | | | | +| | The ``exitStatus`` | | | | +| | attribute provides | | | | +| | the numeric exit | | | | +| | status value. | | | | +-------------+--------------------+-----------+---------------+---------------+ The sequence of events for a successful module load is as follows: @@ -298,3 +302,20 @@ the progress events are generated. </div> </body> </html> + +The ``exitStatus`` attribute +============================ + +This read-only attribute is set if the application calls ``exit(n)``, +``abort()``, or crashes. Since NaCl modules are event handlers, there is no +need to call ``exit(n)`` in normal execution. If the module does exit or +crash, the ``crash`` progress event is issued and the ``exitStatus`` attribute +will contain the numeric value of the exit status: + +* In the case of explicit calls to ``exit(n)``, the numeric value will be + ``n`` (between 0 and 255). +* In the case of crashes and calls to ``abort()``, the numeric value will + be non-zero, but the exact value will depend on the chosen libc and the + target architecture, and may change in the future. Applications should not + rely on the ``exitStatus`` value being stable in these cases, but the value + may nevertheless be useful for temporary debugging. |