OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "native_client/src/shared/platform/nacl_check.h" | 5 #include "native_client/src/shared/platform/nacl_check.h" |
6 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" | 6 #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" |
7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" | 7 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_core.h" |
8 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" | 8 #include "native_client/src/shared/ppapi_proxy/plugin_ppb_var.h" |
9 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" | 9 #include "native_client/src/shared/ppapi_proxy/ppruntime.h" |
10 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h" | 10 #include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 const PPP_Find_Dev* PPPFindInterface() { | 102 const PPP_Find_Dev* PPPFindInterface() { |
103 static const void* ppp = GetPluginInterfaceSafe(PPP_FIND_DEV_INTERFACE); | 103 static const void* ppp = GetPluginInterfaceSafe(PPP_FIND_DEV_INTERFACE); |
104 return static_cast<const PPP_Find_Dev*>(ppp); | 104 return static_cast<const PPP_Find_Dev*>(ppp); |
105 } | 105 } |
106 | 106 |
107 const PPP_InputEvent* PPPInputEventInterface() { | 107 const PPP_InputEvent* PPPInputEventInterface() { |
108 static const void* ppp = GetPluginInterfaceSafe(PPP_INPUT_EVENT_INTERFACE); | 108 static const void* ppp = GetPluginInterfaceSafe(PPP_INPUT_EVENT_INTERFACE); |
109 return static_cast<const PPP_InputEvent*>(ppp); | 109 return static_cast<const PPP_InputEvent*>(ppp); |
110 } | 110 } |
111 | 111 |
112 const PPP_Instance* PPPInstanceInterface() { | 112 PPP_Instance_Combined* PPPInstanceInterface() { |
113 static const void* ppp = GetPluginInterfaceSafe(PPP_INSTANCE_INTERFACE); | 113 static PPP_Instance_Combined combined; |
114 return static_cast<const PPP_Instance*>(ppp); | 114 if (!combined.initialized()) { |
| 115 // Note: don't use "safe" version since that will assert if 1.1 isn't |
| 116 // supported, which isn't required. |
| 117 const void* instance1_1 = GetPluginInterface( |
| 118 PPP_INSTANCE_INTERFACE_1_1); |
| 119 if (instance1_1) { |
| 120 combined.Init1_1(static_cast<const PPP_Instance_1_1*>(instance1_1)); |
| 121 } else { |
| 122 combined.Init1_0(static_cast<const PPP_Instance_1_0*>( |
| 123 GetPluginInterfaceSafe(PPP_INSTANCE_INTERFACE_1_0))); |
| 124 } |
| 125 } |
| 126 return &combined; |
115 } | 127 } |
116 | 128 |
117 const PPP_Messaging* PPPMessagingInterface() { | 129 const PPP_Messaging* PPPMessagingInterface() { |
118 static const void* ppp = GetPluginInterfaceSafe(PPP_MESSAGING_INTERFACE); | 130 static const void* ppp = GetPluginInterfaceSafe(PPP_MESSAGING_INTERFACE); |
119 return static_cast<const PPP_Messaging*>(ppp); | 131 return static_cast<const PPP_Messaging*>(ppp); |
120 } | 132 } |
121 | 133 |
122 const PPP_MouseLock* PPPMouseLockInterface() { | 134 const PPP_MouseLock* PPPMouseLockInterface() { |
123 static const void* ppp = GetPluginInterfaceSafe(PPP_MOUSELOCK_INTERFACE); | 135 static const void* ppp = GetPluginInterfaceSafe(PPP_MOUSELOCK_INTERFACE); |
124 return static_cast<const PPP_MouseLock*>(ppp); | 136 return static_cast<const PPP_MouseLock*>(ppp); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 PpapiPluginRegisterDefaultThreadCreator(); | 189 PpapiPluginRegisterDefaultThreadCreator(); |
178 // Designate this as the main thread for PPB_Core::IsMainThread(). | 190 // Designate this as the main thread for PPB_Core::IsMainThread(). |
179 ppapi_proxy::PluginCore::MarkMainThread(); | 191 ppapi_proxy::PluginCore::MarkMainThread(); |
180 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { | 192 if (!NaClSrpcAcceptClientConnection(PppRpcs::srpc_methods)) { |
181 return 1; | 193 return 1; |
182 } | 194 } |
183 NaClSrpcModuleFini(); | 195 NaClSrpcModuleFini(); |
184 | 196 |
185 return 0; | 197 return 0; |
186 } | 198 } |
OLD | NEW |