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

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

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
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 1af4cfc73f99c84528e75b29655686d30c1ca2cc..caddaee9d5175a4f48366790666888a9ea6b69b5 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,
@@ -75,20 +75,20 @@ class PLATFORM_EXPORT TimerBase {
m_repeatInterval += delta;
}
- void moveToNewTaskRunner(WebTaskRunner*);
+ void moveToNewTaskRunner(RefPtr<WebTaskRunner>);
struct PLATFORM_EXPORT Comparator {
bool operator()(const TimerBase* a, const TimerBase* b) const;
};
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; }
@@ -102,7 +102,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;
@@ -133,10 +133,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 {}
« no previous file with comments | « third_party/WebKit/Source/modules/webgl/WebGLTimerQueryEXT.cpp ('k') | third_party/WebKit/Source/platform/Timer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698