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 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 if (cursor_) | 1161 if (cursor_) |
1162 *cursor_info = *cursor_; | 1162 *cursor_info = *cursor_; |
1163 return rv; | 1163 return rv; |
1164 } | 1164 } |
1165 | 1165 |
1166 void PepperPluginInstanceImpl::HandleMessage(ScopedPPVar message) { | 1166 void PepperPluginInstanceImpl::HandleMessage(ScopedPPVar message) { |
1167 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleMessage"); | 1167 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleMessage"); |
1168 ppapi::proxy::HostDispatcher* dispatcher = | 1168 ppapi::proxy::HostDispatcher* dispatcher = |
1169 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 1169 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
1170 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { | 1170 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { |
1171 // The dispatcher should always be valid, and the browser should never send | 1171 // The dispatcher should always be valid, and MessageChannel should never |
1172 // an 'object' var over PPP_Messaging. | 1172 // send an 'object' var over PPP_Messaging. |
1173 NOTREACHED(); | 1173 NOTREACHED(); |
1174 return; | 1174 return; |
1175 } | 1175 } |
1176 dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage( | 1176 dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage( |
1177 ppapi::API_ID_PPP_MESSAGING, | 1177 ppapi::API_ID_PPP_MESSAGING, |
1178 pp_instance(), | 1178 pp_instance(), |
1179 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), | 1179 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), |
1180 pp_instance()))); | 1180 pp_instance()))); |
1181 } | 1181 } |
1182 | 1182 |
| 1183 bool PepperPluginInstanceImpl::HandleBlockingMessage(ScopedPPVar message, |
| 1184 ScopedPPVar* result) { |
| 1185 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleBlockingMessage"); |
| 1186 ppapi::proxy::HostDispatcher* dispatcher = |
| 1187 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 1188 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { |
| 1189 // The dispatcher should always be valid, and MessageChannel should never |
| 1190 // send an 'object' var over PPP_Messaging. |
| 1191 NOTREACHED(); |
| 1192 return false; |
| 1193 } |
| 1194 ppapi::proxy::ReceiveSerializedVarReturnValue msg_reply; |
| 1195 bool was_handled = false; |
| 1196 dispatcher->Send(new PpapiMsg_PPPMessageHandler_HandleBlockingMessage( |
| 1197 ppapi::API_ID_PPP_MESSAGING, |
| 1198 pp_instance(), |
| 1199 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), |
| 1200 pp_instance()), |
| 1201 &msg_reply, |
| 1202 &was_handled)); |
| 1203 *result = ScopedPPVar(ScopedPPVar::PassRef(), msg_reply.Return(dispatcher)); |
| 1204 TRACE_EVENT0("ppapi", |
| 1205 "PepperPluginInstanceImpl::HandleBlockingMessage return."); |
| 1206 return was_handled; |
| 1207 } |
| 1208 |
1183 PP_Var PepperPluginInstanceImpl::GetInstanceObject() { | 1209 PP_Var PepperPluginInstanceImpl::GetInstanceObject() { |
1184 // Keep a reference on the stack. See NOTE above. | 1210 // Keep a reference on the stack. See NOTE above. |
1185 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1211 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1186 | 1212 |
1187 // If the plugin supports the private instance interface, try to retrieve its | 1213 // If the plugin supports the private instance interface, try to retrieve its |
1188 // instance object. | 1214 // instance object. |
1189 if (LoadPrivateInterface()) | 1215 if (LoadPrivateInterface()) |
1190 return plugin_private_interface_->GetInstanceObject(pp_instance()); | 1216 return plugin_private_interface_->GetInstanceObject(pp_instance()); |
1191 return PP_MakeUndefined(); | 1217 return PP_MakeUndefined(); |
1192 } | 1218 } |
(...skipping 2081 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3274 // Running out-of-process. Initiate an IPC call to notify the plugin | 3300 // Running out-of-process. Initiate an IPC call to notify the plugin |
3275 // process. | 3301 // process. |
3276 ppapi::proxy::HostDispatcher* dispatcher = | 3302 ppapi::proxy::HostDispatcher* dispatcher = |
3277 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3303 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3278 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3304 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3279 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3305 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3280 } | 3306 } |
3281 } | 3307 } |
3282 | 3308 |
3283 } // namespace content | 3309 } // namespace content |
OLD | NEW |