diff options
author | Zeno Albisser <zeno.albisser@theqtcompany.com> | 2014-12-05 15:04:29 +0100 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2014-12-09 10:49:28 +0100 |
commit | af6588f8d723931a298c995fa97259bb7f7deb55 (patch) | |
tree | 060ca707847ba1735f01af2372e0d5e494dc0366 /chromium/ppapi/generators | |
parent | 2fff84d821cc7b1c785f6404e0f8091333283e74 (diff) | |
download | qtwebengine-chromium-af6588f8d723931a298c995fa97259bb7f7deb55.tar.gz |
BASELINE: Update chromium to 40.0.2214.28 and ninja to 1.5.3.
Change-Id: I759465284fd64d59ad120219cbe257f7402c4181
Reviewed-by: Andras Becsi <andras.becsi@theqtcompany.com>
Diffstat (limited to 'chromium/ppapi/generators')
-rwxr-xr-x | chromium/ppapi/generators/idl_c_proto.py | 52 | ||||
-rwxr-xr-x | chromium/ppapi/generators/idl_outfile.py | 10 | ||||
-rwxr-xr-x | chromium/ppapi/generators/idl_thunk.py | 18 |
3 files changed, 56 insertions, 24 deletions
diff --git a/chromium/ppapi/generators/idl_c_proto.py b/chromium/ppapi/generators/idl_c_proto.py index a6179a8f4b6..d6b9ebc5637 100755 --- a/chromium/ppapi/generators/idl_c_proto.py +++ b/chromium/ppapi/generators/idl_c_proto.py @@ -148,6 +148,7 @@ class CGen(object): }, 'TypeValue': { 'in': '%s', + 'constptr_in': 'const %s*', # So we can use const* for PP_Var sometimes. 'inout': '%s*', 'out': '%s*', 'return': '%s', @@ -174,6 +175,21 @@ class CGen(object): 'interface_t' : 'const void*' } + # Tell how to handle pointers to GL types. + for gltype in ['GLbitfield', 'GLboolean', 'GLbyte', 'GLclampf', + 'GLclampx', 'GLenum', 'GLfixed', 'GLfloat', 'GLint', + 'GLintptr', 'GLshort', 'GLsizei', 'GLsizeiptr', + 'GLubyte', 'GLuint', 'GLushort']: + ptrtype = gltype + '_ptr_t' + TypeMap[ptrtype] = { + 'in': 'const %s', + 'inout': '%s', + 'out': '%s', + 'return': 'const %s', + 'store': '%s' + } + RemapName[ptrtype] = '%s*' % gltype + def __init__(self): self.dbg_depth = 0 @@ -367,6 +383,7 @@ class CGen(object): if node.GetProperty('in'): return 'in' if node.GetProperty('out'): return 'out' if node.GetProperty('inout'): return 'inout' + if node.GetProperty('constptr_in'): return 'constptr_in' return 'return' # @@ -384,6 +401,13 @@ class CGen(object): # Generate passing type by modifying root type rtype = self.GetTypeByMode(node, release, mode) + # If this is an array output, change it from type* foo[] to type** foo. + # type* foo[] means an array of pointers to type, which is confusing. + arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')] + if mode == 'out' and len(arrayspec) == 1 and arrayspec[0] == '[]': + rtype += '*' + del arrayspec[0] + if node.IsA('Enum', 'Interface', 'Struct'): rname = node.GetName() else: @@ -394,7 +418,6 @@ class CGen(object): if '%' in rtype: rtype = rtype % rname name = node.GetName() - arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')] callnode = node.GetOneOf('Callspec') if callnode: callspec = [] @@ -565,6 +588,22 @@ class CGen(object): return out + def DefineUnversionedInterface(self, node, rel): + out = '\n' + if node.GetProperty('force_struct_namespace'): + # Duplicate the definition to put it in struct namespace. This + # attribute is only for legacy APIs like OpenGLES2 and new APIs + # must not use this. See http://crbug.com/411799 + out += self.DefineStructInternals(node, rel, + include_version=False, comment=True) + else: + # Define an unversioned typedef for the most recent version + out += 'typedef struct %s %s;\n' % ( + self.GetStructName(node, rel, include_version=True), + self.GetStructName(node, rel, include_version=False)) + return out + + def DefineStruct(self, node, releases, prefix='', comment=False): __pychecker__ = 'unusednames=comment,prefix' self.LogEnter('DefineStruct %s' % node) @@ -595,10 +634,7 @@ class CGen(object): out = self.DefineStructInternals(node, last_rel, include_version=True, comment=True) if last_rel == newest_stable: - # Define an unversioned typedef for the most recent version - out += '\ntypedef struct %s %s;\n' % ( - self.GetStructName(node, last_rel, include_version=True), - self.GetStructName(node, last_rel, include_version=False)) + out += self.DefineUnversionedInterface(node, last_rel) # Build the rest without comments and with the version number appended for rel in build_list[0:-1]: @@ -613,10 +649,7 @@ class CGen(object): include_version=True, comment=False) if rel == newest_stable: - # Define an unversioned typedef for the most recent version - out += '\ntypedef struct %s %s;\n' % ( - self.GetStructName(node, rel, include_version=True), - self.GetStructName(node, rel, include_version=False)) + out += self.DefineUnversionedInterface(node, rel) self.LogExit('Exit DefineStruct') return out @@ -784,4 +817,3 @@ def main(args): if __name__ == '__main__': sys.exit(main(sys.argv[1:])) - diff --git a/chromium/ppapi/generators/idl_outfile.py b/chromium/ppapi/generators/idl_outfile.py index 61b678c18af..053cf3ea05b 100755 --- a/chromium/ppapi/generators/idl_outfile.py +++ b/chromium/ppapi/generators/idl_outfile.py @@ -8,6 +8,7 @@ import difflib import os import time +import subprocess import sys from idl_log import ErrOut, InfoOut, WarnOut @@ -90,6 +91,14 @@ class IDLOutFile(object): raise RuntimeError('Could not write to closed file %s.' % self.filename) self.outlist.append(string) + # Run clang-format on the buffered file contents. + def ClangFormat(self): + clang_format = subprocess.Popen(['clang-format', '-style=Chromium'], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE) + new_output = clang_format.communicate("".join(self.outlist))[0] + self.outlist = [new_output] + # Close the file, flushing it to disk def Close(self): filename = os.path.realpath(self.filename) @@ -123,6 +132,7 @@ class IDLOutFile(object): if not GetOption('test'): outfile = open(filename, 'wb') outfile.write(outtext) + outfile.close(); InfoOut.Log('Output %s written.' % self.filename) return True diff --git a/chromium/ppapi/generators/idl_thunk.py b/chromium/ppapi/generators/idl_thunk.py index 5db7abcccd9..5e037a22129 100755 --- a/chromium/ppapi/generators/idl_thunk.py +++ b/chromium/ppapi/generators/idl_thunk.py @@ -436,6 +436,7 @@ class TGen(GeneratorByFile): self.WriteHead(thunk_out, filenode, releases, options, meta) thunk_out.Write('\n\n'.join(body)) self.WriteTail(thunk_out, filenode, releases, options) + thunk_out.ClangFormat() return thunk_out.Close() def WriteHead(self, out, filenode, releases, options, meta): @@ -446,15 +447,11 @@ class TGen(GeneratorByFile): assert(cright_node.IsA('Copyright')) out.Write('%s\n' % cgen.Copyright(cright_node, cpp_style=True)) - # Wrap the From ... modified ... comment if it would be >80 characters. from_text = 'From %s' % ( filenode.GetProperty('NAME').replace(os.sep,'/')) modified_text = 'modified %s.' % ( filenode.GetProperty('DATETIME')) - if len(from_text) + len(modified_text) < 74: - out.Write('// %s %s\n\n' % (from_text, modified_text)) - else: - out.Write('// %s,\n// %s\n\n' % (from_text, modified_text)) + out.Write('// %s %s\n\n' % (from_text, modified_text)) if meta.BuiltinIncludes(): for include in sorted(meta.BuiltinIncludes()): @@ -529,10 +526,7 @@ class TGen(GeneratorByFile): thunk_type = '_'.join((node.GetName(), version)) version_list.append((thunk_type, thunk_name)) - declare_line = 'const %s %s = {' % (thunk_type, thunk_name) - if len(declare_line) > 80: - declare_line = 'const %s\n %s = {' % (thunk_type, thunk_name) - out.Write('%s\n' % declare_line) + out.Write('const %s %s = {\n' % (thunk_type, thunk_name)) generated_functions = [] members = node.GetListOf('Member') for child in members: @@ -550,12 +544,8 @@ class TGen(GeneratorByFile): out.Write('} // namespace\n') out.Write('\n') for thunk_type, thunk_name in version_list: - thunk_decl = ('PPAPI_THUNK_EXPORT const %s* Get%s_Thunk() {\n' % + out.Write('PPAPI_THUNK_EXPORT const %s* Get%s_Thunk() {\n' % (thunk_type, thunk_type)) - if len(thunk_decl) > 80: - thunk_decl = ('PPAPI_THUNK_EXPORT const %s*\n Get%s_Thunk() {\n' % - (thunk_type, thunk_type)) - out.Write(thunk_decl) out.Write(' return &%s;\n' % thunk_name) out.Write('}\n') out.Write('\n') |