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

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

Issue 1648463002: DevTools: migrate injectedscript from ScriptValue to v8::Global. (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/InjectedScriptManager.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp b/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp
index aadc8d4e09f8a9d0a5caf027fef6de9c39fa9e54..edd4f85dc79299ff58e1f7510eb067cafc7eba4a 100644
--- a/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp
+++ b/third_party/WebKit/Source/core/inspector/InjectedScriptManager.cpp
@@ -30,7 +30,6 @@
#include "core/inspector/InjectedScriptManager.h"
-#include "bindings/core/v8/ScriptValue.h"
#include "core/inspector/InjectedScript.h"
#include "core/inspector/InjectedScriptHost.h"
#include "core/inspector/InjectedScriptNative.h"
@@ -91,10 +90,15 @@ void InjectedScriptManager::discardInjectedScripts()
int InjectedScriptManager::discardInjectedScriptFor(v8::Local<v8::Context> context)
{
int contextId = V8Debugger::contextId(context);
- m_idToInjectedScript.remove(contextId);
+ discardInjectedScript(contextId);
return contextId;
}
+void InjectedScriptManager::discardInjectedScript(int contextId)
+{
+ m_idToInjectedScript.remove(contextId);
+}
+
void InjectedScriptManager::releaseObjectGroup(const String& objectGroup)
{
Vector<int> keys;
@@ -130,12 +134,13 @@ InjectedScript* InjectedScriptManager::injectedScriptFor(v8::Local<v8::Context>
if (it != m_idToInjectedScript.end())
return it->value.get();
- if (!m_client->callingContextCanAccessContext(context))
+ v8::Local<v8::Context> callingContext = context->GetIsolate()->GetCallingContext();
+ if (!callingContext.IsEmpty() && !m_client->callingContextCanAccessContext(callingContext, context))
return nullptr;
RefPtr<InjectedScriptNative> injectedScriptNative = adoptRef(new InjectedScriptNative(context->GetIsolate()));
- v8::Local<v8::Object> injectedScriptValue = createInjectedScript(injectedScriptSource(), context, contextId, injectedScriptNative.get());
- OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(injectedScriptValue, m_client, injectedScriptNative.release(), contextId));
+ v8::Local<v8::Object> object = createInjectedScript(injectedScriptSource(), context, contextId, injectedScriptNative.get());
+ OwnPtr<InjectedScript> result = adoptPtr(new InjectedScript(this, context, object, m_client, injectedScriptNative.release(), contextId));
InjectedScript* resultPtr = result.get();
if (m_customObjectFormatterEnabled)
result->setCustomObjectFormatterEnabled(m_customObjectFormatterEnabled);

Powered by Google App Engine
This is Rietveld 408576698