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

Side by Side Diff: Source/bindings/scripts/code_generator_v8.pm

Issue 125533003: Support multiple flags in RuntimeEnabled (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 11 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) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org> 1 # Copyright (C) 2005, 2006 Nikolas Zimmermann <zimmermann@kde.org>
2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com> 2 # Copyright (C) 2006 Anders Carlsson <andersca@mac.com>
3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com> 3 # Copyright (C) 2006 Samuel Weinig <sam.weinig@gmail.com>
4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org> 4 # Copyright (C) 2006 Alexey Proskuryakov <ap@webkit.org>
5 # Copyright (C) 2006 Apple Computer, Inc. 5 # Copyright (C) 2006 Apple Computer, Inc.
6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc. 6 # Copyright (C) 2007, 2008, 2009, 2012 Google Inc.
7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au> 7 # Copyright (C) 2009 Cameron McCormack <cam@mcc.id.au>
8 # Copyright (C) Research In Motion Limited 2010. All rights reserved. 8 # Copyright (C) Research In Motion Limited 2010. All rights reserved.
9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) 9 # Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies)
10 # Copyright (C) 2012 Ericsson AB. All rights reserved. 10 # Copyright (C) 2012 Ericsson AB. All rights reserved.
(...skipping 5816 matching lines...) Expand 10 before | Expand all | Expand 10 after
5827 } else { 5827 } else {
5828 return "$nativeType $variableName($value, true);"; 5828 return "$nativeType $variableName($value, true);";
5829 } 5829 }
5830 } 5830 }
5831 5831
5832 # Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled. 5832 # Returns the RuntimeEnabledFeatures function name that is hooked up to check if a method/attribute is enabled.
5833 sub GetRuntimeEnabledFunctionName 5833 sub GetRuntimeEnabledFunctionName
5834 { 5834 {
5835 my $signature = shift; 5835 my $signature = shift;
5836 5836
5837 # Given [RuntimeEnabled=FeatureName], 5837 # Given [RuntimeEnabled=FeatureName,
haraken 2014/01/07 04:56:19 Add ']' back.
5838 # return RuntimeEnabledFeatures::{featureName}Enabled; 5838 # return RuntimeEnabledFeatures::{featureName}Enabled;
5839 # If [RuntimeEnabled=FeatureName1&FeatureName2] is given,
5840 # return RuntimeEnabledFeatures::{featureName1}Enabled && RuntimeEnabledFeat ures::{featureName2}Enabled;
5839 my $featureName = ToMethodName($signature->extendedAttributes->{"RuntimeEnab led"}); 5841 my $featureName = ToMethodName($signature->extendedAttributes->{"RuntimeEnab led"});
5842
5843 my $operator = ($featureName =~ /&/ ? '&' : '');
5844 if ($operator) {
5845 my %featureNames;
5846 map { $featureNames{lcfirst($_)} = 1 } split('\\' . $operator, $featureN ame);
5847 return "RuntimeEnabledFeatures::" . join("Enabled() $operator$operator R untimeEnabledFeatures::", sort keys %featureNames) . "Enabled";
5848 }
haraken 2014/01/07 04:56:19 A bit more readable way to do this would be: my $
5849
5840 return "RuntimeEnabledFeatures::${featureName}Enabled"; 5850 return "RuntimeEnabledFeatures::${featureName}Enabled";
5841 } 5851 }
5842 5852
5843 sub GetContextEnabledFunctionName 5853 sub GetContextEnabledFunctionName
5844 { 5854 {
5845 my $signature = shift; 5855 my $signature = shift;
5846 5856
5847 # Given [PerContextEnabled=FeatureName], 5857 # Given [PerContextEnabled=FeatureName],
5848 # return ContextFeatures::{featureName}Enabled 5858 # return ContextFeatures::{featureName}Enabled
5849 my $featureName = ToMethodName($signature->extendedAttributes->{"PerContextE nabled"}); 5859 my $featureName = ToMethodName($signature->extendedAttributes->{"PerContextE nabled"});
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
6349 6359
6350 foreach my $parameter (@{$function->parameters}) { 6360 foreach my $parameter (@{$function->parameters}) {
6351 if ($parameter->type eq "SerializedScriptValue") { 6361 if ($parameter->type eq "SerializedScriptValue") {
6352 return 1; 6362 return 1;
6353 } 6363 }
6354 } 6364 }
6355 return 0; 6365 return 0;
6356 } 6366 }
6357 6367
6358 1; 6368 1;
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