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

Side by Side Diff: third_party/WebKit/Source/bindings/templates/attributes.cpp

Issue 1861433002: Make [OriginTrialEnabled] and [RuntimeEnabled] mutually exclusive (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@586594-separate-tests
Patch Set: Correct IDL for Web Bluetooth Created 4 years, 8 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
OLDNEW
1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %} 1 {% from 'utilities.cpp' import declare_enum_validation_variable, v8_value_to_loc al_cpp_value, check_origin_trial %}
2 2
3 {##############################################################################} 3 {##############################################################################}
4 {% macro attribute_getter(attribute, world_suffix) %} 4 {% macro attribute_getter(attribute, world_suffix) %}
5 static void {{attribute.name}}AttributeGetter{{world_suffix}}( 5 static void {{attribute.name}}AttributeGetter{{world_suffix}}(
6 {%- if attribute.is_data_type_property %} 6 {%- if attribute.is_data_type_property %}
7 const v8::PropertyCallbackInfo<v8::Value>& info 7 const v8::PropertyCallbackInfo<v8::Value>& info
8 {%- else %} 8 {%- else %}
9 const v8::FunctionCallbackInfo<v8::Value>& info 9 const v8::FunctionCallbackInfo<v8::Value>& info
10 {%- endif %}) 10 {%- endif %})
11 { 11 {
12 {% if attribute.is_origin_trial_enabled %} 12 {% if attribute.origin_trial_enabled_function %}
13 {{check_origin_trial(attribute) | indent}} 13 {{check_origin_trial(attribute) | indent}}
14 {% endif %} 14 {% endif %}
15 {% if attribute.is_reflect and not attribute.is_url 15 {% if attribute.is_reflect and not attribute.is_url
16 and attribute.idl_type == 'DOMString' and is_node 16 and attribute.idl_type == 'DOMString' and is_node
17 and not attribute.is_implemented_in_private_script %} 17 and not attribute.is_implemented_in_private_script %}
18 {% set cpp_class, v8_class = 'Element', 'V8Element' %} 18 {% set cpp_class, v8_class = 'Element', 'V8Element' %}
19 {% endif %} 19 {% endif %}
20 {# holder #} 20 {# holder #}
21 {% if not attribute.is_static %} 21 {% if not attribute.is_static %}
22 {% if attribute.is_lenient_this %} 22 {% if attribute.is_lenient_this %}
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 {%- else %} 169 {%- else %}
170 const v8::FunctionCallbackInfo<v8::Value>& info 170 const v8::FunctionCallbackInfo<v8::Value>& info
171 {%- endif %}) 171 {%- endif %})
172 { 172 {
173 {% if attribute.deprecate_as %} 173 {% if attribute.deprecate_as %}
174 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); 174 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}});
175 {% endif %} 175 {% endif %}
176 {% if attribute.measure_as %} 176 {% if attribute.measure_as %}
177 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('AttributeGetter')}}); 177 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('AttributeGetter')}});
178 {% endif %} 178 {% endif %}
179 {% if attribute.is_origin_trial_enabled %} 179 {% if attribute.origin_trial_enabled_function %}
180 {{check_origin_trial(attribute) | indent}} 180 {{check_origin_trial(attribute) | indent}}
181 {% endif %} 181 {% endif %}
182 {% if world_suffix in attribute.activity_logging_world_list_for_getter %} 182 {% if world_suffix in attribute.activity_logging_world_list_for_getter %}
183 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext()); 183 ScriptState* scriptState = ScriptState::from(info.GetIsolate()->GetCurrentCo ntext());
184 V8PerContextData* contextData = scriptState->perContextData(); 184 V8PerContextData* contextData = scriptState->perContextData();
185 {% if attribute.activity_logging_world_check %} 185 {% if attribute.activity_logging_world_check %}
186 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger()) 186 if (scriptState->world().isIsolatedWorld() && contextData && contextData->ac tivityLogger())
187 {% else %} 187 {% else %}
188 if (contextData && contextData->activityLogger()) 188 if (contextData && contextData->activityLogger())
189 {% endif %} 189 {% endif %}
(...skipping 11 matching lines...) Expand all
201 {##############################################################################} 201 {##############################################################################}
202 {% macro constructor_getter_callback(attribute, world_suffix) %} 202 {% macro constructor_getter_callback(attribute, world_suffix) %}
203 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) 203 static void {{attribute.name}}ConstructorGetterCallback{{world_suffix}}(v8::Loca l<v8::Name> property, const v8::PropertyCallbackInfo<v8::Value>& info)
204 { 204 {
205 {% if attribute.deprecate_as %} 205 {% if attribute.deprecate_as %}
206 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}}); 206 Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentEx ecutionContext(info.GetIsolate()), UseCounter::{{attribute.deprecate_as}});
207 {% endif %} 207 {% endif %}
208 {% if attribute.measure_as %} 208 {% if attribute.measure_as %}
209 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} ); 209 UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionConte xt(info.GetIsolate()), UseCounter::{{attribute.measure_as('ConstructorGetter')}} );
210 {% endif %} 210 {% endif %}
211 {% if attribute.is_origin_trial_enabled %} 211 {% if attribute.origin_trial_enabled_function %}
212 {{check_origin_trial(attribute) | indent}} 212 {{check_origin_trial(attribute) | indent}}
213 {% endif %} 213 {% endif %}
214 v8ConstructorAttributeGetter(property, info); 214 v8ConstructorAttributeGetter(property, info);
215 } 215 }
216 {% endmacro %} 216 {% endmacro %}
217 217
218 218
219 {##############################################################################} 219 {##############################################################################}
220 {% macro attribute_setter(attribute, world_suffix) %} 220 {% macro attribute_setter(attribute, world_suffix) %}
221 static void {{attribute.name}}AttributeSetter{{world_suffix}}( 221 static void {{attribute.name}}AttributeSetter{{world_suffix}}(
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
403 return false; 403 return false;
404 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame); 404 ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
405 if (!scriptStateInUserScript) 405 if (!scriptStateInUserScript)
406 return false; 406 return false;
407 407
408 ScriptState::Scope scope(scriptState); 408 ScriptState::Scope scope(scriptState);
409 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate()); 409 v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Globa l(), scriptState->isolate());
410 if (holder.IsEmpty()) 410 if (holder.IsEmpty())
411 return false; 411 return false;
412 412
413 {% if attribute.is_origin_trial_enabled %} 413 {% if attribute.origin_trial_enabled_function %}
414 {{check_origin_trial(attribute, "scriptState->isolate()") | indent}} 414 {{check_origin_trial(attribute, "scriptState->isolate()") | indent}}
415 {% endif %} 415 {% endif %}
416 416
417 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() ); 417 ExceptionState exceptionState(ExceptionState::GetterContext, "{{attribute.na me}}", "{{cpp_class}}", scriptState->context()->Global(), scriptState->isolate() );
418 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde r); 418 v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMAttributeGetter(sc riptState, scriptStateInUserScript, "{{cpp_class}}", "{{attribute.name}}", holde r);
419 if (v8Value.IsEmpty()) 419 if (v8Value.IsEmpty())
420 return false; 420 return false;
421 {{v8_value_to_local_cpp_value(attribute.private_script_v8_value_to_local_cpp _value) | indent}} 421 {{v8_value_to_local_cpp_value(attribute.private_script_v8_value_to_local_cpp _value) | indent}}
422 RELEASE_ASSERT(!exceptionState.hadException()); 422 RELEASE_ASSERT(!exceptionState.hadException());
423 *result = cppValue; 423 *result = cppValue;
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 setter_callback_for_main_world, 499 setter_callback_for_main_world,
500 wrapper_type_info, 500 wrapper_type_info,
501 access_control, 501 access_control,
502 property_attribute, 502 property_attribute,
503 only_exposed_to_private_script, 503 only_exposed_to_private_script,
504 property_location(attribute), 504 property_location(attribute),
505 holder_check, 505 holder_check,
506 ] %} 506 ] %}
507 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}} 507 {{'{'}}{{attribute_configuration_list | join(', ')}}{{'}'}}
508 {%- endmacro %} 508 {%- endmacro %}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698