OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef PPAPI_HOST_HOST_MESSAGE_CONTEXT_H_ | 5 #ifndef PPAPI_HOST_HOST_MESSAGE_CONTEXT_H_ |
6 #define PPAPI_HOST_HOST_MESSAGE_CONTEXT_H_ | 6 #define PPAPI_HOST_HOST_MESSAGE_CONTEXT_H_ |
7 | 7 |
8 #include "ipc/ipc_message.h" | 8 #include "ipc/ipc_message.h" |
9 #include "ppapi/host/ppapi_host_export.h" | 9 #include "ppapi/host/ppapi_host_export.h" |
10 #include "ppapi/proxy/resource_message_params.h" | 10 #include "ppapi/proxy/resource_message_params.h" |
11 | 11 |
12 namespace ppapi { | 12 namespace ppapi { |
13 namespace host { | 13 namespace host { |
14 | 14 |
15 // This context structure provides information about outgoing resource message | 15 // This context structure provides information about outgoing resource message |
16 // replies. | 16 // replies. |
17 struct PPAPI_HOST_EXPORT ReplyMessageContext { | 17 struct PPAPI_HOST_EXPORT ReplyMessageContext { |
18 ReplyMessageContext(); | 18 ReplyMessageContext(); |
19 ReplyMessageContext( | 19 ReplyMessageContext( |
20 const ppapi::proxy::ResourceMessageReplyParams& cp, | 20 const ppapi::proxy::ResourceMessageReplyParams& cp, |
21 IPC::Message* sync_reply_msg, | 21 IPC::Message* sync_reply_msg, |
22 int routing_id); | 22 int routing_id); |
23 ~ReplyMessageContext(); | 23 ~ReplyMessageContext(); |
24 | 24 |
| 25 // Returns a value indicating whether this context is valid or "null". |
| 26 bool is_valid() const { return params.pp_resource() != 0; } |
| 27 |
25 // The "reply params" struct with the same resource and sequence number | 28 // The "reply params" struct with the same resource and sequence number |
26 // as the original resource message call. | 29 // as the original resource message call. |
27 ppapi::proxy::ResourceMessageReplyParams params; | 30 ppapi::proxy::ResourceMessageReplyParams params; |
28 | 31 |
29 // If this context is generated from a sync message, this will be set to the | 32 // If this context is generated from a sync message, this will be set to the |
30 // incoming sync message. Otherwise, it will be NULL. The plugin controls | 33 // incoming sync message. Otherwise, it will be NULL. The plugin controls |
31 // whether or not the resource call is synchronous or asynchronous so a | 34 // whether or not the resource call is synchronous or asynchronous so a |
32 // ResoureHost cannot make any assumptions about whether or not this is NULL. | 35 // ResoureHost cannot make any assumptions about whether or not this is NULL. |
33 IPC::Message* sync_reply_msg; | 36 IPC::Message* sync_reply_msg; |
34 | 37 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Routing ID to be used when sending a reply message. This is only useful | 74 // Routing ID to be used when sending a reply message. This is only useful |
72 // when the plugin is in-process. Otherwise, the value will be | 75 // when the plugin is in-process. Otherwise, the value will be |
73 // MSG_ROUTING_NONE. | 76 // MSG_ROUTING_NONE. |
74 int routing_id; | 77 int routing_id; |
75 }; | 78 }; |
76 | 79 |
77 } // namespace host | 80 } // namespace host |
78 } // namespace ppapi | 81 } // namespace ppapi |
79 | 82 |
80 #endif // PPAPI_HOST_HOST_MESSAGE_CONTEXT_H_ | 83 #endif // PPAPI_HOST_HOST_MESSAGE_CONTEXT_H_ |
OLD | NEW |