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 1142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1153 if (cursor_) | 1153 if (cursor_) |
1154 *cursor_info = *cursor_; | 1154 *cursor_info = *cursor_; |
1155 return rv; | 1155 return rv; |
1156 } | 1156 } |
1157 | 1157 |
1158 void PepperPluginInstanceImpl::HandleMessage(ScopedPPVar message) { | 1158 void PepperPluginInstanceImpl::HandleMessage(ScopedPPVar message) { |
1159 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleMessage"); | 1159 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleMessage"); |
1160 ppapi::proxy::HostDispatcher* dispatcher = | 1160 ppapi::proxy::HostDispatcher* dispatcher = |
1161 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 1161 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
1162 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { | 1162 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { |
1163 // The dispatcher should always be valid, and the browser should never send | 1163 // The dispatcher should always be valid, and MessageChannel should never |
1164 // an 'object' var over PPP_Messaging. | 1164 // send an 'object' var over PPP_Messaging. |
1165 NOTREACHED(); | 1165 NOTREACHED(); |
1166 return; | 1166 return; |
1167 } | 1167 } |
1168 dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage( | 1168 dispatcher->Send(new PpapiMsg_PPPMessaging_HandleMessage( |
1169 ppapi::API_ID_PPP_MESSAGING, | 1169 ppapi::API_ID_PPP_MESSAGING, |
1170 pp_instance(), | 1170 pp_instance(), |
1171 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), | 1171 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), |
1172 pp_instance()))); | 1172 pp_instance()))); |
1173 } | 1173 } |
1174 | 1174 |
| 1175 bool PepperPluginInstanceImpl::HandleBlockingMessage(ScopedPPVar message, |
| 1176 ScopedPPVar* result) { |
| 1177 TRACE_EVENT0("ppapi", "PepperPluginInstanceImpl::HandleBlockingMessage"); |
| 1178 ppapi::proxy::HostDispatcher* dispatcher = |
| 1179 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 1180 if (!dispatcher || (message.get().type == PP_VARTYPE_OBJECT)) { |
| 1181 // The dispatcher should always be valid, and MessageChannel should never |
| 1182 // send an 'object' var over PPP_Messaging. |
| 1183 NOTREACHED(); |
| 1184 return false; |
| 1185 } |
| 1186 ppapi::proxy::ReceiveSerializedVarReturnValue msg_reply; |
| 1187 bool was_handled = false; |
| 1188 dispatcher->Send(new PpapiMsg_PPPMessageHandler_HandleBlockingMessage( |
| 1189 ppapi::API_ID_PPP_MESSAGING, |
| 1190 pp_instance(), |
| 1191 ppapi::proxy::SerializedVarSendInputShmem(dispatcher, message.get(), |
| 1192 pp_instance()), |
| 1193 &msg_reply, |
| 1194 &was_handled)); |
| 1195 *result = ScopedPPVar(ScopedPPVar::PassRef(), msg_reply.Return(dispatcher)); |
| 1196 TRACE_EVENT0("ppapi", |
| 1197 "PepperPluginInstanceImpl::HandleBlockingMessage return."); |
| 1198 return was_handled; |
| 1199 } |
| 1200 |
1175 PP_Var PepperPluginInstanceImpl::GetInstanceObject() { | 1201 PP_Var PepperPluginInstanceImpl::GetInstanceObject() { |
1176 // Keep a reference on the stack. See NOTE above. | 1202 // Keep a reference on the stack. See NOTE above. |
1177 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 1203 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
1178 | 1204 |
1179 // If the plugin supports the private instance interface, try to retrieve its | 1205 // If the plugin supports the private instance interface, try to retrieve its |
1180 // instance object. | 1206 // instance object. |
1181 if (LoadPrivateInterface()) | 1207 if (LoadPrivateInterface()) |
1182 return plugin_private_interface_->GetInstanceObject(pp_instance()); | 1208 return plugin_private_interface_->GetInstanceObject(pp_instance()); |
1183 return PP_MakeUndefined(); | 1209 return PP_MakeUndefined(); |
1184 } | 1210 } |
(...skipping 2029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3214 // Running out-of-process. Initiate an IPC call to notify the plugin | 3240 // Running out-of-process. Initiate an IPC call to notify the plugin |
3215 // process. | 3241 // process. |
3216 ppapi::proxy::HostDispatcher* dispatcher = | 3242 ppapi::proxy::HostDispatcher* dispatcher = |
3217 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3243 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3218 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3244 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3219 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3245 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3220 } | 3246 } |
3221 } | 3247 } |
3222 | 3248 |
3223 } // namespace content | 3249 } // namespace content |
OLD | NEW |