OLD | NEW |
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 <title><TITLE></title> | 9 <title><TITLE></title> |
10 <meta http-equiv="Pragma" content="no-cache"> | 10 <meta http-equiv="Pragma" content="no-cache"> |
(...skipping 22 matching lines...) Expand all Loading... |
33 | 33 |
34 function cancelQueue() { | 34 function cancelQueue() { |
35 if (common.naclModule == null) { | 35 if (common.naclModule == null) { |
36 console.log('Module is not loaded.'); | 36 console.log('Module is not loaded.'); |
37 return; | 37 return; |
38 } | 38 } |
39 common.naclModule.postMessage('CANCEL'); | 39 common.naclModule.postMessage('CANCEL'); |
40 } | 40 } |
41 </script> | 41 </script> |
42 </head> | 42 </head> |
43 <body onload="common.onload('<NAME>', '<tc>')"> | 43 <body onload="common.onload('<NAME>', '<tc>', '<config>')"> |
44 <h1><TITLE></h1> | 44 <h1><TITLE></h1> |
45 <h2>Status: <code id="statusField">NO-STATUS</code></h2> | 45 <h2>Status: <code id="statusField">NO-STATUS</code></h2> |
46 <button onclick="cancelQueue()">Kill worker thread and queue</button> | 46 <button onclick="cancelQueue()">Kill worker thread and queue</button> |
47 | 47 |
48 <p>This example demonstrates handling of input events in PPAPI.</p> | 48 <p>This example demonstrates handling of input events in PPAPI.</p> |
49 <p>Each time an input event happens in the context of the gray box, the main | 49 <p>Each time an input event happens in the context of the gray box, the main |
50 thread in the embedded NaCl module converts it from a Pepper input event to a | 50 thread in the embedded NaCl module converts it from a Pepper input event to a |
51 non-Pepper event and puts this custom event onto a shared queue. A worker | 51 non-Pepper event and puts this custom event onto a shared queue. A worker |
52 thread in the embedded NaCl module reads events from the queue, and converts | 52 thread in the embedded NaCl module reads events from the queue, and converts |
53 each event to a string and then uses CallOnMainThread to post a message | 53 each event to a string and then uses CallOnMainThread to post a message |
54 describing the event back to JavaScript, which prints a message to the | 54 describing the event back to JavaScript, which prints a message to the |
55 JavaScript console in Chrome and to a string on the page.</p> | 55 JavaScript console in Chrome and to a string on the page.</p> |
56 <p>If you press the 'Kill worker thread and queue' button, then the main | 56 <p>If you press the 'Kill worker thread and queue' button, then the main |
57 thread (which puts events on the queue) will call CancelQueue, indicating | 57 thread (which puts events on the queue) will call CancelQueue, indicating |
58 that the main thread will no longer put events on the queue. When the worker | 58 that the main thread will no longer put events on the queue. When the worker |
59 sees that the shared queue has been cancelled, the worker thread will | 59 sees that the shared queue has been cancelled, the worker thread will |
60 terminate.</p> | 60 terminate.</p> |
61 | 61 |
62 <!-- The NaCl plugin will be embedded inside the element with id "listener". | 62 <!-- The NaCl plugin will be embedded inside the element with id "listener". |
63 See common.js.--> | 63 See common.js.--> |
64 <div id="listener"></div> | 64 <div id="listener"></div> |
65 <h2>Events</h2> | 65 <h2>Events</h2> |
66 <pre> | 66 <pre> |
67 <p><b id='eventString'>None</b></p> | 67 <p><b id='eventString'>None</b></p> |
68 </pre> | 68 </pre> |
69 </body> | 69 </body> |
70 </html> | 70 </html> |
OLD | NEW |