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

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

Issue 2141083002: Fix use of itertools.groupby when collecting origin trial members (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 # Copyright (C) 2013 Google Inc. All rights reserved. 1 # Copyright (C) 2013 Google Inc. All rights reserved.
2 # coding=utf-8 2 # coding=utf-8
3 # 3 #
4 # Redistribution and use in source and binary forms, with or without 4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are 5 # modification, are permitted provided that the following conditions are
6 # met: 6 # met:
7 # 7 #
8 # * Redistributions of source code must retain the above copyright 8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer. 9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above 10 # * Redistributions in binary form must reproduce the above
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 109
110 # Collect all members visible on this interface with a defined origin trial 110 # Collect all members visible on this interface with a defined origin trial
111 origin_trial_members = ( 111 origin_trial_members = (
112 [constant for constant in constants if constant['origin_trial_feature_na me']] + 112 [constant for constant in constants if constant['origin_trial_feature_na me']] +
113 [attribute for attribute in attributes if attribute['origin_trial_featur e_name']] + 113 [attribute for attribute in attributes if attribute['origin_trial_featur e_name']] +
114 [method for method in methods if ( 114 [method for method in methods if (
115 v8_methods.method_is_visible(method, interface.is_partial) and 115 v8_methods.method_is_visible(method, interface.is_partial) and
116 method['origin_trial_feature_name'])] 116 method['origin_trial_feature_name'])]
117 ) 117 )
118 # Group members by origin_trial_feature_name 118 # Group members by origin_trial_feature_name
119 members_by_name = itertools.groupby(origin_trial_members, itemgetter('origin _trial_feature_name')) 119 members_by_name = itertools.groupby(sorted(origin_trial_members,
120 key=itemgetter('origin_trial_feat ure_name')),
121 itemgetter('origin_trial_feature_name'))
120 # Construct the list of dictionaries. 'needs_instance' will be true if any 122 # Construct the list of dictionaries. 'needs_instance' will be true if any
121 # member for the feature has 'on_instance' defined as true. 123 # member for the feature has 'on_instance' defined as true.
122 features = [{'name': name, 124 features = [{'name': name,
123 'needs_instance': reduce(or_, (member.get('on_instance', False) 125 'needs_instance': reduce(or_, (member.get('on_instance', False)
124 for member in members))} 126 for member in members))}
125 for name, members in members_by_name] 127 for name, members in members_by_name]
126 if features: 128 if features:
127 includes.add('bindings/core/v8/ScriptState.h') 129 includes.add('bindings/core/v8/ScriptState.h')
128 includes.add('core/origin_trials/OriginTrials.h') 130 includes.add('core/origin_trials/OriginTrials.h')
129 return sorted(features) 131 return sorted(features)
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 extended_attributes = deleter.extended_attributes 1386 extended_attributes = deleter.extended_attributes
1385 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState') 1387 is_call_with_script_state = v8_utilities.has_extended_attribute_value(delete r, 'CallWith', 'ScriptState')
1386 is_ce_reactions = 'CEReactions' in extended_attributes 1388 is_ce_reactions = 'CEReactions' in extended_attributes
1387 return { 1389 return {
1388 'is_call_with_script_state': is_call_with_script_state, 1390 'is_call_with_script_state': is_call_with_script_state,
1389 'is_ce_reactions': is_ce_reactions, 1391 'is_ce_reactions': is_ce_reactions,
1390 'is_custom': 'Custom' in extended_attributes, 1392 'is_custom': 'Custom' in extended_attributes,
1391 'is_raises_exception': 'RaisesException' in extended_attributes, 1393 'is_raises_exception': 'RaisesException' in extended_attributes,
1392 'name': cpp_name(deleter), 1394 'name': cpp_name(deleter),
1393 } 1395 }
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