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

Unified Diff: third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl

Issue 2571063002: Remove Blink-in-JS (Closed)
Patch Set: Created 4 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/methods.cpp.tmpl
diff --git a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
index 31b83ab1e466ab30ec32c0e3f60299cf421a8164..d930496a3cb21a87476e1aa10eb3e9c9a3bd70ce 100644
--- a/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
+++ b/third_party/WebKit/Source/bindings/templates/methods.cpp.tmpl
@@ -258,10 +258,6 @@ Document& document = *toDocument(currentExecutionContext(info.GetIsolate()));
{# Call #}
{% if method.idl_type == 'void' %}
{{cpp_value}};
-{% elif method.is_implemented_in_private_script %}
-{{method.cpp_type}} result{{method.cpp_type_initializer}};
-if (!{{method.cpp_value}})
- return;
{% elif method.use_output_parameter_for_result %}
{{method.cpp_type}} result;
{{cpp_value}};
@@ -353,10 +349,10 @@ static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
{% set fall_through_to_partial_overloads = not is_partial and overloads.has_partial_overloads %}
{% if overloads.measure_all_as %}
- UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}});
+ UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{overloads.measure_all_as}});
{% endif %}
{% if overloads.deprecate_all_as %}
- Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}});
+ Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseCounter::{{overloads.deprecate_all_as}});
{% endif %}
{# First resolve by length #}
@@ -376,10 +372,10 @@ static void {{overloads.name}}Method{{world_suffix}}(const v8::FunctionCallbackI
method.runtime_enabled_function) %}
if ({{test}}) {
{% if method.measure_as and not overloads.measure_all_as %}
- UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
+ UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
{% endif %}
{% if method.deprecate_as and not overloads.deprecate_all_as %}
- Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
+ Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
{% endif %}
{{method.name}}{{method.overload_index}}Method{{world_suffix}}(info);
return;
@@ -491,10 +487,10 @@ static void postMessageImpl(const char* interfaceName, {{cpp_class}}* instance,
void {{method.name}}MethodCallback{{world_suffix}}(const v8::FunctionCallbackInfo<v8::Value>& info) {
{% if not method.overloads %}{# Overloaded methods are measured in overload_resolution_method() #}
{% if method.measure_as %}
- UseCounter::countIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
+ UseCounter::count(currentExecutionContext(info.GetIsolate()), UseCounter::{{method.measure_as('Method')}});
{% endif %}
{% if method.deprecate_as %}
- Deprecation::countDeprecationIfNotPrivateScript(info.GetIsolate(), currentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
+ Deprecation::countDeprecation(currentExecutionContext(info.GetIsolate()), UseCounter::{{method.deprecate_as}});
{% endif %}
{% endif %}{# not method.overloads #}
{% if world_suffix in method.activity_logging_world_list %}
@@ -558,45 +554,6 @@ void {{method.name}}OriginSafeMethodGetterCallback{{world_suffix}}(v8::Local<v8:
{##############################################################################}
-{% macro method_implemented_in_private_script(method) %}
-bool {{v8_class}}::PrivateScript::{{method.name}}Method({{method.argument_declarations_for_private_script | join(', ')}}) {
- if (!frame)
- return false;
- v8::HandleScope handleScope(toIsolate(frame));
- ScriptForbiddenScope::AllowUserAgentScript script;
- ScriptState* scriptState = ScriptState::forWorld(frame, DOMWrapperWorld::privateScriptIsolatedWorld());
- if (!scriptState)
- return false;
- ScriptState* scriptStateInUserScript = ScriptState::forMainWorld(frame);
- if (!scriptStateInUserScript)
- return false;
-
- ScriptState::Scope scope(scriptState);
- v8::Local<v8::Value> holder = toV8(holderImpl, scriptState->context()->Global(), scriptState->isolate());
- {% for argument in method.arguments %}
- v8::Local<v8::Value> {{argument.handle}} = {{argument.private_script_cpp_value_to_v8_value}};
- {% endfor %}
- {% if method.arguments %}
- v8::Local<v8::Value> argv[] = { {{method.arguments | join(', ', 'handle')}} };
- {% else %}
- {# Empty array initializers are illegal, and don\t compile in MSVC. #}
- v8::Local<v8::Value> *argv = 0;
- {% endif %}
- ExceptionState exceptionState(scriptState->isolate(), ExceptionState::ExecutionContext, "{{cpp_class}}", "{{method.name}}");
- v8::Local<v8::Value> v8Value = PrivateScriptRunner::runDOMMethod(scriptState, scriptStateInUserScript, "{{cpp_class}}", "{{method.name}}", holder, {{method.arguments | length}}, argv);
- if (v8Value.IsEmpty())
- return false;
- {% if method.idl_type != 'void' %}
- {{v8_value_to_local_cpp_value(method.private_script_v8_value_to_local_cpp_value) | indent(2)}}
- *result = cppValue;
- {% endif %}
- CHECK(!exceptionState.hadException());
- return true;
-}
-{% endmacro %}
-
-
-{##############################################################################}
{% macro generate_constructor(constructor) %}
{% set name = '%sConstructorCallback' % v8_class
if constructor.is_named_constructor else
@@ -650,10 +607,9 @@ v8SetReturnValue(info, wrapper);
{% set property_attribute =
'static_cast<v8::PropertyAttribute>(%s)' % ' | '.join(method.property_attributes)
if method.property_attributes else 'v8::None' %}
-{% set only_exposed_to_private_script = 'V8DOMConfiguration::OnlyExposedToPrivateScript' if method.only_exposed_to_private_script else 'V8DOMConfiguration::ExposedToAllScripts' %}
{% set holder_check = 'V8DOMConfiguration::DoNotCheckHolder'
if method.returns_promise else 'V8DOMConfiguration::CheckHolder' %}
-{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{property_attribute}}, {{only_exposed_to_private_script}}, {{property_location(method)}}, {{holder_check}}}
+{"{{method.name}}", {{method_callback}}, {{method_callback_for_main_world}}, {{method.length}}, {{property_attribute}}, {{property_location(method)}}, {{holder_check}}}
{%- endmacro %}

Powered by Google App Engine
This is Rietveld 408576698