WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Proper WIP #2
wrap.patch (text/plain), 21.14 KB, created by
Zan Dobersek
on 2014-11-27 04:25:38 PST
(
hide
)
Description:
Proper WIP #2
Filename:
MIME Type:
Creator:
Zan Dobersek
Created:
2014-11-27 04:25:38 PST
Size:
21.14 KB
patch
obsolete
>diff --git a/Source/WTF/wtf/PlatformGTK.cmake b/Source/WTF/wtf/PlatformGTK.cmake >index e698892..f4bad8c 100644 >--- a/Source/WTF/wtf/PlatformGTK.cmake >+++ b/Source/WTF/wtf/PlatformGTK.cmake >@@ -1,6 +1,7 @@ > list(APPEND WTF_SOURCES > gobject/GMainLoopSource.cpp > gobject/GRefPtr.cpp >+ gobject/GSourceWrap.cpp > gobject/GThreadSafeMainLoopSource.cpp > gobject/GlibUtilities.cpp > >diff --git a/Source/WTF/wtf/RunLoop.h b/Source/WTF/wtf/RunLoop.h >index 320176d..48264f4 100644 >--- a/Source/WTF/wtf/RunLoop.h >+++ b/Source/WTF/wtf/RunLoop.h >@@ -37,7 +37,7 @@ > #include <wtf/Threading.h> > > #if USE(GLIB) >-#include <wtf/gobject/GMainLoopSource.h> >+#include <wtf/gobject/GSourceWrap.h> > #endif > > #if PLATFORM(EFL) >@@ -101,7 +101,7 @@ public: > Ecore_Timer* m_timer; > bool m_isRepeating; > #elif USE(GLIB) >- GMainLoopSource m_timerSource; >+ GSourceWrap::Dynamic m_timerSource; > #endif > }; > >@@ -164,6 +164,7 @@ public: > private: > GRefPtr<GMainContext> m_runLoopContext; > Vector<GRefPtr<GMainLoop>> m_runLoopMainLoops; >+ GSourceWrap::Static m_workSource; > #endif > }; > >diff --git a/Source/WTF/wtf/gobject/GSourceWrap.cpp b/Source/WTF/wtf/gobject/GSourceWrap.cpp >new file mode 100644 >index 0000000..9fca0a9 >--- /dev/null >+++ b/Source/WTF/wtf/gobject/GSourceWrap.cpp >@@ -0,0 +1,229 @@ >+#include "config.h" >+#include "GSourceWrap.h" >+ >+#include <wtf/gobject/GMutexLocker.h> >+#include <cstdio> >+ >+namespace WTF { >+ >+static void destroyVoidCallback(gpointer data) >+{ >+ auto* function = reinterpret_cast<std::function<void ()>*>(data); >+ delete function; >+} >+ >+static void destroyBoolCallback(gpointer data) >+{ >+ auto* function = reinterpret_cast<std::function<bool ()>*>(data); >+ delete function; >+} >+ >+GSourceWrap::Base::Base() >+{ >+} >+ >+GSourceWrap::Base::~Base() >+{ >+ g_source_destroy(m_source.get()); >+} >+ >+bool GSourceWrap::Base::isScheduled() const >+{ >+ ASSERT(m_source); >+ return g_source_get_ready_time(m_source.get()) != -1; >+} >+ >+bool GSourceWrap::Base::isActive() const >+{ >+ return isScheduled() || source()->dispatching; >+} >+ >+void GSourceWrap::Base::initialize(const char* name, int priority, GMainContext* context) >+{ >+ ASSERT(!m_source); >+ m_source = g_source_new(&sourceFunctions, sizeof(Source)); >+ source()->delay = std::chrono::microseconds(0); >+ source()->dispatching = false; >+ >+ g_source_set_name(m_source.get(), name); >+ if (priority != G_PRIORITY_DEFAULT_IDLE) >+ g_source_set_priority(m_source.get(), priority); >+ >+ g_source_attach(m_source.get(), context); >+} >+ >+void GSourceWrap::Base::schedule(std::chrono::microseconds delay) >+{ >+ ASSERT(m_source); >+ source()->delay = delay; >+ >+ gint64 readyTime = g_source_get_ready_time(m_source.get()); >+ gint64 targetTime = g_get_monotonic_time() + delay.count(); >+ if (readyTime == -1) >+ readyTime = targetTime; >+ else >+ readyTime = std::min<gint64>(readyTime, targetTime); >+ >+ g_source_set_ready_time(m_source.get(), readyTime); >+} >+ >+void GSourceWrap::Base::cancel() >+{ >+ ASSERT(m_source); >+ g_source_set_ready_time(m_source.get(), -1); >+} >+ >+GSourceFuncs GSourceWrap::Base::sourceFunctions = { >+ nullptr, // prepare >+ nullptr, // check >+ // dispatch >+ [](GSource* source, GSourceFunc callback, gpointer data) -> gboolean >+ { >+ ASSERT(source); >+ CallbackContext context{ *reinterpret_cast<Source*>(source), data }; >+ return callback(&context); >+ }, >+ nullptr, // finalize >+ nullptr, // closure_callback >+ nullptr, // closure_marshall >+}; >+ >+gboolean GSourceWrap::Base::staticVoidCallback(gpointer data) >+{ >+ auto& context = *reinterpret_cast<CallbackContext*>(data); >+ context.source.dispatching = true; >+ g_source_set_ready_time(&context.source.baseSource, -1); >+ >+ auto& function = *reinterpret_cast<std::function<void ()>*>(context.data); >+ function(); >+ >+ context.source.dispatching = false; >+ return G_SOURCE_CONTINUE; >+} >+ >+gboolean GSourceWrap::Base::dynamicVoidCallback(gpointer data) >+{ >+ auto& context = *reinterpret_cast<CallbackContext*>(data); >+ context.source.dispatching = true; >+ g_source_set_ready_time(&context.source.baseSource, -1); >+ g_source_set_callback(&context.source.baseSource, nullptr, nullptr, nullptr); >+ >+ auto& function = *reinterpret_cast<std::function<void ()>*>(context.data); >+ function(); >+ >+ context.source.dispatching = false; >+ return G_SOURCE_CONTINUE; >+} >+ >+gboolean GSourceWrap::Base::dynamicBoolCallback(gpointer data) >+{ >+ auto& context = *reinterpret_cast<CallbackContext*>(data); >+ context.source.dispatching = true; >+ g_source_set_ready_time(&context.source.baseSource, -1); >+ >+ auto& function = *reinterpret_cast<std::function<bool ()>*>(context.data); >+ if (function()) >+ g_source_set_ready_time(&context.source.baseSource, g_get_monotonic_time() + context.source.delay.count()); >+ else >+ g_source_set_callback(&context.source.baseSource, nullptr, nullptr, nullptr); >+ >+ context.source.dispatching = false; >+ return G_SOURCE_CONTINUE; >+} >+ >+GSourceWrap::Static::Static(const char* name, std::function<void ()>&& function, int priority, GMainContext* context) >+{ >+ initialize(name, WTF::move(function), priority, context); >+} >+ >+void GSourceWrap::Static::initialize(const char* name, std::function<void ()>&& function, int priority, GMainContext* context) >+{ >+ Base::initialize(name, priority, context); >+ >+ g_source_set_callback(m_source.get(), static_cast<GSourceFunc>(staticVoidCallback), >+ new std::function<void ()>(WTF::move(function)), static_cast<GDestroyNotify>(destroyVoidCallback)); >+} >+ >+void GSourceWrap::Static::schedule(std::chrono::microseconds delay) >+{ >+ Base::schedule(delay); >+} >+ >+void GSourceWrap::Static::cancel() >+{ >+ Base::cancel(); >+} >+ >+GSourceWrap::Dynamic::Dynamic(const char* name, int priority, GMainContext* context) >+{ >+ Base::initialize(name, priority, context); >+} >+ >+void GSourceWrap::Dynamic::schedule(std::function<void ()>&& function, std::chrono::microseconds delay) >+{ >+ // Establish the callback before scheduling. >+ ASSERT(m_source); >+ g_source_set_callback(m_source.get(), static_cast<GSourceFunc>(dynamicVoidCallback), >+ new std::function<void ()>(WTF::move(function)), static_cast<GDestroyNotify>(destroyVoidCallback)); >+ >+ Base::schedule(delay); >+} >+ >+void GSourceWrap::Dynamic::schedule(std::function<bool ()>&& function, std::chrono::microseconds delay) >+{ >+ // Establish the callback before scheduling. >+ g_source_set_callback(m_source.get(), static_cast<GSourceFunc>(dynamicBoolCallback), >+ new std::function<bool ()>(WTF::move(function)), static_cast<GDestroyNotify>(destroyBoolCallback)); >+ >+ Base::schedule(delay); >+} >+ >+void GSourceWrap::Dynamic::cancel() >+{ >+ Base::cancel(); >+ >+ g_source_set_callback(m_source.get(), nullptr, nullptr, nullptr); >+} >+ >+GSourceQueue::GSourceQueue() >+{ >+ g_mutex_init(&m_mutex); >+} >+ >+GSourceQueue::GSourceQueue(const char* name, int priority, GMainContext* context) >+ : m_sourceWrap(name, std::bind(&GSourceQueue::dispatchQueue, this), priority, context) >+{ >+ g_mutex_init(&m_mutex); >+} >+ >+GSourceQueue::~GSourceQueue() >+{ >+ g_mutex_clear(&m_mutex); >+} >+ >+void GSourceQueue::initialize(const char* name, int priority, GMainContext* context) >+{ >+ m_sourceWrap.initialize(name, std::bind(&GSourceQueue::dispatchQueue, this), priority, context); >+} >+ >+void GSourceQueue::queue(std::function<void ()>&& function) >+{ >+ GMutexLocker<GMutex> lock(m_mutex); >+ m_queue.append(WTF::move(function)); >+ >+ m_sourceWrap.schedule(); >+} >+ >+void GSourceQueue::dispatchQueue() >+{ >+ decltype(m_queue) queue; >+ { >+ GMutexLocker<GMutex> lock(m_mutex); >+ queue = WTF::move(m_queue); >+ } >+ >+ for (auto& function : queue) >+ function(); >+} >+ >+} // namespace WTF >diff --git a/Source/WTF/wtf/gobject/GSourceWrap.h b/Source/WTF/wtf/gobject/GSourceWrap.h >new file mode 100644 >index 0000000..dd4d6b9 >--- /dev/null >+++ b/Source/WTF/wtf/gobject/GSourceWrap.h >@@ -0,0 +1,94 @@ >+#ifndef GSourceWrap_h >+#define GSourceWrap_h >+ >+#include <chrono> >+#include <functional> >+#include <glib.h> >+#include <wtf/Noncopyable.h> >+#include <wtf/Vector.h> >+#include <wtf/gobject/GRefPtr.h> >+ >+namespace WTF { >+ >+class GSourceWrap { >+ WTF_MAKE_NONCOPYABLE(GSourceWrap); >+private: >+ class Base { >+ public: >+ Base(); >+ ~Base(); >+ >+ bool isScheduled() const; >+ bool isActive() const; >+ >+ protected: >+ void initialize(const char* name, int priority, GMainContext*); >+ void schedule(std::chrono::microseconds); >+ void cancel(); >+ >+ static GSourceFuncs sourceFunctions; >+ static gboolean staticVoidCallback(gpointer); >+ static gboolean dynamicVoidCallback(gpointer); >+ static gboolean dynamicBoolCallback(gpointer); >+ >+ struct Source { >+ GSource baseSource; >+ std::chrono::microseconds delay; >+ bool dispatching; >+ }; >+ >+ struct CallbackContext { >+ Source& source; >+ gpointer data; >+ }; >+ >+ Source* source() const { return reinterpret_cast<Source*>(m_source.get()); } >+ GRefPtr<GSource> m_source; >+ }; >+ >+public: >+ class Static : public Base { >+ public: >+ Static() { } >+ Static(const char* name, std::function<void ()>&&, int priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* = nullptr); >+ void initialize(const char* name, std::function<void ()>&&, int priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* = nullptr); >+ >+ void schedule(std::chrono::microseconds = std::chrono::microseconds(0)); >+ void cancel(); >+ }; >+ >+ class Dynamic : public Base { >+ public: >+ Dynamic(const char* name, int priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* = nullptr); >+ >+ void schedule(std::function<void ()>&&, std::chrono::microseconds = std::chrono::microseconds(0)); >+ void schedule(std::function<bool ()>&&, std::chrono::microseconds = std::chrono::microseconds(0)); >+ void cancel(); >+ }; >+}; >+ >+class GSourceQueue { >+ WTF_MAKE_NONCOPYABLE(GSourceQueue); >+public: >+ GSourceQueue(); >+ GSourceQueue(const char*, int priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* = nullptr); >+ ~GSourceQueue(); >+ >+ void initialize(const char*, int priority = G_PRIORITY_DEFAULT_IDLE, GMainContext* = nullptr); >+ >+ void queue(std::function<void ()>&&); >+ >+private: >+ void dispatchQueue(); >+ >+ GSourceWrap::Static m_sourceWrap; >+ GMutex m_mutex; >+ Vector<std::function<void ()>, 16> m_queue; >+}; >+ >+} // namespace WTF >+ >+using WTF::GSourceWrap; >+using WTF::GSourceQueue; >+ >+#endif // GSourceWrap_h >diff --git a/Source/WTF/wtf/gtk/RunLoopGtk.cpp b/Source/WTF/wtf/gtk/RunLoopGtk.cpp >index 8faa480..c089747 100644 >--- a/Source/WTF/wtf/gtk/RunLoopGtk.cpp >+++ b/Source/WTF/wtf/gtk/RunLoopGtk.cpp >@@ -40,6 +40,9 @@ RunLoop::RunLoop() > GRefPtr<GMainLoop> innermostLoop = adoptGRef(g_main_loop_new(m_runLoopContext.get(), FALSE)); > ASSERT(innermostLoop); > m_runLoopMainLoops.append(innermostLoop); >+ >+ m_workSource.initialize("[WebKit] RunLoop work", std::bind(&RunLoop::performWork, this), >+ G_PRIORITY_DEFAULT, m_runLoopContext.get()); > } > > RunLoop::~RunLoop() >@@ -99,15 +102,13 @@ void RunLoop::stop() > > void RunLoop::wakeUp() > { >- RefPtr<RunLoop> runLoop(this); >- GMainLoopSource::scheduleAndDeleteOnDestroy("[WebKit] RunLoop work", std::function<void()>([runLoop] { >- runLoop->performWork(); >- }), G_PRIORITY_DEFAULT, nullptr, m_runLoopContext.get()); >+ m_workSource.schedule(); > g_main_context_wakeup(m_runLoopContext.get()); > } > > RunLoop::TimerBase::TimerBase(RunLoop& runLoop) > : m_runLoop(runLoop) >+ , m_timerSource("[WebKit] RunLoop::Timer", G_PRIORITY_DEFAULT, m_runLoop.m_runLoopContext.get()) > { > } > >@@ -118,8 +119,8 @@ RunLoop::TimerBase::~TimerBase() > > void RunLoop::TimerBase::start(double fireInterval, bool repeat) > { >- m_timerSource.scheduleAfterDelay("[WebKit] RunLoop::Timer", std::function<bool ()>([this, repeat] { fired(); return repeat; }), >- std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::duration<double>(fireInterval)), G_PRIORITY_DEFAULT, nullptr, m_runLoop.m_runLoopContext.get()); >+ m_timerSource.schedule([this, repeat] { fired(); return repeat; }, >+ std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(fireInterval))); > } > > void RunLoop::TimerBase::stop() >diff --git a/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h b/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h >index 0ed3137..f455cea 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h >+++ b/Source/WebCore/platform/graphics/gstreamer/GStreamerUtilities.h >@@ -41,6 +41,29 @@ namespace WebCore { > > class IntSize; > >+class GstObjectRef { >+public: >+ GstObjectRef(GstObject* object) >+ : m_object(GST_OBJECT(gst_object_ref(object))) >+ { >+ } >+ >+ ~GstObjectRef() >+ { >+ gst_object_unref(m_object); >+ } >+ >+ GstObjectRef(const GstObjectRef& other) >+ : m_object(GST_OBJECT(gst_object_ref(other.m_object))) >+ { >+ } >+ >+ GstObject* get() const { return m_object; } >+ >+private: >+ GstObject* m_object; >+}; >+ > inline bool webkitGstCheckVersion(guint major, guint minor, guint micro) > { > guint currentMajor, currentMinor, currentMicro, currentNano; >diff --git a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp >index 255e760..ff8e883 100644 >--- a/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp >+++ b/Source/WebCore/platform/graphics/gstreamer/VideoSinkGStreamer.cpp >@@ -37,7 +37,7 @@ > #include <gst/video/gstvideometa.h> > #include <wtf/OwnPtr.h> > #include <wtf/gobject/GMutexLocker.h> >-#include <wtf/gobject/GThreadSafeMainLoopSource.h> >+#include <wtf/gobject/GSourceWrap.h> > > using namespace WebCore; > >@@ -70,6 +70,7 @@ static guint webkitVideoSinkSignals[LAST_SIGNAL] = { 0, }; > > struct _WebKitVideoSinkPrivate { > _WebKitVideoSinkPrivate() >+ : timeoutSource("[WebKit] webkitVideoSinkTimeoutCallback") > { > g_mutex_init(&sampleMutex); > g_cond_init(&dataCondition); >@@ -83,7 +84,7 @@ struct _WebKitVideoSinkPrivate { > } > > GstSample* sample; >- GThreadSafeMainLoopSource timeoutSource; >+ GSourceWrap::Dynamic timeoutSource; > GMutex sampleMutex; > GCond dataCondition; > >@@ -218,9 +219,8 @@ static GstFlowReturn webkitVideoSinkRender(GstBaseSink* baseSink, GstBuffer* buf > // This should likely use a lower priority, but glib currently starves > // lower priority sources. > // See: https://bugzilla.gnome.org/show_bug.cgi?id=610830. >- gst_object_ref(sink); >- priv->timeoutSource.schedule("[WebKit] webkitVideoSinkTimeoutCallback", std::function<void()>(std::bind(webkitVideoSinkTimeoutCallback, sink)), G_PRIORITY_DEFAULT, >- [sink] { gst_object_unref(sink); }); >+ GstObjectRef protector(GST_OBJECT(sink)); >+ priv->timeoutSource.schedule([protector] { webkitVideoSinkTimeoutCallback(WEBKIT_VIDEO_SINK(protector.get())); }); > > g_cond_wait(&priv->dataCondition, &priv->sampleMutex); > return GST_FLOW_OK; >diff --git a/Source/WebCore/platform/gtk/SharedTimerGtk.cpp b/Source/WebCore/platform/gtk/SharedTimerGtk.cpp >index 74c6f70..d88715a 100644 >--- a/Source/WebCore/platform/gtk/SharedTimerGtk.cpp >+++ b/Source/WebCore/platform/gtk/SharedTimerGtk.cpp >@@ -28,12 +28,17 @@ > #include "config.h" > #include "SharedTimer.h" > >-#include <wtf/gobject/GMainLoopSource.h> >+#include <wtf/gobject/GSourceWrap.h> > > namespace WebCore { > >-static GMainLoopSource gSharedTimer; > static void (*sharedTimerFiredFunction)(); >+static void sharedTimerFired() { sharedTimerFiredFunction(); } >+ >+// G_PRIORITY_HIGH_IDLE + 20 is GDK_PRIORITY_REDRAW, but we >+// don't want to depend on GDK here just to use a constant. >+static GSourceWrap::Static gSharedTimer("[WebKit] sharedTimerTimeoutCallback", >+ std::function<void ()>(sharedTimerFired), G_PRIORITY_HIGH_IDLE + 20); > > void setSharedTimerFiredFunction(void (*f)()) > { >@@ -45,11 +50,7 @@ void setSharedTimerFiredFunction(void (*f)()) > void setSharedTimerFireInterval(double interval) > { > ASSERT(sharedTimerFiredFunction); >- >- // This is GDK_PRIORITY_REDRAW, but we don't want to depend on GDK here just to use a constant. >- static const int priority = G_PRIORITY_HIGH_IDLE + 20; >- gSharedTimer.scheduleAfterDelay("[WebKit] sharedTimerTimeoutCallback", std::function<void()>(sharedTimerFiredFunction), >- std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(interval)), priority); >+ gSharedTimer.schedule(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(interval))); > } > > void stopSharedTimer() >diff --git a/Source/WebKit2/Platform/WorkQueue.h b/Source/WebKit2/Platform/WorkQueue.h >index 93c7e78..25a40a3 100644 >--- a/Source/WebKit2/Platform/WorkQueue.h >+++ b/Source/WebKit2/Platform/WorkQueue.h >@@ -47,6 +47,7 @@ > > #if PLATFORM(GTK) > #include <wtf/gobject/GMainLoopSource.h> >+#include <wtf/gobject/GSourceWrap.h> > #include <wtf/gobject/GRefPtr.h> > #elif PLATFORM(EFL) > #include <DispatchQueueEfl.h> >@@ -96,6 +97,7 @@ private: > Mutex m_eventLoopLock; > GRefPtr<GMainLoop> m_eventLoop; > GMainLoopSource m_socketEventSource; >+ GSourceQueue m_dispatchQueue; > #elif PLATFORM(EFL) > RefPtr<DispatchQueue> m_dispatchQueue; > #endif >diff --git a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp >index bd852da..abe9081 100644 >--- a/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp >+++ b/Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp >@@ -39,6 +39,8 @@ void WorkQueue::platformInitialize(const char* name, QOS) > m_eventLoop = adoptGRef(g_main_loop_new(m_eventContext.get(), FALSE)); > ASSERT(m_eventLoop); > >+ m_dispatchQueue.initialize("[WebKit] WorkQueue::dispatch", G_PRIORITY_DEFAULT_IDLE, m_eventContext.get()); >+ > // This name can be com.apple.WebKit.ProcessLauncher or com.apple.CoreIPC.ReceiveQueue. > // We are using those names for the thread name, but both are longer than 31 characters, > // which is the limit of Visual Studio for thread names. >@@ -107,9 +109,7 @@ void WorkQueue::unregisterSocketEventHandler(int) > > void WorkQueue::dispatch(std::function<void ()> function) > { >- ref(); >- GMainLoopSource::scheduleAndDeleteOnDestroy("[WebKit] WorkQueue::dispatch", WTF::move(function), G_PRIORITY_DEFAULT, >- [this] { deref(); }, m_eventContext.get()); >+ m_dispatchQueue.queue(WTF::move(function)); > } > > void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, std::function<void ()> function) >diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp >index eaa63e1..0a561f4 100644 >--- a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp >+++ b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp >@@ -74,6 +74,7 @@ LayerTreeHostGtk::LayerTreeHostGtk(WebPage* webPage) > , m_notifyAfterScheduledLayerFlush(false) > , m_lastFlushTime(0) > , m_layerFlushSchedulingEnabled(true) >+ , m_layerFlushTimerCallback("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this), GDK_PRIORITY_EVENTS) > { > } > >@@ -258,8 +259,7 @@ void LayerTreeHostGtk::layerFlushTimerFired() > if (!m_layerFlushTimerCallback.isScheduled() && downcast<GraphicsLayerTextureMapper>(*m_rootLayer).layer()->descendantsOrSelfHaveRunningAnimations()) { > const double targetFPS = 60; > double nextFlush = std::max((1 / targetFPS) - (currentTime() - m_lastFlushTime), 0.0); >- m_layerFlushTimerCallback.scheduleAfterDelay("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this), >- std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(nextFlush)), GDK_PRIORITY_EVENTS); >+ m_layerFlushTimerCallback.schedule(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::duration<double>(nextFlush))); > } > } > >@@ -359,7 +359,7 @@ void LayerTreeHostGtk::scheduleLayerFlush() > > // We use a GLib timer because otherwise GTK+ event handling during dragging can starve WebCore timers, which have a lower priority. > if (!m_layerFlushTimerCallback.isScheduled()) >- m_layerFlushTimerCallback.schedule("[WebKit] layerFlushTimer", std::bind(&LayerTreeHostGtk::layerFlushTimerFired, this), GDK_PRIORITY_EVENTS); >+ m_layerFlushTimerCallback.schedule(); > } > > void LayerTreeHostGtk::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled) >diff --git a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h >index d9370c2..875eed4 100644 >--- a/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h >+++ b/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h >@@ -37,7 +37,7 @@ > #include <WebCore/PageOverlay.h> > #include <wtf/HashMap.h> > #include <wtf/OwnPtr.h> >-#include <wtf/gobject/GMainLoopSource.h> >+#include <wtf/gobject/GSourceWrap.h> > > namespace WebKit { > >@@ -102,7 +102,7 @@ private: > OwnPtr<WebCore::GLContext> m_context; > double m_lastFlushTime; > bool m_layerFlushSchedulingEnabled; >- GMainLoopSource m_layerFlushTimerCallback; >+ GSourceWrap::Static m_layerFlushTimerCallback; > }; > > } // namespace WebKit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 138691
:
241857
|
242249
|
242250
|
254639
|
254662
|
256302
|
263833
|
263834