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

Unified Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp

Issue 1531443003: [bindings] Implement an ExperimentEnabled IDL extended attribute. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/templates/attributes.cpp
diff --git a/third_party/WebKit/Source/bindings/templates/attributes.cpp b/third_party/WebKit/Source/bindings/templates/attributes.cpp
index 89604a191368913c98024872a6205b5d2d9ea3b4..d36c5b5060170c129167f92fc4e43458365ee19b 100644
--- a/third_party/WebKit/Source/bindings/templates/attributes.cpp
+++ b/third_party/WebKit/Source/bindings/templates/attributes.cpp
@@ -11,6 +11,13 @@ const v8::PropertyCallbackInfo<v8::Value>& info
const v8::FunctionCallbackInfo<v8::Value>& info
{%- endif %})
{
+ {% if attribute.experimental_api_name %}
+ String errorMessage;
haraken 2015/12/16 02:16:41 What is this errorMessage for?
Daniel Nishi 2015/12/16 21:42:02 It explains why an experiment may have failed. Wh
+ if (!Experiments::isApiEnabled(currentExecutionContext(info.GetIsolate()), "{{ attribute.experimental_api_name }}", errorMessage)) {
haraken 2015/12/16 02:16:41 Do you have a CL to implement the isAPIEnabled? I
Daniel Nishi 2015/12/16 21:42:02 https://code.google.com/p/chromium/codesearch#chro
+ v8SetReturnValue(info, v8::Undefined(info.GetIsolate()));
+ return;
+ }
+ {% endif %}
{% if attribute.is_reflect and not attribute.is_url
and attribute.idl_type == 'DOMString' and is_node
and not attribute.is_implemented_in_private_script %}
@@ -468,7 +475,7 @@ bool {{v8_class}}::PrivateScript::{{attribute.name}}AttributeSetter(LocalFrame*
{% set getter_callback =
'%sV8Internal::%sConstructorGetterCallback' % (cpp_class_or_partial, attribute.name)
if attribute.needs_constructor_getter_callback else
- 'v8ConstructorAttributeGetter' %}
+ 'is%sExperimentallyEnabled' % attribute.name if attribute.experimental_api_name else 'v8ConstructorAttributeGetter' %}
haraken 2015/12/16 02:16:41 Avoid using "if ... else ... if ... else".
Daniel Nishi 2015/12/16 21:42:02 I've removed this by eliminating is%sExperimentall
{% set setter_callback =
'%sV8Internal::%sAttributeSetterCallback' % (cpp_class_or_partial, attribute.name)
if attribute.needs_constructor_setter_callback else

Powered by Google App Engine
This is Rietveld 408576698