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

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

Issue 1913093003: [DevTools] Remove reference to DebuggerAgent from ConsoleAgent (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/V8Console.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
index 5bef049ec572961a4bbda49b3c20212301159271..9e5084222a521cafa7671c00a796f24bf161f152 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8Console.cpp
@@ -6,6 +6,7 @@
#include "platform/inspector_protocol/String16.h"
#include "platform/v8_inspector/InspectedContext.h"
+#include "platform/v8_inspector/V8DebuggerAgentImpl.h"
#include "platform/v8_inspector/V8DebuggerImpl.h"
#include "platform/v8_inspector/V8InspectorSessionImpl.h"
#include "platform/v8_inspector/V8ProfilerAgentImpl.h"
@@ -172,12 +173,19 @@ public:
V8ProfilerAgentImpl* profilerAgent()
{
- InspectedContext* inspectedContext = ensureInspectedContext();
- if (!inspectedContext)
- return nullptr;
- V8InspectorSessionImpl* session = inspectedContext->debugger()->sessionForContextGroup(inspectedContext->contextGroupId());
- if (session && session->profilerAgentImpl()->enabled())
- return session->profilerAgentImpl();
+ if (V8InspectorSessionImpl* session = currentSession()) {
+ if (session && session->profilerAgentImpl()->enabled())
+ return session->profilerAgentImpl();
+ }
+ return nullptr;
+ }
+
+ V8DebuggerAgentImpl* debuggerAgent()
+ {
+ if (V8InspectorSessionImpl* session = currentSession()) {
+ if (session && session->debuggerAgentImpl()->enabled())
+ return session->debuggerAgentImpl();
+ }
return nullptr;
}
private:
@@ -204,6 +212,14 @@ private:
return defaultValue;
return false;
}
+
+ V8InspectorSessionImpl* currentSession()
+ {
+ InspectedContext* inspectedContext = ensureInspectedContext();
+ if (!inspectedContext)
+ return nullptr;
+ return inspectedContext->debugger()->sessionForContextGroup(inspectedContext->contextGroupId());
+ }
};
v8::MaybeLocal<v8::Object> createObjectWithClassName(V8DebuggerImpl* debugger, v8::Local<v8::Context> context, const char* className)
@@ -328,6 +344,8 @@ void V8Console::assertCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
if (helper.firstArgToBoolean(false))
return;
helper.addMessage(AssertMessageType, ErrorMessageLevel, true, 1);
+ if (V8DebuggerAgentImpl* debuggerAgent = helper.debuggerAgent())
+ debuggerAgent->breakProgramOnException(protocol::Debugger::Paused::ReasonEnum::Assert, nullptr);
}
void V8Console::markTimelineCallback(const v8::FunctionCallbackInfo<v8::Value>& info)

Powered by Google App Engine
This is Rietveld 408576698