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

Side by Side Diff: native_client_sdk/src/examples/input_events/index.html

Issue 13488007: [NaCl SDK] Make the SDK examples buildable as a packaged app. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix license headers Created 7 years, 8 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 <!DOCTYPE html> 1 <!DOCTYPE html>
2 <html> 2 <html>
3 <!-- 3 <!--
4 Copyright (c) 2012 The Chromium Authors. All rights reserved. 4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
5 Use of this source code is governed by a BSD-style license that can be 5 Use of this source code is governed by a BSD-style license that can be
6 found in the LICENSE file. 6 found in the LICENSE file.
7 --> 7 -->
8 <head> 8 <head>
9 <meta http-equiv="Pragma" content="no-cache"> 9 <meta http-equiv="Pragma" content="no-cache">
10 <meta http-equiv="Expires" content="-1"> 10 <meta http-equiv="Expires" content="-1">
11 <title>{{title}}</title> 11 <title>{{title}}</title>
12 <script type="text/javascript" src="common.js"></script> 12 <script type="text/javascript" src="common.js"></script>
13 <script type="text/javascript" src="example.js"></script> 13 <script type="text/javascript" src="example.js"></script>
14 </head> 14 </head>
15 <body {{attrs}}> 15 <body {{attrs}}>
16 <h1>{{title}}</h1> 16 <h1>{{title}}</h1>
17 <h2>Status: <code id="statusField">NO-STATUS</code></h2> 17 <h2>Status: <code id="statusField">NO-STATUS</code></h2>
18 <button id="killButton">Kill worker thread and queue</button> 18 <p>The Input Events example shows how to handle input events in a
19 19 multi-threaded application. The main thread converts input events to
20 <p>This example demonstrates handling of input events in PPAPI.</p> 20 non-pepper events and puts them on a queue. The worker thread pulls them
21 <p>Each time an input event happens in the context of the gray box, the main 21 off of the queue, converts them to a string, and then uses
22 thread in the embedded NaCl module converts it from a Pepper input event to a 22 CallOnMainThread so that PostMessage can be send the result of the worker
23 non-Pepper event and puts this custom event onto a shared queue. A worker 23 thread to the browser.</p>
24 thread in the embedded NaCl module reads events from the queue, and converts
25 each event to a string and then uses CallOnMainThread to post a message
26 describing the event back to JavaScript, which prints a message to the
27 JavaScript console in Chrome and to a string on the page.</p>
28 <p>If you press the 'Kill worker thread and queue' button, then the main 24 <p>If you press the 'Kill worker thread and queue' button, then the main
29 thread (which puts events on the queue) will call CancelQueue, indicating 25 thread (which puts events on the queue) will call CancelQueue, indicating
30 that the main thread will no longer put events on the queue. When the worker 26 that the main thread will no longer put events on the queue. When the worker
31 sees that the shared queue has been cancelled, the worker thread will 27 sees that the shared queue has been cancelled, the worker thread will
32 terminate.</p> 28 terminate.</p>
33 29
30 <button id="killButton">Kill worker thread and queue</button>
31
34 <!-- The NaCl plugin will be embedded inside the element with id "listener". 32 <!-- The NaCl plugin will be embedded inside the element with id "listener".
35 See common.js.--> 33 See common.js.-->
36 <div id="listener"></div> 34 <div id="listener"></div>
37 <h2>Events</h2> 35 <h2>Events:</h2>
38 <pre> 36 <pre id="log" style="font-weight: bold"></pre>
39 <p><b id='eventString'>None</b></p>
40 </pre>
41 </body> 37 </body>
42 </html> 38 </html>
OLDNEW
« no previous file with comments | « native_client_sdk/src/examples/input_events/example.js ('k') | native_client_sdk/src/examples/input_events/input_events.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698