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

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

Issue 1859293002: [DevTools] Move Console to v8_inspector (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added missing tests 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/V8DebuggerImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
index 53f471674c78bdea0d03b675e2ceaa13dbb4aabe..ea3e18e8518d633c010ab95eb55196859dbe0fe4 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8DebuggerImpl.cpp
@@ -35,8 +35,10 @@
#include "platform/v8_inspector/DebuggerScript.h"
#include "platform/v8_inspector/InspectedContext.h"
#include "platform/v8_inspector/ScriptBreakpoint.h"
+#include "platform/v8_inspector/V8Console.h"
#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
+#include "platform/v8_inspector/V8ProfilerAgentImpl.h"
#include "platform/v8_inspector/V8RuntimeAgentImpl.h"
#include "platform/v8_inspector/V8StackTraceImpl.h"
#include "platform/v8_inspector/V8StringUtil.h"
@@ -151,6 +153,17 @@ void V8DebuggerImpl::debuggerAgentDisabled()
disable();
}
+V8ProfilerAgentImpl* V8DebuggerImpl::findEnabledProfilerAgent(v8::Local<v8::Context> context)
+{
+ int contextGroupId = getGroupId(context);
+ if (!contextGroupId)
+ return nullptr;
+ V8InspectorSessionImpl* session = m_sessions.get(contextGroupId);
+ if (session && session->profileAgentImpl()->enabled())
+ return session->profileAgentImpl();
+ return nullptr;
+}
+
V8DebuggerAgentImpl* V8DebuggerImpl::findEnabledDebuggerAgent(int contextGroupId)
{
if (!contextGroupId)
@@ -766,6 +779,8 @@ void V8DebuggerImpl::contextCreated(const V8ContextInfo& info)
v8::Context::Scope contextScope(info.context);
info.context->SetEmbedderData(static_cast<int>(v8::Context::kDebugIdIndex), toV8String(m_isolate, debugData));
+ installConsole(info.context, info.hasMemoryOnConsole);
dgozman 2016/04/12 03:32:16 Let's move this to InspectedContext constructor.
kozy 2016/04/12 21:58:32 Done.
+
if (!m_contexts.contains(info.contextGroupId))
m_contexts.set(info.contextGroupId, adoptPtr(new ContextByIdMap()));
ASSERT(!m_contexts.get(info.contextGroupId)->contains(contextId));
@@ -778,6 +793,16 @@ void V8DebuggerImpl::contextCreated(const V8ContextInfo& info)
session->runtimeAgentImpl()->reportExecutionContextCreated(inspectedContext);
}
+bool V8DebuggerImpl::installConsole(v8::Local<v8::Context> context, bool hasMemoryAttribute)
+{
+ v8::Isolate* isolate = context->GetIsolate();
+ v8::Local<v8::Object> global = context->Global();
+ v8::Local<v8::Object> console;
+ if (!V8Console::create(context, this, hasMemoryAttribute).ToLocal(&console))
+ return false;
+ return global->Set(context, toV8StringInternalized(isolate, "console"), console).FromMaybe(false);
+}
+
void V8DebuggerImpl::contextDestroyed(v8::Local<v8::Context> context)
{
int contextId = V8Debugger::contextId(context);

Powered by Google App Engine
This is Rietveld 408576698