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

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

Issue 2700293002: DevTools: do not use RAII for sync native breakpoints, reuse AsyncTask where possible. (Closed)
Patch Set: same with unused assert removed - assert is trivial Created 3 years, 10 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/InspectorInstrumentation.cpp
diff --git a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
index 0470465885e7bcc1f852704e38b9e6d693616371..079454d631ee6b650840186877c45e3752be9732 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
@@ -57,21 +57,25 @@ AsyncTask::AsyncTask(ExecutionContext* context, void* task)
AsyncTask::AsyncTask(ExecutionContext* context, void* task, bool enabled)
: m_debugger(enabled ? ThreadDebugger::from(toIsolate(context)) : nullptr),
- m_task(task) {
+ m_task(task),
+ m_breakpoint(nullptr, nullptr) {
if (m_debugger)
m_debugger->asyncTaskStarted(m_task);
}
-AsyncTask::~AsyncTask() {
+AsyncTask::AsyncTask(ExecutionContext* context,
+ void* task,
+ const char* breakpointName)
+ : m_debugger(ThreadDebugger::from(toIsolate(context))),
+ m_task(task),
+ m_breakpoint(context, breakpointName) {
if (m_debugger)
- m_debugger->asyncTaskFinished(m_task);
+ m_debugger->asyncTaskStarted(m_task);
}
-void asyncTaskScheduled(ExecutionContext* context,
- const String& name,
- void* task) {
- if (ThreadDebugger* debugger = ThreadDebugger::from(toIsolate(context)))
- debugger->asyncTaskScheduled(name, task, false);
+AsyncTask::~AsyncTask() {
+ if (m_debugger)
+ m_debugger->asyncTaskFinished(m_task);
}
void asyncTaskScheduled(ExecutionContext* context,
@@ -82,32 +86,56 @@ void asyncTaskScheduled(ExecutionContext* context,
debugger->asyncTaskScheduled(name, task, recurring);
}
+void asyncTaskScheduledBreakable(ExecutionContext* context,
+ const char* name,
+ void* task,
+ bool recurring) {
+ asyncTaskScheduled(context, name, task, recurring);
+ breakIfNeeded(context, name);
+}
+
void asyncTaskCanceled(ExecutionContext* context, void* task) {
if (ThreadDebugger* debugger = ThreadDebugger::from(toIsolate(context)))
debugger->asyncTaskCanceled(task);
}
+void asyncTaskCanceledBreakable(ExecutionContext* context,
+ const char* name,
+ void* task) {
+ asyncTaskCanceled(context, task);
+ breakIfNeeded(context, name);
+}
+
void allAsyncTasksCanceled(ExecutionContext* context) {
if (ThreadDebugger* debugger = ThreadDebugger::from(toIsolate(context)))
debugger->allAsyncTasksCanceled();
}
-NativeBreakpoint::NativeBreakpoint(ExecutionContext* context,
- const char* name,
- bool sync)
- : m_instrumentingAgents(instrumentingAgentsFor(context)), m_sync(sync) {
+void breakIfNeeded(ExecutionContext* context, const char* name) {
+ InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(context);
+ if (!instrumentingAgents ||
+ !instrumentingAgents->hasInspectorDOMDebuggerAgents())
+ return;
+ for (InspectorDOMDebuggerAgent* domDebuggerAgent :
+ instrumentingAgents->inspectorDOMDebuggerAgents()) {
+ domDebuggerAgent->allowNativeBreakpoint(name, nullptr, true);
+ }
+}
+
+NativeBreakpoint::NativeBreakpoint(ExecutionContext* context, const char* name)
+ : m_instrumentingAgents(instrumentingAgentsFor(context)) {
if (!m_instrumentingAgents ||
!m_instrumentingAgents->hasInspectorDOMDebuggerAgents())
return;
for (InspectorDOMDebuggerAgent* domDebuggerAgent :
m_instrumentingAgents->inspectorDOMDebuggerAgents())
- domDebuggerAgent->allowNativeBreakpoint(name, nullptr, m_sync);
+ domDebuggerAgent->allowNativeBreakpoint(name, nullptr, false);
}
NativeBreakpoint::NativeBreakpoint(ExecutionContext* context,
EventTarget* eventTarget,
Event* event)
- : m_instrumentingAgents(instrumentingAgentsFor(context)), m_sync(false) {
+ : m_instrumentingAgents(instrumentingAgentsFor(context)) {
if (!m_instrumentingAgents ||
!m_instrumentingAgents->hasInspectorDOMDebuggerAgents())
return;
@@ -115,11 +143,11 @@ NativeBreakpoint::NativeBreakpoint(ExecutionContext* context,
String targetName = node ? node->nodeName() : eventTarget->interfaceName();
for (InspectorDOMDebuggerAgent* domDebuggerAgent :
m_instrumentingAgents->inspectorDOMDebuggerAgents())
- domDebuggerAgent->allowNativeBreakpoint(event->type(), &targetName, m_sync);
+ domDebuggerAgent->allowNativeBreakpoint(event->type(), &targetName, false);
}
NativeBreakpoint::~NativeBreakpoint() {
- if (m_sync || !m_instrumentingAgents ||
+ if (!m_instrumentingAgents ||
!m_instrumentingAgents->hasInspectorDOMDebuggerAgents())
return;
for (InspectorDOMDebuggerAgent* domDebuggerAgent :
@@ -127,10 +155,6 @@ NativeBreakpoint::~NativeBreakpoint() {
domDebuggerAgent->cancelNativeBreakpoint();
}
-bool isDebuggerPaused(LocalFrame*) {
- return MainThreadDebugger::instance()->isPaused();
-}
-
void didReceiveResourceResponseButCanceled(LocalFrame* frame,
DocumentLoader* loader,
unsigned long identifier,

Powered by Google App Engine
This is Rietveld 408576698