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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/generate_init_partial_interfaces.py

Issue 2698623004: [Style] Update style of initPartialInterfacesInModules.cpp (Closed)
Patch Set: Created 3 years, 10 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """Generate initPartialInterfacesInModules(), which registers partial interfaces in modules to core interfaces.""" 6 """Generate initPartialInterfacesInModules(), which registers partial interfaces in modules to core interfaces."""
7 7
8 # pylint: disable=relative-import 8 # pylint: disable=relative-import
9 9
10 from optparse import OptionParser 10 from optparse import OptionParser
11 import os 11 import os
12 import posixpath 12 import posixpath
13 import sys 13 import sys
14 14
15 from utilities import get_file_contents 15 from utilities import get_file_contents
16 from utilities import idl_filename_to_interface_name 16 from utilities import idl_filename_to_interface_name
17 from utilities import read_idl_files_list_from_file 17 from utilities import read_idl_files_list_from_file
18 from utilities import should_generate_impl_file_from_idl 18 from utilities import should_generate_impl_file_from_idl
19 from utilities import write_file 19 from utilities import write_file
20 20
21 21
22 _COPYRIGHT = """// Copyright 2014 The Chromium Authors. All rights reserved. 22 _COPYRIGHT = """// Copyright 2014 The Chromium Authors. All rights reserved.
23 // Use of this source code is governed by a BSD-style license that can be 23 // Use of this source code is governed by a BSD-style license that can be
24 // found in the LICENSE file. 24 // found in the LICENSE file.
25
26 """ 25 """
27 26
28 _INIT_PARTIAL_INTERFACE = """%s 27 _INIT_PARTIAL_INTERFACE = """%s
29 %s 28 %s
30 29
31 namespace blink { 30 namespace blink {
32 31
33 void initPartialInterfacesInModules() 32 void initPartialInterfacesInModules() {
34 {
35 %s 33 %s
36 } 34 }
37 35
38 } // namespace blink 36 } // namespace blink
39 """ 37 """
40 38
41 39
42 def parse_options(): 40 def parse_options():
43 usage = 'Usage: %prog [options]' 41 usage = 'Usage: %prog [options]'
44 parser = OptionParser(usage=usage) 42 parser = OptionParser(usage=usage)
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 84
87 idl_file_names = read_idl_files_list_from_file(options.idl_files_list, is_gy p_format=options.gyp_format_list) 85 idl_file_names = read_idl_files_list_from_file(options.idl_files_list, is_gy p_format=options.gyp_format_list)
88 86
89 meta_data_list = extract_meta_data(idl_file_names) 87 meta_data_list = extract_meta_data(idl_file_names)
90 interface_names = ['V8%sPartial' % meta_data['name'] 88 interface_names = ['V8%sPartial' % meta_data['name']
91 for meta_data in meta_data_list] 89 for meta_data in meta_data_list]
92 interface_names.sort() 90 interface_names.sort()
93 91
94 includes = ['#include "bindings/modules/v8/%s.h"' % interface_name 92 includes = ['#include "bindings/modules/v8/%s.h"' % interface_name
95 for interface_name in interface_names] 93 for interface_name in interface_names]
96 initialize_calls = [' %s::initialize();' % interface_name 94 initialize_calls = [' %s::initialize();' % interface_name
97 for interface_name in interface_names] 95 for interface_name in interface_names]
98 96
99 content = _INIT_PARTIAL_INTERFACE % ( 97 content = _INIT_PARTIAL_INTERFACE % (
100 _COPYRIGHT, 98 _COPYRIGHT,
101 '\n'.join(includes), 99 '\n'.join(includes),
102 '\n'.join(initialize_calls)) 100 '\n'.join(initialize_calls))
103 101
104 write_file(content, options.output) 102 write_file(content, options.output)
105 103
106 104
107 if __name__ == '__main__': 105 if __name__ == '__main__':
108 sys.exit(main()) 106 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698