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

Issue 2620153004: [Bindings] Code cleanup: Early return if funtime enabled interface is false (Closed)

Created:
3 years, 11 months ago by peria
Modified:
3 years, 11 months ago
Reviewers:
haraken, bashi, Yuki
CC:
chromium-reviews, blink-reviews, blink-reviews-bindings_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Put an early return if an interface has a runtime enabled flag and it is false. It was confusing that the flag seemed to check if enable some specific members (attributes, methods, and constants), but it should check everything of the interface. It means if the flag is false, we don't have to check all members, e.g. indexed properties and iterators. BUG=None Review-Url: https://codereview.chromium.org/2620153004 Cr-Commit-Position: refs/heads/master@{#443179} Committed: https://chromium.googlesource.com/chromium/src/+/c162e0c69d45b4bb191cb80ca9fde153950a270b

Patch Set 1 : . #

Total comments: 6
Unified diffs Side-by-side diffs Delta from patch set Stats (+94 lines, -44 lines) Patch
M third_party/WebKit/Source/bindings/scripts/code_generator.py View 2 chunks +2 lines, -1 line 0 comments Download
M third_party/WebKit/Source/bindings/scripts/v8_utilities.py View 2 chunks +6 lines, -2 lines 2 comments Download
M third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl View 4 chunks +10 lines, -5 lines 4 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8SVGTestInterface.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestCallbackFunctions.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestConstants.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestException.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexed.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedGlobal.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestIntegerIndexedPrimaryGlobal.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface.cpp View 2 chunks +22 lines, -19 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface2.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterface3.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCheckSecurity.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor2.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor3.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceConstructor4.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceCustomConstructor.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceDocument.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEmpty.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventInitConstructor.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceEventTarget.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceGarbageCollected.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNamedConstructor2.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceNode.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceOriginTrialEnabled.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestInterfaceSecureContext.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestNode.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestObject.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperations.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestSpecialOperationsNotEnumerable.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/core/V8TestTypedefs.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface2Partial.cpp View 1 chunk +1 line, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterface5.cpp View 2 chunks +13 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/bindings/tests/results/modules/V8TestInterfacePartial.cpp View 2 chunks +10 lines, -7 lines 0 comments Download

Messages

Total messages: 30 (24 generated)
peria
PTL
3 years, 11 months ago (2017-01-12 03:44:35 UTC) #22
haraken
LGTM
3 years, 11 months ago (2017-01-12 04:06:49 UTC) #23
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2620153004/80001
3 years, 11 months ago (2017-01-12 04:49:43 UTC) #25
commit-bot: I haz the power
Committed patchset #1 (id:80001) as https://chromium.googlesource.com/chromium/src/+/c162e0c69d45b4bb191cb80ca9fde153950a270b
3 years, 11 months ago (2017-01-12 07:35:50 UTC) #28
Yuki
https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Source/bindings/scripts/v8_utilities.py File third_party/WebKit/Source/bindings/scripts/v8_utilities.py (right): https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Source/bindings/scripts/v8_utilities.py#newcode115 third_party/WebKit/Source/bindings/scripts/v8_utilities.py:115: def runtime_enabled_function(name): I'm uneasy with this name because "runtime ...
3 years, 11 months ago (2017-01-13 02:38:37 UTC) #29
peria
3 years, 11 months ago (2017-01-13 05:54:26 UTC) #30
Message was sent while issue was closed.
https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Sour...
File third_party/WebKit/Source/bindings/scripts/v8_utilities.py (right):

https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/bindings/scripts/v8_utilities.py:115: def
runtime_enabled_function(name):
On 2017/01/13 02:38:37, Yuki wrote:
> I'm uneasy with this name because "runtime enabled function" reads a function
> (or function name) which can be enabled at runtime.
> 
> This function is a predictor.  So, I'd recommend "is_runtime_enabled" instead.
> 
>   def is_runtime_enabled(feature_name):

I'll make a follow up CL.
But I think the prefix "is_" is not good for functions which return strings.

https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Sour...
File third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl
(right):

https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl:410: if
(!{{runtime_enabled_feature_name | runtime_enabled_function}}) {
On 2017/01/13 02:38:37, Yuki wrote:
> This is okay, but I guess you should be able to write:
>   if (!{{is_runtime_enabled(runtime_enabled_feature_name)}}) {
>   }
> They're equivalent, though.

As a context of Jinja, I think it better to make the content of
|runtime_enabled_feature_name| (e.g. "FooBar") to be the function name (e.g.
"RuntimeEnabledFeatures::fooBarEnabled()").

https://codereview.chromium.org/2620153004/diff/80001/third_party/WebKit/Sour...
third_party/WebKit/Source/bindings/templates/interface_base.cpp.tmpl:410: if
(!{{runtime_enabled_feature_name | runtime_enabled_function}}) {
On 2017/01/13 02:38:37, Yuki wrote:
> If the feature is disabled, we shouldn't hit this line.  Do you have any clues
> why we're calling V8Type::installTypeTemplate() even when Type is disabled? 
Who
> is calling the function?

V8Type::domTemplate() calls it through V8DOMConfiguration::domClassTemplate(),
and domTemplate()'s caller is handler of V8Type::wrapperTypeInfo.

So if we want to avoid calling V8Type::installV8TypeTemplate()
depending on runtime enabled flags, we need to make a branch in
V8Type::domTemplate().

Powered by Google App Engine
This is Rietveld 408576698