| 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 "content/renderer/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1154 if (cursor_) | 1154 if (cursor_) |
| 1155 *cursor_info = *cursor_; | 1155 *cursor_info = *cursor_; |
| 1156 return rv; | 1156 return rv; |
| 1157 } | 1157 } |
| 1158 | 1158 |
| 1159 void PepperPluginInstanceImpl::HandleMessage(ScopedPPVar message) { | 1159 void PepperPluginInstanceImpl::HandleMessage(ScopedPPVar message) { |
| 1160 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleMessage"); | 1160 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleMessage"); |
| 1161 ppapi::proxy::HostDispatcher* dispatcher = | 1161 ppapi::proxy::HostDispatcher* dispatcher = |
| 1162 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 1162 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 1163 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { | 1163 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { |
| 1164 // The dispatcher should always be valid, and the browser should never send | 1164 // The dispatcher should always be valid, and MessageChannel should never |
| 1165 // an 'object' var over PPP_Messaging. | 1165 // send an 'object' var over PPP_Messaging. |
| 1166 NOTREACHED(); | 1166 NOTREACHED(); |
| 1167 return; | 1167 return; |
| 1168 } | 1168 } |
| 1169 dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage( | 1169 dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage( |
| 1170 ppapi::API_ID_PPP_MESSAGING, | 1170 ppapi::API_ID_PPP_MESSAGING, |
| 1171 pp_instance(), | 1171 pp_instance(), |
| 1172 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), | 1172 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), |
| 1173 pp_instance()))); | 1173 pp_instance()))); |
| 1174 } | 1174 } |
| 1175 | 1175 |
| 1176 bool PepperPluginInstanceImpl::HandleBlockingMessage(ScopedPPVar message, |
| 1177 ScopedPPVar* result) { |
| 1178 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleBlockingMessage"); |
| 1179 ppapi::proxy::HostDispatcher* dispatcher = |
| 1180 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 1181 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { |
| 1182 // The dispatcher should always be valid, and MessageChannel should never |
| 1183 // send an 'object' var over PPP_Messaging. |
| 1184 NOTREACHED(); |
| 1185 return false; |
| 1186 } |
| 1187 ppapi::proxy::ReceiveSerializedVarReturnValue msg_reply; |
| 1188 bool was_handled = false; |
| 1189 dispatcher->Send(new PpapiMsg_PPPMessageHandler_HandleBlockingMessage( |
| 1190 ppapi::API_ID_PPP_MESSAGING, |
| 1191 pp_instance(), |
| 1192 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), |
| 1193 pp_instance()), |
| 1194 &msg_reply, |
| 1195 &was_handled)); |
| 1196 *result = ScopedPPVar(ScopedPPVar::PassRef(), msg_reply.Return(dispatcher)); |
| 1197 TRACE_EVENT0("ppapi", |
| 1198 "PepperPluginInstanceImpl::HandleBlockingMessage return."); |
| 1199 return was_handled; |
| 1200 } |
| 1201 |
| 1176 PP_Var PepperPluginInstanceImpl::GetInstanceObject() { | 1202 PP_Var PepperPluginInstanceImpl::GetInstanceObject() { |
| 1177 // Keep a reference on the stack. See NOTE above. | 1203 // Keep a reference on the stack. See NOTE above. |
| 1178 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1204 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| 1179 | 1205 |
| 1180 // If the plugin supports the private instance interface, try to retrieve its | 1206 // If the plugin supports the private instance interface, try to retrieve its |
| 1181 // instance object. | 1207 // instance object. |
| 1182 if (LoadPrivateInterface()) | 1208 if (LoadPrivateInterface()) |
| 1183 return plugin_private_interface_->GetInstanceObject(pp_instance()); | 1209 return plugin_private_interface_->GetInstanceObject(pp_instance()); |
| 1184 return PP_MakeUndefined(); | 1210 return PP_MakeUndefined(); |
| 1185 } | 1211 } |
| (...skipping 2047 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3233 // Running out-of-process. Initiate an IPC call to notify the plugin | 3259 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 3234 // process. | 3260 // process. |
| 3235 ppapi::proxy::HostDispatcher* dispatcher = | 3261 ppapi::proxy::HostDispatcher* dispatcher = |
| 3236 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3262 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 3237 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3263 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 3238 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3264 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 3239 } | 3265 } |
| 3240 } | 3266 } |
| 3241 | 3267 |
| 3242 } // namespace content | 3268 } // namespace content |
| OLD | NEW |