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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp

Issue 1636223002: DevTools: remove ScriptState/Value from the InjectedScript APIs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments addressed Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InjectedScript.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp b/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp
index e1d8f2c66cc206d682619ad6e70997b8d783c280..31a6795fb46b9387cfb17264eef5a084e70471e6 100644
--- a/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/custom/V8InjectedScriptManager.cpp
@@ -40,10 +40,10 @@
namespace blink {
-ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSource, ScriptState* inspectedScriptState, int id, InjectedScriptNative* injectedScriptNative)
+v8::Local<v8::Object> InjectedScriptManager::createInjectedScript(const String& scriptSource, v8::Local<v8::Context> context, int id, InjectedScriptNative* injectedScriptNative)
{
- v8::Isolate* isolate = inspectedScriptState->isolate();
- ScriptState::Scope scope(inspectedScriptState);
+ v8::Isolate* isolate = context->GetIsolate();
+ v8::Context::Scope scope(context);
v8::Local<v8::FunctionTemplate> wrapperTemplate = m_injectedScriptHost->wrapperTemplate(isolate);
if (wrapperTemplate.IsEmpty()) {
@@ -51,9 +51,9 @@ ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour
m_injectedScriptHost->setWrapperTemplate(wrapperTemplate, isolate);
}
- v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::wrap(wrapperTemplate, inspectedScriptState->context(), m_injectedScriptHost);
+ v8::Local<v8::Object> scriptHostWrapper = V8InjectedScriptHost::wrap(wrapperTemplate, context, m_injectedScriptHost);
if (scriptHostWrapper.IsEmpty())
- return ScriptValue();
+ return v8::Local<v8::Object>();
injectedScriptNative->setOnInjectedScriptHost(scriptHostWrapper);
@@ -64,15 +64,17 @@ ScriptValue InjectedScriptManager::createInjectedScript(const String& scriptSour
// to create and configure InjectedScript instance that is going to be used by the inspector.
v8::Local<v8::Value> value;
if (!V8ScriptRunner::compileAndRunInternalScript(v8String(isolate, scriptSource), isolate).ToLocal(&value))
- return ScriptValue();
+ return v8::Local<v8::Object>();
ASSERT(value->IsFunction());
- v8::Local<v8::Object> windowGlobal = inspectedScriptState->context()->Global();
- v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number::New(inspectedScriptState->isolate(), id) };
+ v8::Local<v8::Object> windowGlobal = context->Global();
+ v8::Local<v8::Value> info[] = { scriptHostWrapper, windowGlobal, v8::Number::New(context->GetIsolate(), id) };
v8::Local<v8::Value> injectedScriptValue;
- if (!V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(value), windowGlobal, WTF_ARRAY_LENGTH(info), info, inspectedScriptState->isolate()).ToLocal(&injectedScriptValue))
- return ScriptValue();
- return ScriptValue(inspectedScriptState, injectedScriptValue);
+ if (!V8ScriptRunner::callInternalFunction(v8::Local<v8::Function>::Cast(value), windowGlobal, WTF_ARRAY_LENGTH(info), info, context->GetIsolate()).ToLocal(&injectedScriptValue))
+ return v8::Local<v8::Object>();
+ if (!injectedScriptValue->IsObject())
+ return v8::Local<v8::Object>();
+ return injectedScriptValue.As<v8::Object>();
}
} // namespace blink
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/InjectedScript.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698