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

Unified Diff: third_party/WebKit/Source/modules/sensor/Sensor.cpp

Issue 2698153003: Reduce createSameThreadTask usage in modules/ (Closed)
Patch Set: Move a static callback to an anonymous namespace 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/modules/sensor/Sensor.cpp
diff --git a/third_party/WebKit/Source/modules/sensor/Sensor.cpp b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
index f0ed3d8095b0b6f98af81ac24997d34f138ad836..e930490d6e17f30de0a88fb59bfecb10a52d4d89 100644
--- a/third_party/WebKit/Source/modules/sensor/Sensor.cpp
+++ b/third_party/WebKit/Source/modules/sensor/Sensor.cpp
@@ -6,7 +6,6 @@
#include "core/dom/Document.h"
#include "core/dom/ExceptionCode.h"
-#include "core/dom/ExecutionContextTask.h"
#include "core/dom/TaskRunnerHelper.h"
#include "core/inspector/ConsoleMessage.h"
#include "core/timing/DOMWindowPerformance.h"
@@ -279,10 +278,9 @@ void Sensor::updateState(Sensor::SensorState newState) {
// so that the first reading update will be notified considering the given
// frequency hint.
m_lastUpdateTimestamp = WTF::monotonicallyIncreasingTime();
- getExecutionContext()->postTask(
- TaskType::Sensor, BLINK_FROM_HERE,
- createSameThreadTask(&Sensor::notifyOnActivate,
- wrapWeakPersistent(this)));
+ TaskRunnerHelper::get(TaskType::Sensor, getExecutionContext())
+ ->postTask(BLINK_FROM_HERE, WTF::bind(&Sensor::notifyOnActivate,
+ wrapWeakPersistent(this)));
}
m_state = newState;
@@ -295,9 +293,9 @@ void Sensor::reportError(ExceptionCode code,
if (getExecutionContext()) {
auto error =
DOMException::create(code, sanitizedMessage, unsanitizedMessage);
- getExecutionContext()->postTask(
- TaskType::Sensor, BLINK_FROM_HERE,
- createSameThreadTask(&Sensor::notifyError, wrapWeakPersistent(this),
+ TaskRunnerHelper::get(TaskType::Sensor, getExecutionContext())
+ ->postTask(BLINK_FROM_HERE,
+ WTF::bind(&Sensor::notifyError, wrapWeakPersistent(this),
wrapPersistent(error)));
}
}

Powered by Google App Engine
This is Rietveld 408576698