1 <!DOCTYPE html> 2 <html> 3 <!-- 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 6 found in the LICENSE file. 7 --> 8 <head> 9 <meta http-equiv="Pragma" content="no-cache"> 10 <meta http-equiv="Expires" content="-1"> 11 <title>{{title}}</title> 12 <script type="text/javascript" src="common.js"></script> 13 <script type="text/javascript" src="example.js"></script> 14 </head> 15 <body {{attrs}}> 16 <h1>{{title}}</h1> 17 <h2>Status: <code id="statusField">NO-STATUS</code></h2> 18 <p>The Input Events example shows how to handle input events in a 19 multi-threaded application. The main thread converts input events to 20 non-pepper events and puts them on a queue. The worker thread pulls them 21 off of the queue, converts them to a string, and then uses 22 CallOnMainThread so that PostMessage can send the result of the worker 23 thread to the browser.</p> 24 <p>If you press the 'Kill worker thread and queue' button, then the main 25 thread (which puts events on the queue) will call CancelQueue, indicating 26 that the main thread will no longer put events on the queue. When the worker 27 sees that the shared queue has been cancelled, the worker thread will 28 terminate.</p> 29 30 <button id="killButton">Kill worker thread and queue</button> 31 32 <!-- The NaCl plugin will be embedded inside the element with id "listener". 33 See common.js.--> 34 <div id="listener"></div> 35 <h2>Events:</h2> 36 <pre id="log" style="font-weight: bold"></pre> 37 </body> 38 </html> 39