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

Unified Diff: third_party/WebKit/Source/platform/Timer.cpp

Issue 2550373005: Make WebTaskRunner ThreadSafeRefCounted (Closed)
Patch Set: +DISALLOW_COPY_AND_ASSIGN for win build fix Created 3 years, 11 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
« no previous file with comments | « third_party/WebKit/Source/platform/Timer.h ('k') | third_party/WebKit/Source/platform/TimerTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/Timer.cpp
diff --git a/third_party/WebKit/Source/platform/Timer.cpp b/third_party/WebKit/Source/platform/Timer.cpp
index 5e056f81bc61aedd86fa8d9218bf94e3e0505c86..5ca80d540de0e270bd2f8f760ab1ce3ca22a7738 100644
--- a/third_party/WebKit/Source/platform/Timer.cpp
+++ b/third_party/WebKit/Source/platform/Timer.cpp
@@ -40,10 +40,10 @@
namespace blink {
-TimerBase::TimerBase(WebTaskRunner* webTaskRunner)
+TimerBase::TimerBase(RefPtr<WebTaskRunner> webTaskRunner)
: m_nextFireTime(0),
m_repeatInterval(0),
- m_webTaskRunner(webTaskRunner->clone()),
+ m_webTaskRunner(std::move(webTaskRunner)),
#if DCHECK_IS_ON()
m_thread(currentThread()),
#endif
@@ -85,7 +85,7 @@ double TimerBase::nextFireInterval() const {
return m_nextFireTime - current;
}
-void TimerBase::moveToNewTaskRunner(WebTaskRunner* taskRunner) {
+void TimerBase::moveToNewTaskRunner(RefPtr<WebTaskRunner> taskRunner) {
#if DCHECK_IS_ON()
DCHECK_EQ(m_thread, currentThread());
DCHECK(taskRunner->runsTasksOnCurrentThread());
@@ -98,7 +98,7 @@ void TimerBase::moveToNewTaskRunner(WebTaskRunner* taskRunner) {
bool active = isActive();
m_weakPtrFactory.revokeAll();
- m_webTaskRunner = taskRunner->clone();
+ m_webTaskRunner = std::move(taskRunner);
if (!active)
return;
@@ -111,17 +111,17 @@ void TimerBase::moveToNewTaskRunner(WebTaskRunner* taskRunner) {
}
// static
-WebTaskRunner* TimerBase::getTimerTaskRunner() {
+RefPtr<WebTaskRunner> TimerBase::getTimerTaskRunner() {
return Platform::current()->currentThread()->scheduler()->timerTaskRunner();
}
// static
-WebTaskRunner* TimerBase::getUnthrottledTaskRunner() {
+RefPtr<WebTaskRunner> TimerBase::getUnthrottledTaskRunner() {
return Platform::current()->currentThread()->getWebTaskRunner();
}
-WebTaskRunner* TimerBase::timerTaskRunner() const {
- return m_webTaskRunner.get();
+RefPtr<WebTaskRunner> TimerBase::timerTaskRunner() const {
+ return m_webTaskRunner;
}
void TimerBase::setNextFireTime(double now, double delay) {
« no previous file with comments | « third_party/WebKit/Source/platform/Timer.h ('k') | third_party/WebKit/Source/platform/TimerTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698