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

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

Issue 2746333002: DevTools: move recurring flag into AsyncTask, control cancelation from embedder only. (Closed)
Patch Set: Created 3 years, 9 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 cb3d3139124b93b4dc15f7ae6ac3dbbd43f8054e..15a5064f513234baf5b744f63ea549716d555d54 100644
--- a/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
+++ b/third_party/WebKit/Source/core/inspector/InspectorInstrumentation.cpp
@@ -71,37 +71,42 @@ double ProbeBase::duration() const {
return captureEndTime() - m_startTime;
}
-AsyncTask::AsyncTask(ExecutionContext* context, void* task)
- : AsyncTask(context, task, true) {}
-
-AsyncTask::AsyncTask(ExecutionContext* context, void* task, bool enabled)
- : m_debugger(enabled ? ThreadDebugger::from(toIsolate(context)) : nullptr),
- m_task(task) {
- TRACE_EVENT_FLOW_END0("devtools.timeline.async", "AsyncTask", task);
+AsyncTask::AsyncTask(ExecutionContext* context, void* task, const char* step)
+ : m_debugger(ThreadDebugger::from(toIsolate(context))),
+ m_task(task),
+ m_recurring(!!step) {
alph 2017/03/14 00:39:37 drop !!
pfeldman 2017/03/14 01:15:10 Done.
+ TRACE_EVENT_FLOW_STEP0("devtools.timeline.async", "AsyncTask", task,
alph 2017/03/14 00:39:37 Should it be FLOW_END for non-recurring tasks?
pfeldman 2017/03/14 01:15:10 Nope, that is fine as it is.
+ step ? step : "");
alph 2017/03/14 00:39:37 Where the step name is going to be used?
pfeldman 2017/03/14 01:15:10 I can surface it in the timeline UI, but it does n
if (m_debugger)
m_debugger->asyncTaskStarted(m_task);
alph 2017/03/14 00:39:37 should it fire it from setEnabled instead?
pfeldman 2017/03/14 01:15:10 setEnabled is optional, so no. it is just muting t
}
+void AsyncTask::setEnabled(bool enabled) {
+ if (!enabled)
+ m_debugger = nullptr;
+}
+
AsyncTask::~AsyncTask() {
- if (m_debugger)
+ if (m_debugger) {
m_debugger->asyncTaskFinished(m_task);
+ if (!m_recurring)
+ m_debugger->asyncTaskCanceled(m_task);
+ }
}
void asyncTaskScheduled(ExecutionContext* context,
const String& name,
- void* task,
- bool recurring) {
+ void* task) {
TRACE_EVENT_FLOW_BEGIN1("devtools.timeline.async", "AsyncTask", task, "data",
InspectorAsyncTask::data(name));
if (ThreadDebugger* debugger = ThreadDebugger::from(toIsolate(context)))
- debugger->asyncTaskScheduled(name, task, recurring);
+ debugger->asyncTaskScheduled(name, task, true);
}
void asyncTaskScheduledBreakable(ExecutionContext* context,
const char* name,
- void* task,
- bool recurring) {
- asyncTaskScheduled(context, name, task, recurring);
+ void* task) {
+ asyncTaskScheduled(context, name, task);
breakableLocation(context, name);
}

Powered by Google App Engine
This is Rietveld 408576698