summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authormseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-23 22:14:08 +0000
committermseaborn@chromium.org <mseaborn@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-04-23 22:14:08 +0000
commitdf56c3aaa4d15a51a7f994b73f22a60478dc46b2 (patch)
tree748f8a5b29e9ab4b50e8dbfb1d6c5d4a3e49332a /ppapi
parent273c892ce208fff61280ad88bc2e68677c285133 (diff)
downloadchromium_src-df56c3aaa4d15a51a7f994b73f22a60478dc46b2.zip
chromium_src-df56c3aaa4d15a51a7f994b73f22a60478dc46b2.tar.gz
chromium_src-df56c3aaa4d15a51a7f994b73f22a60478dc46b2.tar.bz2
PNaCl PPAPI shims: Remove function pointer casts for PPP_* shims
The casts are only necessary for the PPB_* shims, where we need to cast away the "pnaclcall" function attribute. The PPP_* shim functions must match the default calling conventions and so do not have this attribute, so removing the casts here provides a little extra type checking. BUG=https://code.google.com/p/nativeclient/issues/detail?id=3400 TEST=cd ppapi/generators && ./generator.py + compile shims Review URL: https://codereview.chromium.org/13888011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195912 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/generators/idl_gen_wrapper.py27
-rw-r--r--ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c24
2 files changed, 30 insertions, 21 deletions
diff --git a/ppapi/generators/idl_gen_wrapper.py b/ppapi/generators/idl_gen_wrapper.py
index 5dcafbf..35fd439 100644
--- a/ppapi/generators/idl_gen_wrapper.py
+++ b/ppapi/generators/idl_gen_wrapper.py
@@ -357,15 +357,24 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) {
if not member.InReleases([iface.release]):
continue
prefix = self.WrapperMethodPrefix(iface.node, iface.release)
- cast = self.cgen.GetSignature(member, iface.release, 'return',
- prefix='',
- func_as_ptr=True,
- ptr_prefix='',
- include_name=False)
- methods.append(' .%s = (%s)&%s%s' % (member.GetName(),
- cast,
- prefix,
- member.GetName()))
+ # Casts are necessary for the PPB_* wrappers because we must
+ # cast away "__attribute__((pnaclcall))". The PPP_* wrappers
+ # must match the default calling conventions and so don't have
+ # the attribute, so omitting casts for them provides a little
+ # extra type checking.
+ if iface.node.GetName().startswith('PPB_'):
+ cast = '(%s)' % self.cgen.GetSignature(
+ member, iface.release, 'return',
+ prefix='',
+ func_as_ptr=True,
+ ptr_prefix='',
+ include_name=False)
+ else:
+ cast = ''
+ methods.append(' .%s = %s&%s%s' % (member.GetName(),
+ cast,
+ prefix,
+ member.GetName()))
out.Write(' ' + ',\n '.join(methods) + '\n')
out.Write('};\n\n')
diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
index 70cb674..1ad1a81 100644
--- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
+++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c
@@ -4449,7 +4449,7 @@ struct PPB_WebSocket_1_0 Pnacl_Wrappers_PPB_WebSocket_1_0 = {
/* Not generating wrapper interface for PPP_Instance_1_1 */
struct PPP_Messaging_1_0 Pnacl_Wrappers_PPP_Messaging_1_0 = {
- .HandleMessage = (void (*)(PP_Instance instance, struct PP_Var message))&Pnacl_M14_PPP_Messaging_HandleMessage
+ .HandleMessage = &Pnacl_M14_PPP_Messaging_HandleMessage
};
/* Not generating wrapper interface for PPP_MouseLock_1_0 */
@@ -4761,7 +4761,7 @@ struct PPB_VideoDecoder_Dev_0_16 Pnacl_Wrappers_PPB_VideoDecoder_Dev_0_16 = {
/* Not generating wrapper interface for PPP_Scrollbar_Dev_0_3 */
struct PPP_Selection_Dev_0_3 Pnacl_Wrappers_PPP_Selection_Dev_0_3 = {
- .GetSelectedText = (struct PP_Var (*)(PP_Instance instance, PP_Bool html))&Pnacl_M13_PPP_Selection_Dev_GetSelectedText
+ .GetSelectedText = &Pnacl_M13_PPP_Selection_Dev_GetSelectedText
};
/* Not generating wrapper interface for PPP_TextInput_Dev_0_1 */
@@ -5074,15 +5074,15 @@ struct PPB_X509Certificate_Private_0_1 Pnacl_Wrappers_PPB_X509Certificate_Privat
};
struct PPP_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPP_ContentDecryptor_Private_0_6 = {
- .GenerateKeyRequest = (void (*)(PP_Instance instance, struct PP_Var key_system, struct PP_Var type, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest,
- .AddKey = (void (*)(PP_Instance instance, struct PP_Var session_id, struct PP_Var key, struct PP_Var init_data))&Pnacl_M24_PPP_ContentDecryptor_Private_AddKey,
- .CancelKeyRequest = (void (*)(PP_Instance instance, struct PP_Var session_id))&Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest,
- .Decrypt = (void (*)(PP_Instance instance, PP_Resource encrypted_block, const struct PP_EncryptedBlockInfo* encrypted_block_info))&Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt,
- .InitializeAudioDecoder = (void (*)(PP_Instance instance, const struct PP_AudioDecoderConfig* decoder_config, PP_Resource codec_extra_data))&Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder,
- .InitializeVideoDecoder = (void (*)(PP_Instance instance, const struct PP_VideoDecoderConfig* decoder_config, PP_Resource codec_extra_data))&Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder,
- .DeinitializeDecoder = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder,
- .ResetDecoder = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, uint32_t request_id))&Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder,
- .DecryptAndDecode = (void (*)(PP_Instance instance, PP_DecryptorStreamType decoder_type, PP_Resource encrypted_buffer, const struct PP_EncryptedBlockInfo* encrypted_block_info))&Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode
+ .GenerateKeyRequest = &Pnacl_M24_PPP_ContentDecryptor_Private_GenerateKeyRequest,
+ .AddKey = &Pnacl_M24_PPP_ContentDecryptor_Private_AddKey,
+ .CancelKeyRequest = &Pnacl_M24_PPP_ContentDecryptor_Private_CancelKeyRequest,
+ .Decrypt = &Pnacl_M24_PPP_ContentDecryptor_Private_Decrypt,
+ .InitializeAudioDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_InitializeAudioDecoder,
+ .InitializeVideoDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_InitializeVideoDecoder,
+ .DeinitializeDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_DeinitializeDecoder,
+ .ResetDecoder = &Pnacl_M24_PPP_ContentDecryptor_Private_ResetDecoder,
+ .DecryptAndDecode = &Pnacl_M24_PPP_ContentDecryptor_Private_DecryptAndDecode
};
/* Not generating wrapper interface for PPP_Flash_BrowserOperations_1_0 */
@@ -5092,7 +5092,7 @@ struct PPP_ContentDecryptor_Private_0_6 Pnacl_Wrappers_PPP_ContentDecryptor_Priv
/* Not generating wrapper interface for PPP_Flash_BrowserOperations_1_3 */
struct PPP_Instance_Private_0_1 Pnacl_Wrappers_PPP_Instance_Private_0_1 = {
- .GetInstanceObject = (struct PP_Var (*)(PP_Instance instance))&Pnacl_M18_PPP_Instance_Private_GetInstanceObject
+ .GetInstanceObject = &Pnacl_M18_PPP_Instance_Private_GetInstanceObject
};
struct PPB_Ext_Alarms_Dev_0_1 Pnacl_Wrappers_PPB_Ext_Alarms_Dev_0_1 = {