summaryrefslogtreecommitdiffstats
path: root/ppapi/generators/idl_gen_wrapper.py
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 15:58:51 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-06-21 15:58:51 +0000
commit12841e5838a6a940ef60d8d96980bdec2c076466 (patch)
tree386f331d6021a7be52256d818d30ff0b5442fb6d /ppapi/generators/idl_gen_wrapper.py
parentaf6e075db3a56aadfbe492f20f3887128f358305 (diff)
downloadchromium_src-12841e5838a6a940ef60d8d96980bdec2c076466.zip
chromium_src-12841e5838a6a940ef60d8d96980bdec2c076466.tar.gz
chromium_src-12841e5838a6a940ef60d8d96980bdec2c076466.tar.bz2
Pepper: Don't emit structs with no wrapping.
The behavior in the PNaCl shim layer is the same if there's a struct for an interface with no wrapper or no struct at all. This change removes structs where no wrapping is necessary. BUG=251460 Review URL: https://chromiumcodereview.appspot.com/17153012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@207839 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/generators/idl_gen_wrapper.py')
-rw-r--r--ppapi/generators/idl_gen_wrapper.py23
1 files changed, 12 insertions, 11 deletions
diff --git a/ppapi/generators/idl_gen_wrapper.py b/ppapi/generators/idl_gen_wrapper.py
index b828562..bbcfd71 100644
--- a/ppapi/generators/idl_gen_wrapper.py
+++ b/ppapi/generators/idl_gen_wrapper.py
@@ -157,7 +157,7 @@ static struct %(wrapper_struct)s *%(wrapper_prefix)sPPPShimIface(
const void *__%(wrapper_prefix)s_PPBGetInterface(const char *name) {
struct %(wrapper_struct)s *wrapper = %(wrapper_prefix)sPPBShimIface(name);
if (wrapper == NULL) {
- /* We don't have an IDL for this, for some reason. Take our chances. */
+ /* We did not generate a wrapper for this, so return the real interface. */
return (*__real_PPBGetInterface)(name);
}
@@ -178,7 +178,7 @@ const void *__%(wrapper_prefix)s_PPBGetInterface(const char *name) {
const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) {
struct %(wrapper_struct)s *wrapper = %(wrapper_prefix)sPPPShimIface(name);
if (wrapper == NULL) {
- /* We don't have an IDL for this, for some reason. Take our chances. */
+ /* We did not generate a wrapper for this, so return the real interface. */
return (*__real_PPPGetInterface)(name);
}
@@ -364,9 +364,7 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) {
if iface.needs_wrapping:
wrap_iface = '(void *) &%s_Wrappers_%s' % (self.wrapper_prefix,
iface.struct_name)
- else:
- wrap_iface = 'NULL /* Still need slot for real_iface */'
- out.Write("""static struct %s %s = {
+ out.Write("""static struct %s %s = {
.iface_macro = %s,
.wrapped_iface = %s,
.real_iface = NULL
@@ -379,10 +377,11 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) {
ppb_wrapper_infos = []
ppp_wrapper_infos = []
for iface in iface_releases:
- appender = PPKind.ChoosePPFunc(iface,
- ppb_wrapper_infos.append,
- ppp_wrapper_infos.append)
- appender(' &%s' % self.GetWrapperInfoName(iface))
+ if iface.needs_wrapping:
+ appender = PPKind.ChoosePPFunc(iface,
+ ppb_wrapper_infos.append,
+ ppp_wrapper_infos.append)
+ appender(' &%s' % self.GetWrapperInfoName(iface))
ppb_wrapper_infos.append(' NULL')
ppp_wrapper_infos.append(' NULL')
out.Write(
@@ -399,8 +398,10 @@ const void *__%(wrapper_prefix)s_PPPGetInterface(const char *name) {
"""
out.Write('/* BEGIN Declarations for all Wrapper Infos */\n\n')
for iface in iface_releases:
- out.Write('static struct %s %s;\n' %
- (self.GetWrapperMetadataName(), self.GetWrapperInfoName(iface)))
+ if iface.needs_wrapping:
+ out.Write('static struct %s %s;\n' %
+ (self.GetWrapperMetadataName(),
+ self.GetWrapperInfoName(iface)))
out.Write('/* END Declarations for all Wrapper Infos. */\n\n')