| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/ppb_instance_proxy.h" | 5 #include "ppapi/proxy/ppb_instance_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/c/pp_var.h" | 7 #include "ppapi/c/pp_var.h" |
| 8 #include "ppapi/c/ppb_instance.h" | 8 #include "ppapi/c/ppb_instance.h" |
| 9 #include "ppapi/proxy/plugin_dispatcher.h" | 9 #include "ppapi/proxy/plugin_dispatcher.h" |
| 10 #include "ppapi/proxy/plugin_resource.h" |
| 11 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 12 #include "ppapi/proxy/ppapi_messages.h" |
| 11 #include "ppapi/proxy/serialized_var.h" | 13 #include "ppapi/proxy/serialized_var.h" |
| 12 | 14 |
| 13 namespace pp { | 15 namespace pp { |
| 14 namespace proxy { | 16 namespace proxy { |
| 15 | 17 |
| 16 namespace { | 18 namespace { |
| 17 | 19 |
| 18 PP_Var GetWindowObject(PP_Instance instance) { | 20 PP_Var GetWindowObject(PP_Instance instance) { |
| 19 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 21 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 35 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject( | 37 dispatcher->Send(new PpapiHostMsg_PPBInstance_GetOwnerElementObject( |
| 36 INTERFACE_ID_PPB_INSTANCE, instance, &result)); | 38 INTERFACE_ID_PPB_INSTANCE, instance, &result)); |
| 37 return result.Return(dispatcher); | 39 return result.Return(dispatcher); |
| 38 } | 40 } |
| 39 | 41 |
| 40 PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) { | 42 PP_Bool BindGraphics(PP_Instance instance, PP_Resource device) { |
| 41 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 43 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 42 if (!dispatcher) | 44 if (!dispatcher) |
| 43 return PP_FALSE; | 45 return PP_FALSE; |
| 44 | 46 |
| 47 PluginResource* object = |
| 48 PluginResourceTracker::GetInstance()->GetResourceObject(device); |
| 49 if (!object || object->instance() != instance) |
| 50 return PP_FALSE; |
| 51 |
| 45 PP_Bool result = PP_FALSE; | 52 PP_Bool result = PP_FALSE; |
| 46 dispatcher->Send(new PpapiHostMsg_PPBInstance_BindGraphics( | 53 dispatcher->Send(new PpapiHostMsg_PPBInstance_BindGraphics( |
| 47 INTERFACE_ID_PPB_INSTANCE, instance, device, &result)); | 54 INTERFACE_ID_PPB_INSTANCE, instance, object->host_resource(), |
| 55 &result)); |
| 48 return result; | 56 return result; |
| 49 } | 57 } |
| 50 | 58 |
| 51 PP_Bool IsFullFrame(PP_Instance instance) { | 59 PP_Bool IsFullFrame(PP_Instance instance) { |
| 52 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); | 60 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); |
| 53 if (!dispatcher) | 61 if (!dispatcher) |
| 54 return PP_FALSE; | 62 return PP_FALSE; |
| 55 | 63 |
| 56 PP_Bool result = PP_FALSE; | 64 PP_Bool result = PP_FALSE; |
| 57 dispatcher->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( | 65 dispatcher->Send(new PpapiHostMsg_PPBInstance_IsFullFrame( |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 } | 135 } |
| 128 | 136 |
| 129 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( | 137 void PPB_Instance_Proxy::OnMsgGetOwnerElementObject( |
| 130 PP_Instance instance, | 138 PP_Instance instance, |
| 131 SerializedVarReturnValue result) { | 139 SerializedVarReturnValue result) { |
| 132 result.Return(dispatcher(), | 140 result.Return(dispatcher(), |
| 133 ppb_instance_target()->GetOwnerElementObject(instance)); | 141 ppb_instance_target()->GetOwnerElementObject(instance)); |
| 134 } | 142 } |
| 135 | 143 |
| 136 void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance, | 144 void PPB_Instance_Proxy::OnMsgBindGraphics(PP_Instance instance, |
| 137 PP_Resource device, | 145 SerializedResource device, |
| 138 PP_Bool* result) { | 146 PP_Bool* result) { |
| 139 *result = ppb_instance_target()->BindGraphics(instance, device); | 147 *result = ppb_instance_target()->BindGraphics(instance, |
| 148 device.host_resource()); |
| 140 } | 149 } |
| 141 | 150 |
| 142 void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance, | 151 void PPB_Instance_Proxy::OnMsgIsFullFrame(PP_Instance instance, |
| 143 PP_Bool* result) { | 152 PP_Bool* result) { |
| 144 *result = ppb_instance_target()->IsFullFrame(instance); | 153 *result = ppb_instance_target()->IsFullFrame(instance); |
| 145 } | 154 } |
| 146 | 155 |
| 147 void PPB_Instance_Proxy::OnMsgExecuteScript( | 156 void PPB_Instance_Proxy::OnMsgExecuteScript( |
| 148 PP_Instance instance, | 157 PP_Instance instance, |
| 149 SerializedVarReceiveInput script, | 158 SerializedVarReceiveInput script, |
| 150 SerializedVarOutParam out_exception, | 159 SerializedVarOutParam out_exception, |
| 151 SerializedVarReturnValue result) { | 160 SerializedVarReturnValue result) { |
| 152 result.Return(dispatcher(), ppb_instance_target()->ExecuteScript( | 161 result.Return(dispatcher(), ppb_instance_target()->ExecuteScript( |
| 153 instance, | 162 instance, |
| 154 script.Get(dispatcher()), | 163 script.Get(dispatcher()), |
| 155 out_exception.OutParam(dispatcher()))); | 164 out_exception.OutParam(dispatcher()))); |
| 156 } | 165 } |
| 157 | 166 |
| 158 } // namespace proxy | 167 } // namespace proxy |
| 159 } // namespace pp | 168 } // namespace pp |
| OLD | NEW |