X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=src%2Fnative_client_sdk%2Fdoc_generated%2Fdevguide%2Ftutorial%2Ftutorial-part2.html;h=72c33bed0c8c191f7b12b3491271fa7c9b845c8f;hb=4a1a0bdd01eef90b0826a0e761d3379d3715c10f;hp=7731fccd7e2193f929825abd5cd5ea12b3cb6058;hpb=b1be5ca53587d23e7aeb77b26861fdc0a181ffd8;p=platform%2Fframework%2Fweb%2Fcrosswalk.git diff --git a/src/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html b/src/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html index 7731fcc..72c33be 100644 --- a/src/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html +++ b/src/native_client_sdk/doc_generated/devguide/tutorial/tutorial-part2.html @@ -28,8 +28,7 @@
  • Example-specific behavior with example.js
  • -
    -

    Overview

    +

    Overview

    This tutorial shows how to convert the finished PNaCl web application from Part 1 to use the Native Client SDK build system and common JavaScript files. It also demonstrates some techniques to make your web @@ -42,13 +41,11 @@ your application.

    The finished code for this example can be found in the pepper_$(VERSION)/getting_started/part2 directory in the Native Client SDK download.

    -

    Using the Native Client SDK build system

    This section describes how to use the SDK build system. To do so, we’ll make changes in the makefile. Because the makefile in part1 and part2 are so different, it is easier to start from scratch. Here is the contents of the new makefile. The following sections will describe it in more detail.

    -

    Simplifying the Makefile

    The makefile from part1 only supports one toolchain (PNaCl) and one configuration (Release). It also only supports one source file. It’s relatively @@ -85,7 +82,6 @@ endif $(eval $(call NMF_RULE,$(TARGET),)) -

    Choosing valid toolchains, and including common.mk

    The makefile begins by specifying the toolchains that are valid for this project. The Native Client SDK build system supports multi-toolchain projects @@ -116,7 +112,6 @@ to compile and link a project, which we’ll use below.

     include $(NACL_SDK_ROOT)/tools/common.mk
     
    -

    Configuring your project

    After including tools/common.mk, we configure the project by specifying its name, the sources and libraries it uses:

    @@ -161,7 +156,6 @@ SOURCES = foo.cc \ baz.cc \ quux.cc -

    Build macros

    For many projects, the following build macros do not need to be changed; they will use the variables we’ve defined above.

    @@ -205,12 +199,10 @@ each executable generated in the previous step:

     $(eval $(call NMF_RULE,$(TARGET),))
     
    -

    Making index.html work for Chrome Apps

    This section describes the changes necessary to make the HTML and JavaScript in part1 CSP-compliant. This is required if you want to build a Chrome App, but is not necessary if you want to use PNaCl on the open web.

    -

    CSP rules

    Chrome Apps CSP restricts you from doing the following:

    @@ -223,7 +215,6 @@ iframe.
  • You can’t use string-to-JavaScript methods like eval() and new Function().
  • -

    Making index.html CSP-compliant

    To make our application CSP-compliant, we have to remove inline scripting. As described above, we can’t use inline <script> blocks or event handlers. This @@ -245,7 +236,6 @@ this example.

    ...

    This logic is now handled by common.js.

    -

    Making index.html support different toolchains and configurations

    Finally, there are a few changes to index.html that are not necessary for CSP-compliance, but help make the SDK examples more generic.

    @@ -275,14 +265,12 @@ here the common.js module creates a new <embed> element and adds it to the --> <div id="listener"></div> -

    Sharing common code with common.js

    common.js contains JavaScript code that each example uses to create a NaCl module, handle messages from that module and other common tasks like displaying the module load status and logging messages. Explaining all of common.js is outside the scope of this document, but please look at the documentation in that file for more information.

    -

    Loading the page and creating the module

    Since we’ve added <script> tags for common.js and example.js to the head element, they will be loaded and executed before the rest of the @@ -409,7 +397,6 @@ function moduleDidLoad() { } } -

    Example-specific behavior with example.js

    As described in the previous section, common.js will call certain functions during the module loading process. This example only needs to respond to two: @@ -436,6 +423,6 @@ function handleMessage(message) { logEl.textContent += message.data; } -

    + {{/partials.standard_nacl_article}}