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

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: same with scriptpromiseresolver 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..5c39bcff573e36ad866732963142883d7c4a8dd4 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -55,15 +55,15 @@ 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;
}
void DOMTimer::removeByID(ExecutionContext* context, int timeoutID)
{
- context->timers()->removeTimeoutByID(timeoutID);
+ DOMTimer* timer = context->timers()->removeTimeoutByID(timeoutID);
TRACE_EVENT_INSTANT1("devtools.timeline", "TimerRemove", TRACE_EVENT_SCOPE_THREAD, "data", InspectorTimerRemoveEvent::data(context, timeoutID));
- InspectorInstrumentation::didRemoveTimer(context, timeoutID);
+ if (timer)
+ InspectorInstrumentation::cancelAsyncTask(context, timer->m_action);
}
DOMTimer::DOMTimer(ExecutionContext* context, ScheduledAction* action, int interval, bool singleShot, int timeoutID)
@@ -76,6 +76,8 @@ DOMTimer::DOMTimer(ExecutionContext* context, ScheduledAction* action, int inter
if (shouldForwardUserGesture(interval, m_nestingLevel))
m_userGestureToken = UserGestureIndicator::currentToken();
+ InspectorInstrumentation::scheduleAsyncTask(context, singleShot ? "setTimeout" : "setInterval", action, !singleShot);
+
double intervalMilliseconds = std::max(oneMillisecond, interval * oneMillisecond);
if (intervalMilliseconds < minimumInterval && m_nestingLevel >= maxTimerNestingLevel)
intervalMilliseconds = minimumInterval;
@@ -106,7 +108,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, m_action.get());
// Simple case for non-one-shot timers.
if (isActive()) {
@@ -118,9 +120,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 +130,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().

Powered by Google App Engine
This is Rietveld 408576698