Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1262)

Unified Diff: ui/gl/generate_bindings.py

Issue 11444028: Make more GL stuff auto-generated (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/gpu.gyp ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/generate_bindings.py
diff --git a/ui/gl/generate_bindings.py b/ui/gl/generate_bindings.py
index c4cd88f8854dc311d2f67680d8155ce7eaf7cf9f..5ec66beac73238c6f9cd152662b651b1fa526922 100755
--- a/ui/gl/generate_bindings.py
+++ b/ui/gl/generate_bindings.py
@@ -1247,6 +1247,58 @@ def GenerateAPIHeader(file, functions, set_name, used_extension_functions):
file.write('\n')
+def GenerateMockHeader(file, functions, set_name, used_extension_functions):
+ """Generates gl_mock_autogen_x.h"""
+
+ # Write file header.
+ file.write(
+"""// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is automatically generated.
+
+""" % {'name': set_name.upper()})
+
+ # Write API declaration.
+ for func in functions:
+ args = func['arguments']
+ if args == 'void':
+ args = ''
+ arg_count = 0
+ if len(args):
+ arg_count = func['arguments'].count(',') + 1
+ file.write(' MOCK_METHOD%d(%s, %s(%s));\n' %
+ (arg_count, func['names'][0][2:], func['return_type'], args))
+
+ file.write('\n')
+
+
+def GenerateInterfaceHeader(
+ file, functions, set_name, used_extension_functions):
+ """Generates gl_interface_autogen_x.h"""
+
+ # Write file header.
+ file.write(
+"""// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file is automatically generated.
+
+""" % {'name': set_name.upper()})
+
+ # Write API declaration.
+ for func in functions:
+ args = func['arguments']
+ if args == 'void':
+ args = ''
+ file.write(' virtual %s %s(%s) = 0;\n' %
+ (func['return_type'], func['names'][0][2:], args))
+
+ file.write('\n')
+
+
def GenerateSource(file, functions, set_name, used_extension_functions):
"""Generates gl_binding_autogen_x.cc"""
@@ -1655,6 +1707,18 @@ def main(argv):
GenerateSource(source_file, functions, set_name, used_extension_functions)
source_file.close()
+ header_file = open(
+ os.path.join(dir, 'gl_interface_autogen_%s.h' % set_name), 'wb')
+ GenerateInterfaceHeader(
+ header_file, functions, set_name, used_extension_functions)
+ header_file.close()
+
+ header_file = open(
+ os.path.join(dir, 'gl_mock_autogen_%s.h' % set_name), 'wb')
+ GenerateMockHeader(
+ header_file, functions, set_name, used_extension_functions)
+ header_file.close()
+
source_file = open(os.path.join(dir, 'gl_bindings_autogen_mock.cc'), 'wb')
GenerateMockSource(source_file, GL_FUNCTIONS)
source_file.close()
« no previous file with comments | « gpu/gpu.gyp ('k') | ui/gl/gl.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698