Modified: releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/ChangeLog (214816 => 214817)
--- releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/ChangeLog 2017-04-03 17:32:26 UTC (rev 214816)
+++ releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/ChangeLog 2017-04-03 17:38:19 UTC (rev 214817)
@@ -1,3 +1,18 @@
+2017-04-02 Carlos Garcia Campos <cgar...@igalia.com>
+
+ Share implementation of JSRunLoopTimer::timerDidFire
+ https://bugs.webkit.org/show_bug.cgi?id=170392
+
+ Reviewed by Michael Catanzaro.
+
+ The code is cross-platform but it's duplicated in CF and GLib implementations, it could be shared instead.
+
+ * runtime/JSRunLoopTimer.cpp:
+ (JSC::JSRunLoopTimer::timerDidFire): Move common implementation here.
+ (JSC::JSRunLoopTimer::setRunLoop): Use timerDidFireCallback.
+ (JSC::JSRunLoopTimer::timerDidFireCallback): Call JSRunLoopTimer::timerDidFire().
+ * runtime/JSRunLoopTimer.h:
+
2017-04-01 Oleksandr Skachkov <gskach...@gmail.com>
Object with numerical keys with gaps gets filled by NaN values
Modified: releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/heap/HeapTimer.cpp (214816 => 214817)
--- releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/heap/HeapTimer.cpp 2017-04-03 17:32:26 UTC (rev 214816)
+++ releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/heap/HeapTimer.cpp 2017-04-03 17:38:19 UTC (rev 214817)
@@ -40,6 +40,25 @@
namespace JSC {
+void HeapTimer::timerDidFire()
+{
+ m_apiLock->lock();
+
+ RefPtr<VM> vm = m_apiLock->vm();
+ if (!vm) {
+ // The VM has been destroyed, so we should just give up.
+ m_apiLock->unlock();
+ return;
+ }
+
+ {
+ JSLockHolder locker(vm.get());
+ doWork();
+ }
+
+ m_apiLock->unlock();
+}
+
#if USE(CF)
const CFTimeInterval HeapTimer::s_decade = 60 * 60 * 24 * 365 * 10;
@@ -64,7 +83,7 @@
m_runLoop = runLoop;
memset(&m_context, 0, sizeof(CFRunLoopTimerContext));
m_context.info = this;
- m_timer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, s_decade, s_decade, 0, 0, HeapTimer::timerDidFire, &m_context));
+ m_timer = adoptCF(CFRunLoopTimerCreate(kCFAllocatorDefault, s_decade, s_decade, 0, 0, HeapTimer::timerDidFireCallback, &m_context));
CFRunLoopAddTimer(m_runLoop.get(), m_timer.get(), kCFRunLoopCommonModes);
}
}
@@ -74,24 +93,9 @@
setRunLoop(0);
}
-void HeapTimer::timerDidFire(CFRunLoopTimerRef, void* contextPtr)
+void HeapTimer::timerDidFireCallback(CFRunLoopTimerRef, void* contextPtr)
{
- HeapTimer* timer = static_cast<HeapTimer*>(contextPtr);
- timer->m_apiLock->lock();
-
- RefPtr<VM> vm = timer->m_apiLock->vm();
- if (!vm) {
- // The VM has been destroyed, so we should just give up.
- timer->m_apiLock->unlock();
- return;
- }
-
- {
- JSLockHolder locker(vm.get());
- timer->doWork();
- }
-
- timer->m_apiLock->unlock();
+ static_cast<JSRunLoopTimer*>(contextPtr)->timerDidFire();
}
void HeapTimer::scheduleTimer(double intervalInSeconds)
@@ -143,24 +147,6 @@
g_source_destroy(m_timer.get());
}
-void HeapTimer::timerDidFire()
-{
- m_apiLock->lock();
-
- if (!m_apiLock->vm()) {
- // The VM has been destroyed, so we should just give up.
- m_apiLock->unlock();
- return;
- }
-
- {
- JSLockHolder locker(m_vm);
- doWork();
- }
-
- m_apiLock->unlock();
-}
-
void HeapTimer::scheduleTimer(double intervalInSeconds)
{
g_source_set_ready_time(m_timer.get(), g_get_monotonic_time() + intervalInSeconds * G_USEC_PER_SEC);
@@ -182,10 +168,6 @@
{
}
-void HeapTimer::invalidate()
-{
-}
-
void HeapTimer::scheduleTimer(double)
{
}
Modified: releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/heap/HeapTimer.h (214816 => 214817)
--- releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/heap/HeapTimer.h 2017-04-03 17:32:26 UTC (rev 214816)
+++ releases/WebKitGTK/webkit-2.16/Source/_javascript_Core/heap/HeapTimer.h 2017-04-03 17:38:19 UTC (rev 214817)
@@ -48,7 +48,7 @@
public:
HeapTimer(VM*);
#if USE(CF)
- static void timerDidFire(CFRunLoopTimerRef, void*);
+ static void timerDidFireCallback(CFRunLoopTimerRef, void*);
#endif
JS_EXPORT_PRIVATE virtual ~HeapTimer();
@@ -78,12 +78,11 @@
Lock m_shutdownMutex;
#elif USE(GLIB)
static const long s_decade;
- void timerDidFire();
GRefPtr<GSource> m_timer;
#endif
private:
- void invalidate();
+ void timerDidFire();
};
} // namespace JSC