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

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

Issue 2550373005: Make WebTaskRunner ThreadSafeRefCounted (Closed)
Patch Set: mac fix Created 4 years 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/platform/Timer.h
diff --git a/third_party/WebKit/Source/platform/Timer.h b/third_party/WebKit/Source/platform/Timer.h
index f47850006eee7b95246b7f55f44dde74a7650964..13b20e7de0b1e292dafc22c5bd853c6c22c05c7a 100644
--- a/third_party/WebKit/Source/platform/Timer.h
+++ b/third_party/WebKit/Source/platform/Timer.h
@@ -46,7 +46,7 @@ class PLATFORM_EXPORT TimerBase {
WTF_MAKE_NONCOPYABLE(TimerBase);
public:
- explicit TimerBase(WebTaskRunner*);
+ explicit TimerBase(RefPtr<WebTaskRunner>);
virtual ~TimerBase();
void start(double nextFireInterval,
@@ -80,13 +80,13 @@ class PLATFORM_EXPORT TimerBase {
};
protected:
- static WebTaskRunner* getTimerTaskRunner();
- static WebTaskRunner* getUnthrottledTaskRunner();
+ static RefPtr<WebTaskRunner> getTimerTaskRunner();
+ static RefPtr<WebTaskRunner> getUnthrottledTaskRunner();
private:
virtual void fired() = 0;
- virtual WebTaskRunner* timerTaskRunner() const;
+ virtual RefPtr<WebTaskRunner> timerTaskRunner() const;
NO_SANITIZE_ADDRESS
virtual bool canFire() const { return true; }
@@ -100,7 +100,7 @@ class PLATFORM_EXPORT TimerBase {
double m_nextFireTime; // 0 if inactive
double m_repeatInterval; // 0 if not repeating
WebTraceLocation m_location;
- std::unique_ptr<WebTaskRunner> m_webTaskRunner;
+ RefPtr<WebTaskRunner> m_webTaskRunner;
#if DCHECK_IS_ON()
ThreadIdentifier m_thread;
@@ -131,10 +131,10 @@ class TaskRunnerTimer : public TimerBase {
public:
using TimerFiredFunction = void (TimerFiredClass::*)(TimerBase*);
- TaskRunnerTimer(WebTaskRunner* webTaskRunner,
+ TaskRunnerTimer(RefPtr<WebTaskRunner> webTaskRunner,
TimerFiredClass* o,
TimerFiredFunction f)
- : TimerBase(webTaskRunner), m_object(o), m_function(f) {}
+ : TimerBase(std::move(webTaskRunner)), m_object(o), m_function(f) {}
~TaskRunnerTimer() override {}

Powered by Google App Engine
This is Rietveld 408576698