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

Unified Diff: third_party/WebKit/Source/core/frame/DOMTimer.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/frame/DOMTimer.cpp
diff --git a/third_party/WebKit/Source/core/frame/DOMTimer.cpp b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
index d74c1e8b58ffcdf8dbb53ecb620185c34050bb31..e3be451a71491ec3c0b57390b99f4d40d4e453d6 100644
--- a/third_party/WebKit/Source/core/frame/DOMTimer.cpp
+++ b/third_party/WebKit/Source/core/frame/DOMTimer.cpp
@@ -64,8 +64,6 @@ int DOMTimer::install(ExecutionContext* context,
TRACE_EVENT_SCOPE_THREAD, "data",
InspectorTimerInstallEvent::data(context, timeoutID,
timeout, singleShot));
- InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(context,
- "setTimer", true);
return timeoutID;
}
@@ -74,8 +72,6 @@ void DOMTimer::removeByID(ExecutionContext* context, int timeoutID) {
TRACE_EVENT_INSTANT1("devtools.timeline", "TimerRemove",
TRACE_EVENT_SCOPE_THREAD, "data",
InspectorTimerRemoveEvent::data(context, timeoutID));
- InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(
- context, "clearTimer", true);
// Eagerly unregister as ExecutionContext observer.
if (timer)
timer->clearContext();
@@ -97,9 +93,6 @@ DOMTimer::DOMTimer(ExecutionContext* context,
m_userGestureToken = UserGestureIndicator::currentToken();
}
- InspectorInstrumentation::asyncTaskScheduled(
- context, singleShot ? "setTimeout" : "setInterval", this, !singleShot);
-
double intervalMilliseconds =
std::max(oneMillisecond, interval * oneMillisecond);
if (intervalMilliseconds < minimumInterval &&
@@ -109,6 +102,10 @@ DOMTimer::DOMTimer(ExecutionContext* context,
startOneShot(intervalMilliseconds, BLINK_FROM_HERE);
else
startRepeating(intervalMilliseconds, BLINK_FROM_HERE);
+
+ suspendIfNeeded();
+ InspectorInstrumentation::asyncTaskScheduledBreakable(
+ context, singleShot ? "setTimeout" : "setInterval", this, !singleShot);
}
DOMTimer::~DOMTimer() {
@@ -117,7 +114,10 @@ DOMTimer::~DOMTimer() {
}
void DOMTimer::stop() {
- InspectorInstrumentation::asyncTaskCanceled(getExecutionContext(), this);
+ InspectorInstrumentation::asyncTaskCanceledBreakable(
+ getExecutionContext(),
+ repeatInterval() ? "clearInterval" : "clearTimeout", this);
+
m_userGestureToken = nullptr;
// Need to release JS objects potentially protected by ScheduledAction
// because they can form circular references back to the ExecutionContext
@@ -145,9 +145,7 @@ void DOMTimer::fired() {
InspectorTimerFireEvent::data(context, m_timeoutID));
PerformanceMonitor::HandlerCall handlerCall(
context, repeatInterval() ? "setInterval" : "setTimeout", true);
- InspectorInstrumentation::NativeBreakpoint nativeBreakpoint(
- context, "timerFired", false);
- InspectorInstrumentation::AsyncTask asyncTask(context, this);
+ InspectorInstrumentation::AsyncTask asyncTask(context, this, "timerFired");
// Simple case for non-one-shot timers.
if (isActive()) {

Powered by Google App Engine
This is Rietveld 408576698