| 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 #include "ppapi/proxy/message_handler.h" | 5 #include "ppapi/proxy/message_handler.h" |
| 6 | 6 |
| 7 #include "ipc/ipc_message.h" | 7 #include "ipc/ipc_message.h" |
| 8 #include "ppapi/proxy/plugin_dispatcher.h" | 8 #include "ppapi/proxy/plugin_dispatcher.h" |
| 9 #include "ppapi/proxy/ppapi_messages.h" | 9 #include "ppapi/proxy/ppapi_messages.h" |
| 10 #include "ppapi/proxy/ppb_message_loop_proxy.h" | 10 #include "ppapi/proxy/ppb_message_loop_proxy.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 void HandleBlockingMessageWrapper(HandleBlockingMessageFunc function, | 33 void HandleBlockingMessageWrapper(HandleBlockingMessageFunc function, |
| 34 PP_Instance instance, | 34 PP_Instance instance, |
| 35 void* user_data, | 35 void* user_data, |
| 36 ScopedPPVar message_data, | 36 ScopedPPVar message_data, |
| 37 scoped_ptr<IPC::Message> reply_msg) { | 37 scoped_ptr<IPC::Message> reply_msg) { |
| 38 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 38 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 39 if (!dispatcher) | 39 if (!dispatcher) |
| 40 return; | 40 return; |
| 41 PP_Var result = PP_MakeUndefined(); | 41 PP_Var result = PP_MakeUndefined(); |
| 42 MessageLoopResource::GetCurrent()-> |
| 43 set_currently_handling_blocking_message(true); |
| 42 CallWhileUnlocked( | 44 CallWhileUnlocked( |
| 43 function, instance, user_data, &message_data.get(), &result); | 45 function, instance, user_data, &message_data.get(), &result); |
| 46 MessageLoopResource::GetCurrent()-> |
| 47 set_currently_handling_blocking_message(false); |
| 44 PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams( | 48 PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams( |
| 45 reply_msg.get(), | 49 reply_msg.get(), |
| 46 SerializedVarReturnValue::Convert(dispatcher, result), | 50 SerializedVarReturnValue::Convert(dispatcher, result), |
| 47 true /* was_handled */); | 51 true /* was_handled */); |
| 48 dispatcher->Send(reply_msg.release()); | 52 dispatcher->Send(reply_msg.release()); |
| 49 } | 53 } |
| 50 | 54 |
| 51 // TODO(dmichael): Remove the 0_1 verions; crbug.com/414398 | 55 // TODO(dmichael): Remove the 0_1 verions; crbug.com/414398 |
| 52 void HandleMessageWrapper_0_1(HandleMessageFunc_0_1 function, | 56 void HandleMessageWrapper_0_1(HandleMessageFunc_0_1 function, |
| 53 PP_Instance instance, | 57 PP_Instance instance, |
| 54 void* user_data, | 58 void* user_data, |
| 55 ScopedPPVar message_data) { | 59 ScopedPPVar message_data) { |
| 56 CallWhileUnlocked(function, instance, user_data, message_data.get()); | 60 CallWhileUnlocked(function, instance, user_data, message_data.get()); |
| 57 } | 61 } |
| 58 | 62 |
| 59 void HandleBlockingMessageWrapper_0_1(HandleBlockingMessageFunc_0_1 function, | 63 void HandleBlockingMessageWrapper_0_1(HandleBlockingMessageFunc_0_1 function, |
| 60 PP_Instance instance, | 64 PP_Instance instance, |
| 61 void* user_data, | 65 void* user_data, |
| 62 ScopedPPVar message_data, | 66 ScopedPPVar message_data, |
| 63 scoped_ptr<IPC::Message> reply_msg) { | 67 scoped_ptr<IPC::Message> reply_msg) { |
| 64 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 68 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 65 if (!dispatcher) | 69 if (!dispatcher) |
| 66 return; | 70 return; |
| 71 MessageLoopResource::GetCurrent()-> |
| 72 set_currently_handling_blocking_message(true); |
| 67 PP_Var return_value = CallWhileUnlocked(function, | 73 PP_Var return_value = CallWhileUnlocked(function, |
| 68 instance, | 74 instance, |
| 69 user_data, | 75 user_data, |
| 70 message_data.get()); | 76 message_data.get()); |
| 77 MessageLoopResource::GetCurrent()-> |
| 78 set_currently_handling_blocking_message(false); |
| 71 PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams( | 79 PpapiMsg_PPPMessageHandler_HandleBlockingMessage::WriteReplyParams( |
| 72 reply_msg.get(), | 80 reply_msg.get(), |
| 73 SerializedVarReturnValue::Convert(dispatcher, return_value), | 81 SerializedVarReturnValue::Convert(dispatcher, return_value), |
| 74 true /* was_handled */); | 82 true /* was_handled */); |
| 75 dispatcher->Send(reply_msg.release()); | 83 dispatcher->Send(reply_msg.release()); |
| 76 } | 84 } |
| 77 | 85 |
| 78 } // namespace | 86 } // namespace |
| 79 | 87 |
| 80 // static | 88 // static |
| (...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 scoped_refptr<MessageLoopResource> message_loop) | 242 scoped_refptr<MessageLoopResource> message_loop) |
| 235 : instance_(instance), | 243 : instance_(instance), |
| 236 handler_if_(NULL), | 244 handler_if_(NULL), |
| 237 handler_if_0_1_(handler_if), | 245 handler_if_0_1_(handler_if), |
| 238 user_data_(user_data), | 246 user_data_(user_data), |
| 239 message_loop_(message_loop) { | 247 message_loop_(message_loop) { |
| 240 } | 248 } |
| 241 | 249 |
| 242 } // namespace proxy | 250 } // namespace proxy |
| 243 } // namespace ppapi | 251 } // namespace ppapi |
| OLD | NEW |