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

Unified Diff: third_party/WebKit/Source/core/frame/DOMTimer.cpp

Issue 1857713004: DevTools: simplify the async instrumentation harness. (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/core/frame/DOMTimer.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
index 6eccc775383a0e6a67ba81acb40fb6b20f4e948c..f704c00afcfb97210c85ec7b92da0b60c6de761a 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -55,7 +55,6 @@ int DOMTimer::install(ExecutionContext* context, ScheduledAction* action, int ti
{
int timeoutID = context->timers()->installNewTimeout(context, action, timeout, singleShot);
TRACE_EVENT_INSTANT1("devtools.timeline", "TimerInstall", TRACE_EVENT_SCOPE_THREAD, "data", InspectorTimerInstallEvent::data(context, timeoutID, timeout, singleShot));
- InspectorInstrumentation::didInstallTimer(context, timeoutID, timeout, singleShot);
return timeoutID;
}
@@ -63,7 +62,6 @@ void DOMTimer::removeByID(ExecutionContext* context, int timeoutID)
{
context->timers()->removeTimeoutByID(timeoutID);
TRACE_EVENT_INSTANT1("devtools.timeline", "TimerRemove", TRACE_EVENT_SCOPE_THREAD, "data", InspectorTimerRemoveEvent::data(context, timeoutID));
- InspectorInstrumentation::didRemoveTimer(context, timeoutID);
}
DOMTimer::DOMTimer(ExecutionContext* context, ScheduledAction* action, int interval, bool singleShot, int timeoutID)
@@ -76,6 +74,8 @@ DOMTimer::DOMTimer(ExecutionContext* context, ScheduledAction* action, int inter
if (shouldForwardUserGesture(interval, m_nestingLevel))
m_userGestureToken = UserGestureIndicator::currentToken();
+ InspectorInstrumentation::asyncTaskScheduled(context, singleShot ? "setTimeout" : "setInterval", this, !singleShot);
+
double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillisecond);
if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNestingLevel)
intervalMilliseconds = minimumInterval;
@@ -106,7 +106,7 @@ void DOMTimer::fired()
UserGestureIndicator gestureIndicator(m_userGestureToken.release());
TRACE_EVENT1("devtools.timeline", "TimerFire", "data", InspectorTimerFireEvent::data(context, m_timeoutID));
- InspectorInstrumentationCookie cookie = InspectorInstrumentation::willFireTimer(context, m_timeoutID);
+ InspectorInstrumentation::AsyncTask asyncTask(context, this);
// Simple case for non-one-shot timers.
if (isActive()) {
@@ -118,9 +118,6 @@ void DOMTimer::fired()
// No access to member variables after this point, it can delete the timer.
m_action->execute(context);
-
- InspectorInstrumentation::didFireTimer(cookie);
-
return;
}
@@ -131,7 +128,6 @@ void DOMTimer::fired()
action->execute(context);
- InspectorInstrumentation::didFireTimer(cookie);
TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_THREAD, "data", InspectorUpdateCountersEvent::data());
// ExecutionContext might be already gone when we executed action->execute().
@@ -141,6 +137,7 @@ void DOMTimer::fired()
void DOMTimer::stop()
{
+ InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
SuspendableTimer::stop();
// Need to release JS objects potentially protected by ScheduledAction
// because they can form circular references back to the ExecutionContext

Powered by Google App Engine
This is Rietveld 408576698