OLD | NEW |
1 /* Copyright 2014 The Chromium Authors. All rights reserved. | 1 /* Copyright 2014 The Chromium Authors. All rights reserved. |
2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
3 * found in the LICENSE file. | 3 * found in the LICENSE file. |
4 */ | 4 */ |
5 | 5 |
6 /** | 6 /** |
7 * This file defines the <code>PPP_MessageHandler</code> interface that plugins | 7 * This file defines the <code>PPP_MessageHandler</code> interface that plugins |
8 * can implement and register using PPB_Messaging::RegisterMessageHandler in | 8 * can implement and register using PPB_Messaging::RegisterMessageHandler in |
9 * order to handle messages sent from JavaScript via postMessage() or | 9 * order to handle messages sent from JavaScript via postMessage() or |
10 * postMessageAndAwaitResponse(). | 10 * postMessageAndAwaitResponse(). |
(...skipping 14 matching lines...) Expand all Loading... |
25 */ | 25 */ |
26 [no_interface_string] | 26 [no_interface_string] |
27 interface PPP_MessageHandler { | 27 interface PPP_MessageHandler { |
28 /** | 28 /** |
29 * Invoked as a result of JavaScript invoking postMessage() on the plugin's | 29 * Invoked as a result of JavaScript invoking postMessage() on the plugin's |
30 * DOM element. | 30 * DOM element. |
31 * | 31 * |
32 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 32 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
33 * of a module. | 33 * of a module. |
34 * @param[in] user_data is the same pointer which was provided by a call to | 34 * @param[in] user_data is the same pointer which was provided by a call to |
35 * RegisterMessageHandler. | 35 * RegisterMessageHandler(). |
36 * @param[in] message A copy of the parameter that JavaScript provided to | 36 * @param[in] message A copy of the parameter that JavaScript provided to |
37 * postMessage(). | 37 * postMessage(). |
38 */ | 38 */ |
39 void HandleMessage([in] PP_Instance instance, | 39 void HandleMessage([in] PP_Instance instance, |
40 [inout] mem_t user_data, | 40 [inout] mem_t user_data, |
41 [constptr_in] PP_Var message); | 41 [constptr_in] PP_Var message); |
42 /** | 42 /** |
43 * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() | 43 * Invoked as a result of JavaScript invoking postMessageAndAwaitResponse() |
44 * on the plugin's DOM element. | 44 * on the plugin's DOM element. |
45 * | 45 * |
| 46 * NOTE: JavaScript execution is blocked during the duration of this call. |
| 47 * Hence, the plugin should respond as quickly as possible. For this reason, |
| 48 * blocking completion callbacks are disallowed while handling a blocking |
| 49 * message. |
| 50 * |
46 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 51 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
47 * of a module. | 52 * of a module. |
48 * @param[in] user_data is the same pointer which was provided by a call to | 53 * @param[in] user_data is the same pointer which was provided by a call to |
49 * RegisterMessageHandler. | 54 * RegisterMessageHandler(). |
50 * @param[in] message is a copy of the parameter that JavaScript provided | 55 * @param[in] message is a copy of the parameter that JavaScript provided |
51 * to postMessageAndAwaitResponse. | 56 * to postMessageAndAwaitResponse(). |
52 * @param[out] response will be copied to a JavaScript object which is | 57 * @param[out] response will be copied to a JavaScript object which is |
53 * returned as the result of postMessageAndAwaitResponse to the invoking | 58 * returned as the result of postMessageAndAwaitResponse() to the invoking |
54 JavaScript. | 59 JavaScript. |
55 */ | 60 */ |
56 void HandleBlockingMessage([in] PP_Instance instance, | 61 void HandleBlockingMessage([in] PP_Instance instance, |
57 [inout] mem_t user_data, | 62 [inout] mem_t user_data, |
58 [constptr_in] PP_Var message, | 63 [constptr_in] PP_Var message, |
59 [out] PP_Var response); | 64 [out] PP_Var response); |
60 /** | 65 /** |
61 * Invoked when the handler object is no longer needed. After this, no more | 66 * Invoked when the handler object is no longer needed. After this, no more |
62 * calls will be made which pass this same value for <code>instance</code> | 67 * calls will be made which pass this same value for <code>instance</code> |
63 * and <code>user_data</code>. | 68 * and <code>user_data</code>. |
64 * | 69 * |
65 * @param[in] instance A <code>PP_Instance</code> identifying one instance | 70 * @param[in] instance A <code>PP_Instance</code> identifying one instance |
66 * of a module. | 71 * of a module. |
67 * @param[in] user_data is the same pointer which was provided by a call to | 72 * @param[in] user_data is the same pointer which was provided by a call to |
68 * RegisterMessageHandler. | 73 * RegisterMessageHandler. |
69 */ | 74 */ |
70 void Destroy([in] PP_Instance instance, [inout] mem_t user_data); | 75 void Destroy([in] PP_Instance instance, [inout] mem_t user_data); |
71 }; | 76 }; |
72 | 77 |
OLD | NEW |