Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ ViewPlatform::ViewPlatform(WPEDisplay* display, const API::PageConfiguration& co
ViewPlatform::~ViewPlatform()
{
g_signal_handlers_disconnect_by_data(m_wpeView.get(), this);
dispatchPendingNextPresentationUpdateCallbacks();
m_inputMethodFilter.setContext(nullptr);
m_backingStore = nullptr;
}
Expand Down Expand Up @@ -592,15 +593,21 @@ void ViewPlatform::didLosePointerLock()
}
#endif

void ViewPlatform::dispatchPendingNextPresentationUpdateCallbacks()
{
while (!m_nextPresentationUpdateCallbacks.isEmpty()) {
auto callback = m_nextPresentationUpdateCallbacks.takeLast();
callback();
}
}

void ViewPlatform::callAfterNextPresentationUpdate(CompletionHandler<void()>&& callback)
{
RELEASE_ASSERT(!m_nextPresentationUpdateCallback);
m_nextPresentationUpdateCallback = WTFMove(callback);
m_nextPresentationUpdateCallbacks.insert(0, WTFMove(callback));
if (!m_bufferRenderedID) {
m_bufferRenderedID = g_signal_connect_after(m_wpeView.get(), "buffer-rendered", G_CALLBACK(+[](WPEView* view, WPEBuffer*, gpointer userData) {
auto& webView = *reinterpret_cast<ViewPlatform*>(userData);
if (webView.m_nextPresentationUpdateCallback)
webView.m_nextPresentationUpdateCallback();
webView.dispatchPendingNextPresentationUpdateCallbacks();
}), this);
}
}
Expand Down
5 changes: 4 additions & 1 deletion Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include "WPEWebView.h"
#include <wpe/wpe-platform.h>
#include <wtf/HashMap.h>
#include <wtf/Vector.h>
#include <wtf/glib/GRefPtr.h>

namespace WebKit {
Expand Down Expand Up @@ -81,14 +82,16 @@ class ViewPlatform final : public View {
Vector<WebKit::WebPlatformTouchPoint> touchPointsForEvent(WPEEvent*);
#endif

void dispatchPendingNextPresentationUpdateCallbacks();

gboolean handleEvent(WPEEvent*);
void handleGesture(WPEEvent*);

GRefPtr<WPEView> m_wpeView;
RefPtr<WebKit::AcceleratedBackingStoreDMABuf> m_backingStore;
uint32_t m_displayID { 0 };
unsigned long m_bufferRenderedID { 0 };
CompletionHandler<void()> m_nextPresentationUpdateCallback;
Vector<CompletionHandler<void()>> m_nextPresentationUpdateCallbacks;
HashMap<uint32_t, GRefPtr<WPEEvent>, IntHash<uint32_t>, WTF::UnsignedWithZeroKeyHashTraits<uint32_t>> m_touchEvents;
#if ENABLE(FULLSCREEN_API)
bool m_viewWasAlreadyInFullScreen { false };
Expand Down