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 #include "ppapi/proxy/ppp_messaging_proxy.h" | 5 #include "ppapi/proxy/ppp_messaging_proxy.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
| 9 #include "base/memory/ptr_util.h" |
9 #include "ppapi/c/ppp_messaging.h" | 10 #include "ppapi/c/ppp_messaging.h" |
10 #include "ppapi/proxy/host_dispatcher.h" | 11 #include "ppapi/proxy/host_dispatcher.h" |
11 #include "ppapi/proxy/message_handler.h" | 12 #include "ppapi/proxy/message_handler.h" |
12 #include "ppapi/proxy/plugin_dispatcher.h" | 13 #include "ppapi/proxy/plugin_dispatcher.h" |
13 #include "ppapi/proxy/plugin_resource_tracker.h" | 14 #include "ppapi/proxy/plugin_resource_tracker.h" |
14 #include "ppapi/proxy/plugin_var_tracker.h" | 15 #include "ppapi/proxy/plugin_var_tracker.h" |
15 #include "ppapi/proxy/ppapi_messages.h" | 16 #include "ppapi/proxy/ppapi_messages.h" |
16 #include "ppapi/proxy/serialized_var.h" | 17 #include "ppapi/proxy/serialized_var.h" |
17 #include "ppapi/shared_impl/ppapi_globals.h" | 18 #include "ppapi/shared_impl/ppapi_globals.h" |
18 #include "ppapi/shared_impl/proxy_lock.h" | 19 #include "ppapi/shared_impl/proxy_lock.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 } | 113 } |
113 | 114 |
114 void PPP_Messaging_Proxy::OnMsgHandleBlockingMessage( | 115 void PPP_Messaging_Proxy::OnMsgHandleBlockingMessage( |
115 PP_Instance instance, | 116 PP_Instance instance, |
116 SerializedVarReceiveInput message_data, | 117 SerializedVarReceiveInput message_data, |
117 IPC::Message* reply_msg) { | 118 IPC::Message* reply_msg) { |
118 ScopedPPVar received_var(message_data.GetForInstance(dispatcher(), instance)); | 119 ScopedPPVar received_var(message_data.GetForInstance(dispatcher(), instance)); |
119 MessageHandler* message_handler = GetMessageHandler(dispatcher(), instance); | 120 MessageHandler* message_handler = GetMessageHandler(dispatcher(), instance); |
120 if (message_handler) { | 121 if (message_handler) { |
121 if (message_handler->LoopIsValid()) { | 122 if (message_handler->LoopIsValid()) { |
122 message_handler->HandleBlockingMessage( | 123 message_handler->HandleBlockingMessage(received_var, |
123 received_var, scoped_ptr<IPC::Message>(reply_msg)); | 124 base::WrapUnique(reply_msg)); |
124 return; | 125 return; |
125 } else { | 126 } else { |
126 // If the MessageHandler's loop has been quit, then we should treat it as | 127 // If the MessageHandler's loop has been quit, then we should treat it as |
127 // though it has been unregistered. Also see the note for PostMessage. | 128 // though it has been unregistered. Also see the note for PostMessage. |
128 ResetMessageHandler(dispatcher(), instance); | 129 ResetMessageHandler(dispatcher(), instance); |
129 } | 130 } |
130 } | 131 } |
131 // We have no handler, but we still need to respond to unblock the renderer | 132 // We have no handler, but we still need to respond to unblock the renderer |
132 // and inform the JavaScript caller. | 133 // and inform the JavaScript caller. |
133 PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams( | 134 PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams( |
134 reply_msg, | 135 reply_msg, |
135 SerializedVarReturnValue::Convert(dispatcher(), PP_MakeUndefined()), | 136 SerializedVarReturnValue::Convert(dispatcher(), PP_MakeUndefined()), |
136 false /* was_handled */); | 137 false /* was_handled */); |
137 dispatcher()->Send(reply_msg); | 138 dispatcher()->Send(reply_msg); |
138 } | 139 } |
139 | 140 |
140 | 141 |
141 } // namespace proxy | 142 } // namespace proxy |
142 } // namespace ppapi | 143 } // namespace ppapi |
OLD | NEW |