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

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

Issue 2312093003: Generated bindings for IDL callback functions (Closed)
Patch Set: Did rebase-update Created 4 years, 3 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
OLDNEW
1 # Copyright 2014 The Chromium Authors. All rights reserved. 1 # Copyright 2014 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 """Utility functions (file reading, simple IDL parsing by regexes) for IDL build . 5 """Utility functions (file reading, simple IDL parsing by regexes) for IDL build .
6 6
7 Design doc: http://www.chromium.org/developers/design-documents/idl-build 7 Design doc: http://www.chromium.org/developers/design-documents/idl-build
8 """ 8 """
9 9
10 import os 10 import os
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 return {} 84 return {}
85 85
86 @property 86 @property
87 def union_types(self): 87 def union_types(self):
88 return set() 88 return set()
89 89
90 @property 90 @property
91 def include_path_for_union_types(self, union_type): 91 def include_path_for_union_types(self, union_type):
92 return None 92 return None
93 93
94 @property
95 def callback_functions(self):
96 return {}
97
94 98
95 class ComponentInfoProviderCore(ComponentInfoProvider): 99 class ComponentInfoProviderCore(ComponentInfoProvider):
96 def __init__(self, interfaces_info, component_info): 100 def __init__(self, interfaces_info, component_info):
97 super(ComponentInfoProviderCore, self).__init__() 101 super(ComponentInfoProviderCore, self).__init__()
98 self._interfaces_info = interfaces_info 102 self._interfaces_info = interfaces_info
99 self._component_info = component_info 103 self._component_info = component_info
100 104
101 @property 105 @property
102 def interfaces_info(self): 106 def interfaces_info(self):
103 return self._interfaces_info 107 return self._interfaces_info
(...skipping 12 matching lines...) Expand all
116 120
117 @property 121 @property
118 def union_types(self): 122 def union_types(self):
119 return self._component_info['union_types'] 123 return self._component_info['union_types']
120 124
121 def include_path_for_union_types(self, union_type): 125 def include_path_for_union_types(self, union_type):
122 name = shorten_union_name(union_type) 126 name = shorten_union_name(union_type)
123 return 'bindings/core/v8/%s.h' % name 127 return 'bindings/core/v8/%s.h' % name
124 128
125 @property 129 @property
130 def callback_functions(self):
131 return self._component_info['callback_functions']
132
133 @property
126 def specifier_for_export(self): 134 def specifier_for_export(self):
127 return 'CORE_EXPORT ' 135 return 'CORE_EXPORT '
128 136
129 @property 137 @property
130 def include_path_for_export(self): 138 def include_path_for_export(self):
131 return 'core/CoreExport.h' 139 return 'core/CoreExport.h'
132 140
133 141
134 class ComponentInfoProviderModules(ComponentInfoProvider): 142 class ComponentInfoProviderModules(ComponentInfoProvider):
135 def __init__(self, interfaces_info, component_info_core, 143 def __init__(self, interfaces_info, component_info_core,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 175
168 def include_path_for_union_types(self, union_type): 176 def include_path_for_union_types(self, union_type):
169 core_union_type_names = [core_union_type.name for core_union_type 177 core_union_type_names = [core_union_type.name for core_union_type
170 in self._component_info_core['union_types']] 178 in self._component_info_core['union_types']]
171 name = shorten_union_name(union_type) 179 name = shorten_union_name(union_type)
172 if union_type.name in core_union_type_names: 180 if union_type.name in core_union_type_names:
173 return 'bindings/core/v8/%s.h' % name 181 return 'bindings/core/v8/%s.h' % name
174 return 'bindings/modules/v8/%s.h' % name 182 return 'bindings/modules/v8/%s.h' % name
175 183
176 @property 184 @property
185 def callback_functions(self):
Yuki 2016/09/08 10:45:25 s/TODO/TODO(lkawai)/
lkawai 2016/09/09 07:56:48 Done.
186 # TODO: Currrently modules can not use callback functions defined in cor e.
187 return self._component_info_modules['callback_functions']
188
189 @property
177 def specifier_for_export(self): 190 def specifier_for_export(self):
178 return 'MODULES_EXPORT ' 191 return 'MODULES_EXPORT '
179 192
180 @property 193 @property
181 def include_path_for_export(self): 194 def include_path_for_export(self):
182 return 'modules/ModulesExport.h' 195 return 'modules/ModulesExport.h'
183 196
184 197
185 def load_interfaces_info_overall_pickle(info_dir): 198 def load_interfaces_info_overall_pickle(info_dir):
186 with open(os.path.join(info_dir, 'modules', 'InterfacesInfoOverall.pickle')) as interface_info_file: 199 with open(os.path.join(info_dir, 'modules', 'InterfacesInfoOverall.pickle')) as interface_info_file:
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 466
454 # Remember an open brace. 467 # Remember an open brace.
455 match = re_last_brace.search(line) 468 match = re_last_brace.search(line)
456 was_open_brace = (match and match.group('last') == '{' and 'namespace' n ot in line) 469 was_open_brace = (match and match.group('last') == '{' and 'namespace' n ot in line)
457 470
458 # Let |'\n'.join| emit the last newline. 471 # Let |'\n'.join| emit the last newline.
459 if output: 472 if output:
460 output.append('') 473 output.append('')
461 474
462 return '\n'.join(output) 475 return '\n'.join(output)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698