| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2010 The Native Client Authors. All rights reserved. | 2 * Copyright 2010 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can | 3 * Use of this source code is governed by a BSD-style license that can |
| 4 * be found in the LICENSE file. | 4 * be found in the LICENSE file. |
| 5 */ | 5 */ |
| 6 | 6 |
| 7 #include "native_client/src/shared/ppapi_proxy/plugin_instance.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_instance.h" |
| 8 | 8 |
| 9 #include <stdio.h> | 9 #include <stdio.h> |
| 10 #include "native_client/src/include/portability.h" | 10 #include "native_client/src/include/portability.h" |
| 11 #include "native_client/src/shared/ppapi_proxy/utility.h" | 11 #include "native_client/src/shared/ppapi_proxy/utility.h" |
| 12 #include "ppapi/c/ppb_instance.h" | 12 #include "ppapi/c/ppb_instance.h" |
| 13 | 13 |
| 14 namespace ppapi_proxy { | 14 namespace ppapi_proxy { |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 static PluginInstance* GetInstancePointer(PP_Instance instance) { | 18 static PluginInstance* GetInstancePointer(PP_Instance instance) { |
| 19 return reinterpret_cast<PluginInstance*>(static_cast<uintptr_t>(instance)); | 19 return reinterpret_cast<PluginInstance*>(static_cast<uintptr_t>(instance)); |
| 20 } | 20 } |
| 21 | 21 |
| 22 static PP_Var GetWindowObjectThunk(PP_Instance instance) { | 22 static PP_Var GetWindowObjectThunk(PP_Instance instance) { |
| 23 DebugPrintf("PluginInstance::GetWindowObject: instance=%" NACL_PRIx64"\n", | 23 DebugPrintf("Plugin::PPB_Instance::GetWindowObject: instance=%" |
| 24 instance); | 24 NACL_PRIx64"\n", instance); |
| 25 return GetInstancePointer(instance)->GetWindowObject(); | 25 return GetInstancePointer(instance)->GetWindowObject(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 static PP_Var GetOwnerElementObjectThunk(PP_Instance instance) { | 28 static PP_Var GetOwnerElementObjectThunk(PP_Instance instance) { |
| 29 DebugPrintf("PluginInstance::GetOwnerElementObject: instance=%" | 29 DebugPrintf("Plugin::PPB_Instance::GetOwnerElementObject: instance=%" |
| 30 NACL_PRIx64 "\n", | 30 NACL_PRIx64 "\n", |
| 31 instance); | 31 instance); |
| 32 return GetInstancePointer(instance)->GetOwnerElementObject(); | 32 return GetInstancePointer(instance)->GetOwnerElementObject(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 static PP_Bool BindGraphicsThunk(PP_Instance instance, | 35 static PP_Bool BindGraphicsThunk(PP_Instance instance, |
| 36 PP_Resource device) { | 36 PP_Resource device) { |
| 37 DebugPrintf("PluginInstance::BindGraphicsDeviceContext: instance=%" | 37 DebugPrintf("Plugin::PPB_Instance::BindGraphicsDeviceContext: instance=%" |
| 38 NACL_PRIx64 ", device=%" NACL_PRIu64 "\n", | 38 NACL_PRIx64 ", device=%" NACL_PRIu64 "\n", |
| 39 instance, device); | 39 instance, device); |
| 40 return static_cast<PP_Bool> | 40 return static_cast<PP_Bool> |
| 41 (GetInstancePointer(instance)->BindGraphics(device)); | 41 (GetInstancePointer(instance)->BindGraphics(device)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 static PP_Bool IsFullFrameThunk(PP_Instance instance) { | 44 static PP_Bool IsFullFrameThunk(PP_Instance instance) { |
| 45 DebugPrintf("PluginInstance::IsFullFrame: instance=%" NACL_PRIx64 "\n", | 45 DebugPrintf("Plugin::PPB_Instance::IsFullFrame: instance=%" NACL_PRIx64 "\n", |
| 46 instance); | 46 instance); |
| 47 return static_cast<PP_Bool>(GetInstancePointer(instance)->IsFullFrame()); | 47 return static_cast<PP_Bool>(GetInstancePointer(instance)->IsFullFrame()); |
| 48 } | 48 } |
| 49 | 49 |
| 50 static PP_Var ExecuteScriptThunk(PP_Instance instance, | 50 static PP_Var ExecuteScriptThunk(PP_Instance instance, |
| 51 PP_Var script, | 51 PP_Var script, |
| 52 PP_Var* exception) { | 52 PP_Var* exception) { |
| 53 DebugPrintf("PluginInstance::ExecuteScript: instance=%" NACL_PRIx64"\n", | 53 DebugPrintf("Plugin::PPB_Instance::ExecuteScript: instance=%" NACL_PRIx64"\n", |
| 54 instance); | 54 instance); |
| 55 return GetInstancePointer(instance)->ExecuteScript(script, exception); | 55 return GetInstancePointer(instance)->ExecuteScript(script, exception); |
| 56 } | 56 } |
| 57 | 57 |
| 58 } // namespace | 58 } // namespace |
| 59 | 59 |
| 60 const PPB_Instance* PluginInstance::GetInterface() { | 60 const PPB_Instance* PluginInstance::GetInterface() { |
| 61 static const PPB_Instance intf = { | 61 static const PPB_Instance intf = { |
| 62 GetWindowObjectThunk, | 62 GetWindowObjectThunk, |
| 63 GetOwnerElementObjectThunk, | 63 GetOwnerElementObjectThunk, |
| 64 BindGraphicsThunk, | 64 BindGraphicsThunk, |
| 65 IsFullFrameThunk, | 65 IsFullFrameThunk, |
| 66 ExecuteScriptThunk | 66 ExecuteScriptThunk |
| 67 }; | 67 }; |
| 68 return &intf; | 68 return &intf; |
| 69 } | 69 } |
| 70 | 70 |
| 71 } // namespace ppapi_proxy | 71 } // namespace ppapi_proxy |
| OLD | NEW |