OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 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 """Base class for generating wrapper functions for PPAPI methods. | 5 """Base class for generating wrapper functions for PPAPI methods. |
6 """ | 6 """ |
7 | 7 |
8 from datetime import datetime | 8 from datetime import datetime |
9 import os | 9 import os |
10 import sys | 10 import sys |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 return ''.join(result) | 317 return ''.join(result) |
318 | 318 |
319 | 319 |
320 def GenerateWrapperInterfaces(self, iface_releases, out): | 320 def GenerateWrapperInterfaces(self, iface_releases, out): |
321 for iface in iface_releases: | 321 for iface in iface_releases: |
322 if not iface.needs_wrapping: | 322 if not iface.needs_wrapping: |
323 out.Write('/* Not generating wrapper interface for %s */\n\n' % | 323 out.Write('/* Not generating wrapper interface for %s */\n\n' % |
324 iface.struct_name) | 324 iface.struct_name) |
325 continue | 325 continue |
326 | 326 |
327 out.Write('struct %s %s_Wrappers_%s = {\n' % (iface.struct_name, | 327 out.Write('static struct %s %s_Wrappers_%s = {\n' % (iface.struct_name, |
328 self.wrapper_prefix, | 328 self.wrapper_prefix, |
329 iface.struct_name)) | 329 iface.struct_name)) |
330 methods = [] | 330 methods = [] |
331 for member in iface.node.GetListOf('Member'): | 331 for member in iface.node.GetListOf('Member'): |
332 # Skip the method if it's not actually in the release. | 332 # Skip the method if it's not actually in the release. |
333 if not member.InReleases([iface.release]): | 333 if not member.InReleases([iface.release]): |
334 continue | 334 continue |
335 prefix = self.WrapperMethodPrefix(iface.node, iface.release) | 335 prefix = self.WrapperMethodPrefix(iface.node, iface.release) |
336 # Casts are necessary for the PPB_* wrappers because we must | 336 # Casts are necessary for the PPB_* wrappers because we must |
337 # cast away "__attribute__((pnaclcall))". The PPP_* wrappers | 337 # cast away "__attribute__((pnaclcall))". The PPP_* wrappers |
338 # must match the default calling conventions and so don't have | 338 # must match the default calling conventions and so don't have |
339 # the attribute, so omitting casts for them provides a little | 339 # the attribute, so omitting casts for them provides a little |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
440 self.GenerateWrapperInterfaces(iface_releases, out) | 440 self.GenerateWrapperInterfaces(iface_releases, out) |
441 | 441 |
442 # Generate a table of the wrapped interface structs that can be looked up. | 442 # Generate a table of the wrapped interface structs that can be looked up. |
443 self.GenerateWrapperInfoAndCollection(iface_releases, out) | 443 self.GenerateWrapperInfoAndCollection(iface_releases, out) |
444 | 444 |
445 # Write out the IDL-invariant functions. | 445 # Write out the IDL-invariant functions. |
446 self.GenerateFixedFunctions(out) | 446 self.GenerateFixedFunctions(out) |
447 | 447 |
448 out.Close() | 448 out.Close() |
449 return 0 | 449 return 0 |
OLD | NEW |