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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InspectedContext.cpp

Issue 1859293002: [DevTools] Move Console to v8_inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/platform/v8_inspector/InspectedContext.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InspectedContext.cpp b/third_party/WebKit/Source/platform/v8_inspector/InspectedContext.cpp
index fb9e4c5161c082a0427aaa6becc1c4f473b4fb6e..512b168dc39099e666ed43fd0ab8ade2c1db2bfc 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InspectedContext.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InspectedContext.cpp
@@ -5,7 +5,9 @@
#include "platform/v8_inspector/InspectedContext.h"
#include "platform/v8_inspector/InjectedScript.h"
+#include "platform/v8_inspector/V8Console.h"
#include "platform/v8_inspector/V8DebuggerImpl.h"
+#include "platform/v8_inspector/V8StringUtil.h"
#include "platform/v8_inspector/public/V8ContextInfo.h"
#include "platform/v8_inspector/public/V8DebuggerClient.h"
@@ -16,7 +18,7 @@ void InspectedContext::weakCallback(const v8::WeakCallbackInfo<InspectedContext>
data.GetParameter()->m_debugger->discardInspectedContext(data.GetParameter()->m_contextGroupId, data.GetParameter()->m_contextId);
}
-InspectedContext::InspectedContext(V8DebuggerImpl* debugger, const V8ContextInfo& info, int contextId)
+InspectedContext::InspectedContext(V8DebuggerImpl* debugger, const V8ContextInfo& info, int contextId, bool hasMemoryAttribute)
: m_debugger(debugger)
, m_context(info.context->GetIsolate(), info.context)
, m_contextId(contextId)
@@ -28,6 +30,14 @@ InspectedContext::InspectedContext(V8DebuggerImpl* debugger, const V8ContextInfo
, m_reported(false)
{
m_context.SetWeak(this, &InspectedContext::weakCallback, v8::WeakCallbackType::kParameter);
+
+ v8::Isolate* isolate = m_debugger->isolate();
+ v8::Local<v8::Object> global = info.context->Global();
+ v8::Local<v8::Object> console;
+ if (!V8Console::create(info.context, this, hasMemoryAttribute).ToLocal(&console))
+ return;
+ if (!global->Set(info.context, toV8StringInternalized(isolate, "console"), console).FromMaybe(false))
+ return;
}
InspectedContext::~InspectedContext()

Powered by Google App Engine
This is Rietveld 408576698