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

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

Issue 1257613003: bindings: Supports inheritance of [Unforgeable] attributes as accessor-type properties. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made inherit_unforgeable_attributes more robust. Created 5 years, 4 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 | Annotate | Revision Log
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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 @property 175 @property
176 def include_path_for_export(self): 176 def include_path_for_export(self):
177 return 'modules/ModulesExport.h' 177 return 'modules/ModulesExport.h'
178 178
179 179
180 def load_interfaces_info_overall_pickle(info_dir): 180 def load_interfaces_info_overall_pickle(info_dir):
181 with open(os.path.join(info_dir, 'modules', 'InterfacesInfoOverall.pickle')) as interface_info_file: 181 with open(os.path.join(info_dir, 'modules', 'InterfacesInfoOverall.pickle')) as interface_info_file:
182 return pickle.load(interface_info_file) 182 return pickle.load(interface_info_file)
183 183
184 184
185 def merge_dict_recursively(target, diff):
186 """Merges two dicts into one.
187 |target| will be updated with |diff|. Part of |diff| may be re-used in
188 |target|.
189 """
190 for key, value in diff.iteritems():
191 if key not in target:
192 target[key] = value
193 elif type(value) == dict:
194 merge_dict_recursively(target[key], value)
195 elif type(value) == list:
196 target[key].extend(value)
197 elif type(value) == set:
198 target[key].update(value)
199 else:
200 # Testing IDLs want to overwrite the values. Production code
201 # doesn't need any overwriting.
202 target[key] = value
203
204
185 def create_component_info_provider_core(info_dir): 205 def create_component_info_provider_core(info_dir):
186 interfaces_info = load_interfaces_info_overall_pickle(info_dir) 206 interfaces_info = load_interfaces_info_overall_pickle(info_dir)
187 with open(os.path.join(info_dir, 'core', 'ComponentInfoCore.pickle')) as com ponent_info_file: 207 with open(os.path.join(info_dir, 'core', 'ComponentInfoCore.pickle')) as com ponent_info_file:
188 component_info = pickle.load(component_info_file) 208 component_info = pickle.load(component_info_file)
189 return ComponentInfoProviderCore(interfaces_info, component_info) 209 return ComponentInfoProviderCore(interfaces_info, component_info)
190 210
191 211
192 def create_component_info_provider_modules(info_dir): 212 def create_component_info_provider_modules(info_dir):
193 interfaces_info = load_interfaces_info_overall_pickle(info_dir) 213 interfaces_info = load_interfaces_info_overall_pickle(info_dir)
194 with open(os.path.join(info_dir, 'core', 'ComponentInfoCore.pickle')) as com ponent_info_file: 214 with open(os.path.join(info_dir, 'core', 'ComponentInfoCore.pickle')) as com ponent_info_file:
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
348 extended_attributes_string = match.group(1) 368 extended_attributes_string = match.group(1)
349 match = re.search(r'[^=]\bExposed\(([^)]*)\)', file_contents) 369 match = re.search(r'[^=]\bExposed\(([^)]*)\)', file_contents)
350 if not match: 370 if not match:
351 return None 371 return None
352 arguments = [] 372 arguments = []
353 for argument in map(string.strip, match.group(1).split(',')): 373 for argument in map(string.strip, match.group(1).split(',')):
354 exposed, runtime_enabled = argument.split() 374 exposed, runtime_enabled = argument.split()
355 arguments.append({'exposed': exposed, 'runtime_enabled': runtime_enabled }) 375 arguments.append({'exposed': exposed, 'runtime_enabled': runtime_enabled })
356 376
357 return arguments 377 return arguments
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698