Commit 1a65bf19 authored by haraken@chromium.org's avatar haraken@chromium.org

Remove more ScriptState::current in core/

ScriptState::current should be called in the binding layer.

BUG=357144
NOTRY=true

Review URL: https://codereview.chromium.org/303103002

git-svn-id: svn://svn.chromium.org/blink/trunk@175146 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 3660336b
...@@ -238,7 +238,7 @@ ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ...@@ -238,7 +238,7 @@ ScriptState* scriptState = ScriptState::current(info.GetIsolate());
ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate()); ExecutionContext* scriptContext = currentExecutionContext(info.GetIsolate());
{% endif %} {% endif %}
{% if method.is_call_with_script_arguments %} {% if method.is_call_with_script_arguments %}
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(info, {{method.number_of_arguments}})); RefPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, {{method.number_of_arguments}}));
{% endif %} {% endif %}
{# Call #} {# Call #}
{% if method.idl_type == 'void' %} {% if method.idl_type == 'void' %}
......
...@@ -7714,7 +7714,7 @@ static void callWithScriptStateScriptArgumentsVoidMethodMethod(const v8::Functio ...@@ -7714,7 +7714,7 @@ static void callWithScriptStateScriptArgumentsVoidMethodMethod(const v8::Functio
{ {
TestObject* impl = V8TestObject::toNative(info.Holder()); TestObject* impl = V8TestObject::toNative(info.Holder());
ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ScriptState* scriptState = ScriptState::current(info.GetIsolate());
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(info, 0)); RefPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, 0));
impl->callWithScriptStateScriptArgumentsVoidMethod(scriptState, scriptArguments.release()); impl->callWithScriptStateScriptArgumentsVoidMethod(scriptState, scriptArguments.release());
} }
...@@ -7734,14 +7734,14 @@ static void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArgMethod ...@@ -7734,14 +7734,14 @@ static void callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArgMethod
V8RethrowTryCatchScope rethrow(block); V8RethrowTryCatchScope rethrow(block);
if (UNLIKELY(info.Length() <= 0)) { if (UNLIKELY(info.Length() <= 0)) {
ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ScriptState* scriptState = ScriptState::current(info.GetIsolate());
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(info, 1)); RefPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, 1));
impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release()); impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release());
return; return;
} }
TONATIVE_VOID_INTERNAL(optionalBooleanArg, info[0]->BooleanValue()); TONATIVE_VOID_INTERNAL(optionalBooleanArg, info[0]->BooleanValue());
} }
ScriptState* scriptState = ScriptState::current(info.GetIsolate()); ScriptState* scriptState = ScriptState::current(info.GetIsolate());
RefPtr<ScriptArguments> scriptArguments(createScriptArguments(info, 1)); RefPtr<ScriptArguments> scriptArguments(createScriptArguments(scriptState, info, 1));
impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release(), optionalBooleanArg); impl->callWithScriptStateScriptArgumentsVoidMethodOptionalBooleanArg(scriptState, scriptArguments.release(), optionalBooleanArg);
} }
......
...@@ -118,12 +118,8 @@ PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(ScriptState* scriptS ...@@ -118,12 +118,8 @@ PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(ScriptState* scriptS
return createScriptCallStack(stackSize); return createScriptCallStack(stackSize);
} }
PassRefPtr<ScriptArguments> createScriptArguments(const v8::FunctionCallbackInfo<v8::Value>& v8arguments, unsigned skipArgumentCount) PassRefPtr<ScriptArguments> createScriptArguments(ScriptState* scriptState, const v8::FunctionCallbackInfo<v8::Value>& v8arguments, unsigned skipArgumentCount)
{ {
v8::Isolate* isolate = v8arguments.GetIsolate();
v8::HandleScope scope(isolate);
ScriptState* scriptState = ScriptState::current(isolate);
Vector<ScriptValue> arguments; Vector<ScriptValue> arguments;
for (int i = skipArgumentCount; i < v8arguments.Length(); ++i) for (int i = skipArgumentCount; i < v8arguments.Length(); ++i)
arguments.append(ScriptValue(scriptState, v8arguments[i])); arguments.append(ScriptValue(scriptState, v8arguments[i]));
......
...@@ -51,7 +51,7 @@ const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::Stac ...@@ -51,7 +51,7 @@ const v8::StackTrace::StackTraceOptions stackTraceOptions = static_cast<v8::Stac
PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace>, size_t maxStackSize, v8::Isolate*); PassRefPtr<ScriptCallStack> createScriptCallStack(v8::Handle<v8::StackTrace>, size_t maxStackSize, v8::Isolate*);
PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed = false); PassRefPtr<ScriptCallStack> createScriptCallStack(size_t maxStackSize, bool emptyStackIsAllowed = false);
PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(ScriptState*, size_t maxStackSize = ScriptCallStack::maxCallStackSizeToCapture); PassRefPtr<ScriptCallStack> createScriptCallStackForConsole(ScriptState*, size_t maxStackSize = ScriptCallStack::maxCallStackSizeToCapture);
PassRefPtr<ScriptArguments> createScriptArguments(const v8::FunctionCallbackInfo<v8::Value>& v8arguments, unsigned skipArgumentCount); PassRefPtr<ScriptArguments> createScriptArguments(ScriptState*, const v8::FunctionCallbackInfo<v8::Value>& v8arguments, unsigned skipArgumentCount);
} // namespace WebCore } // namespace WebCore
......
...@@ -167,7 +167,7 @@ v8::Handle<v8::Object> JavaScriptCallFrame::innerCallFrame() ...@@ -167,7 +167,7 @@ v8::Handle<v8::Object> JavaScriptCallFrame::innerCallFrame()
return m_callFrame.newLocal(m_isolate); return m_callFrame.newLocal(m_isolate);
} }
ScriptValue JavaScriptCallFrame::setVariableValue(int scopeNumber, const String& variableName, const ScriptValue& newValue) ScriptValue JavaScriptCallFrame::setVariableValue(ScriptState* scriptState, int scopeNumber, const String& variableName, const ScriptValue& newValue)
{ {
v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate); v8::Handle<v8::Object> callFrame = m_callFrame.newLocal(m_isolate);
v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue"))); v8::Handle<v8::Function> setVariableValueFunction = v8::Handle<v8::Function>::Cast(callFrame->Get(v8AtomicString(m_isolate, "setVariableValue")));
...@@ -176,7 +176,7 @@ ScriptValue JavaScriptCallFrame::setVariableValue(int scopeNumber, const String& ...@@ -176,7 +176,7 @@ ScriptValue JavaScriptCallFrame::setVariableValue(int scopeNumber, const String&
v8String(m_isolate, variableName), v8String(m_isolate, variableName),
newValue.v8Value() newValue.v8Value()
}; };
return ScriptValue(ScriptState::current(m_isolate), setVariableValueFunction->Call(callFrame, WTF_ARRAY_LENGTH(argv), argv)); return ScriptValue(scriptState, setVariableValueFunction->Call(callFrame, WTF_ARRAY_LENGTH(argv), argv));
} }
} // namespace WebCore } // namespace WebCore
...@@ -33,6 +33,7 @@ ...@@ -33,6 +33,7 @@
#include "bindings/v8/ScopedPersistent.h" #include "bindings/v8/ScopedPersistent.h"
#include "bindings/v8/ScriptState.h"
#include "bindings/v8/ScriptWrappable.h" #include "bindings/v8/ScriptWrappable.h"
#include <v8-debug.h> #include <v8-debug.h>
#include "wtf/RefCounted.h" #include "wtf/RefCounted.h"
...@@ -66,7 +67,7 @@ public: ...@@ -66,7 +67,7 @@ public:
v8::Handle<v8::Value> evaluate(const String& expression); v8::Handle<v8::Value> evaluate(const String& expression);
v8::Handle<v8::Value> restart(); v8::Handle<v8::Value> restart();
ScriptValue setVariableValue(int scopeNumber, const String& variableName, const ScriptValue& newValue); ScriptValue setVariableValue(ScriptState*, int scopeNumber, const String& variableName, const ScriptValue& newValue);
v8::Handle<v8::Object> innerCallFrame(); v8::Handle<v8::Object> innerCallFrame();
private: private:
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
[Custom] any restart(); [Custom] any restart();
// Only declarative scope (local, with and catch) is accepted. Returns undefined. // Only declarative scope (local, with and catch) is accepted. Returns undefined.
any setVariableValue([Default=Undefined] optional long scopeIndex, [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString variableName, [Default=Undefined] optional any newValue); [CallWith=ScriptState] any setVariableValue([Default=Undefined] optional long scopeIndex, [TreatNullAs=NullString, TreatUndefinedAs=NullString, Default=Undefined] optional DOMString variableName, [Default=Undefined] optional any newValue);
readonly attribute JavaScriptCallFrame caller; readonly attribute JavaScriptCallFrame caller;
readonly attribute long sourceID; readonly attribute long sourceID;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment