summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/HeapTimer.h
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2017-06-27 06:07:23 +0000
commit1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch)
tree46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/heap/HeapTimer.h
parent32761a6cee1d0dee366b885b7b9c777e67885688 (diff)
downloadWebKitGtk-tarball-master.tar.gz
Diffstat (limited to 'Source/JavaScriptCore/heap/HeapTimer.h')
-rw-r--r--Source/JavaScriptCore/heap/HeapTimer.h50
1 files changed, 28 insertions, 22 deletions
diff --git a/Source/JavaScriptCore/heap/HeapTimer.h b/Source/JavaScriptCore/heap/HeapTimer.h
index 760405c79..48c29a43a 100644
--- a/Source/JavaScriptCore/heap/HeapTimer.h
+++ b/Source/JavaScriptCore/heap/HeapTimer.h
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012, 2015-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -23,60 +23,66 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef HeapTimer_h
-#define HeapTimer_h
+#pragma once
+#include <wtf/Lock.h>
+#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
+#include <wtf/ThreadSafeRefCounted.h>
#include <wtf/Threading.h>
#if USE(CF)
#include <CoreFoundation/CoreFoundation.h>
-#elif PLATFORM(EFL)
-#if USE(EO)
-typedef struct _Eo_Opaque Ecore_Timer;
-#else
-typedef struct _Ecore_Timer Ecore_Timer;
#endif
+
+#if USE(GLIB)
+#include <wtf/glib/GRefPtr.h>
#endif
namespace JSC {
+class JSLock;
class VM;
-class HeapTimer {
+class HeapTimer : public ThreadSafeRefCounted<HeapTimer> {
public:
-#if USE(CF)
- HeapTimer(VM*, CFRunLoopRef);
- static void timerDidFire(CFRunLoopTimerRef, void*);
-#else
HeapTimer(VM*);
+#if USE(CF)
+ static void timerDidFireCallback(CFRunLoopTimerRef, void*);
#endif
JS_EXPORT_PRIVATE virtual ~HeapTimer();
virtual void doWork() = 0;
+
+ void scheduleTimer(double intervalInSeconds);
+ void cancelTimer();
+ bool isScheduled() const { return m_isScheduled; }
+
+#if USE(CF)
+ JS_EXPORT_PRIVATE void setRunLoop(CFRunLoopRef);
+#endif // USE(CF)
protected:
VM* m_vm;
+ RefPtr<JSLock> m_apiLock;
+ bool m_isScheduled { false };
#if USE(CF)
static const CFTimeInterval s_decade;
RetainPtr<CFRunLoopTimerRef> m_timer;
RetainPtr<CFRunLoopRef> m_runLoop;
+
CFRunLoopTimerContext m_context;
- Mutex m_shutdownMutex;
-#elif PLATFORM(EFL)
- static bool timerEvent(void*);
- Ecore_Timer* add(double delay, void* agent);
- void stop();
- Ecore_Timer* m_timer;
+ Lock m_shutdownMutex;
+#elif USE(GLIB)
+ static const long s_decade;
+ GRefPtr<GSource> m_timer;
#endif
private:
- void invalidate();
+ void timerDidFire();
};
} // namespace JSC
-
-#endif