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

Unified Diff: third_party/WebKit/Source/core/inspector/InjectedScriptNative.cpp

Issue 1641933002: DevTools: remove V8ScriptRunner use from InjectedScript*. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
Index: third_party/WebKit/Source/core/inspector/InjectedScriptNative.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InjectedScriptNative.cpp b/third_party/WebKit/Source/core/inspector/InjectedScriptNative.cpp
index a4f6c6c98ebd520c236b262196e6e8ce43a2c212..b74dbbda1ae5fe56d2b6d5a27b5c3e107e23b5b5 100644
--- a/third_party/WebKit/Source/core/inspector/InjectedScriptNative.cpp
+++ b/third_party/WebKit/Source/core/inspector/InjectedScriptNative.cpp
@@ -4,8 +4,6 @@
#include "core/inspector/InjectedScriptNative.h"
-#include "bindings/core/v8/ScriptState.h"
-#include "bindings/core/v8/V8HiddenValue.h"
#include "platform/JSONValues.h"
#include "wtf/Vector.h"
#include "wtf/text/WTFString.h"
@@ -19,21 +17,26 @@ InjectedScriptNative::InjectedScriptNative(v8::Isolate* isolate)
{
}
+static const char privateKeyName[] = "v8-inspector#injectedScript";
dgozman 2016/01/28 00:21:48 Either name it more specificly or put into anonymo
pfeldman 2016/01/28 00:29:42 Why?
+
InjectedScriptNative::~InjectedScriptNative() { }
void InjectedScriptNative::setOnInjectedScriptHost(v8::Local<v8::Object> injectedScriptHost)
{
v8::HandleScope handleScope(m_isolate);
v8::Local<v8::External> external = v8::External::New(m_isolate, this);
- V8HiddenValue::setHiddenValue(ScriptState::current(m_isolate), injectedScriptHost, V8HiddenValue::injectedScriptNative(m_isolate), external);
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(m_isolate, v8::String::NewFromUtf8(m_isolate, privateKeyName));
+ injectedScriptHost->SetPrivate(m_isolate->GetCurrentContext(), privateKey, external);
dgozman 2016/01/28 00:21:48 Let's pass context explicitly?
pfeldman 2016/01/28 00:29:42 Did not do that on purpose - the fetch goes over t
}
InjectedScriptNative* InjectedScriptNative::fromInjectedScriptHost(v8::Local<v8::Object> injectedScriptObject)
{
v8::Isolate* isolate = injectedScriptObject->GetIsolate();
v8::HandleScope handleScope(isolate);
- v8::Local<v8::Value> value = V8HiddenValue::getHiddenValue(ScriptState::current(isolate), injectedScriptObject, V8HiddenValue::injectedScriptNative(isolate));
- ASSERT(!value.IsEmpty());
+ v8::Local<v8::Context> context = isolate->GetCurrentContext();
+ v8::Local<v8::Private> privateKey = v8::Private::ForApi(isolate, v8::String::NewFromUtf8(isolate, privateKeyName));
+ v8::Local<v8::Value> value;
+ RELEASE_ASSERT(injectedScriptObject->GetPrivate(context, privateKey).ToLocal(&value));
v8::Local<v8::External> external = value.As<v8::External>();
void* ptr = external->Value();
ASSERT(ptr);

Powered by Google App Engine
This is Rietveld 408576698