diff options
Diffstat (limited to 'Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h')
-rw-r--r-- | Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h | 79 |
1 files changed, 28 insertions, 51 deletions
diff --git a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h index 224ea9109..89c713fc8 100644 --- a/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h +++ b/Source/WebKit2/UIProcess/DrawingAreaProxyImpl.h @@ -26,10 +26,9 @@ #ifndef DrawingAreaProxyImpl_h #define DrawingAreaProxyImpl_h +#include "AcceleratedDrawingAreaProxy.h" #include "BackingStore.h" #include "DrawingAreaProxy.h" -#include "LayerTreeContext.h" -#include <wtf/OwnPtr.h> #include <wtf/RunLoop.h> namespace WebCore { @@ -38,77 +37,55 @@ class Region; namespace WebKit { -class DrawingAreaProxyImpl : public DrawingAreaProxy { +class DrawingAreaProxyImpl final : public AcceleratedDrawingAreaProxy { public: - explicit DrawingAreaProxyImpl(WebPageProxy*); + explicit DrawingAreaProxyImpl(WebPageProxy&); virtual ~DrawingAreaProxyImpl(); void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion); -#if USE(ACCELERATED_COMPOSITING) - bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); } -#endif - - bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; } - private: // DrawingAreaProxy - virtual void sizeDidChange(); - virtual void deviceScaleFactorDidChange(); - - virtual void setBackingStoreIsDiscardable(bool); - virtual void waitForBackingStoreUpdateOnNextPaint(); + void setBackingStoreIsDiscardable(bool) override; // IPC message handlers - virtual void update(uint64_t backingStoreStateID, const UpdateInfo&); - virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&); - virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&); - virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&); - virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&); + void update(uint64_t backingStoreStateID, const UpdateInfo&) override; + void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&) override; + void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) override; void incorporateUpdate(const UpdateInfo&); - enum RespondImmediatelyOrNot { DoNotRespondImmediately, RespondImmediately }; - void backingStoreStateDidChange(RespondImmediatelyOrNot); - void sendUpdateBackingStoreState(RespondImmediatelyOrNot); - void waitForAndDispatchDidUpdateBackingStoreState(); - -#if USE(ACCELERATED_COMPOSITING) - void enterAcceleratedCompositingMode(const LayerTreeContext&); - void exitAcceleratedCompositingMode(); - void updateAcceleratedCompositingMode(const LayerTreeContext&); -#else - bool isInAcceleratedCompositingMode() const { return false; } -#endif + void enterAcceleratedCompositingMode(const LayerTreeContext&) override; void discardBackingStoreSoon(); void discardBackingStore(); - // The state ID corresponding to our current backing store. Updated whenever we allocate - // a new backing store. Any messages received that correspond to an earlier state are ignored, - // as they don't apply to our current backing store. - uint64_t m_currentBackingStoreStateID; + void dispatchAfterEnsuringDrawing(std::function<void(CallbackBase::Error)>) override; - // The next backing store state ID we will request the web process update to. Incremented - // whenever our state changes in a way that will require a new backing store to be allocated. - uint64_t m_nextBackingStoreStateID; + class DrawingMonitor { + WTF_MAKE_NONCOPYABLE(DrawingMonitor); WTF_MAKE_FAST_ALLOCATED; + public: + DrawingMonitor(WebPageProxy&); + ~DrawingMonitor(); -#if USE(ACCELERATED_COMPOSITING) - // The current layer tree context. - LayerTreeContext m_layerTreeContext; -#endif + void start(std::function<void (CallbackBase::Error)>); - // Whether we've sent a UpdateBackingStoreState message and are now waiting for a DidUpdateBackingStoreState message. - // Used to throttle UpdateBackingStoreState messages so we don't send them faster than the Web process can handle. - bool m_isWaitingForDidUpdateBackingStoreState; - - // For a new Drawing Area don't draw anything until the WebProcess has sent over the first content. - bool m_hasReceivedFirstUpdate; + private: + static int webViewDrawCallback(DrawingMonitor*); - bool m_isBackingStoreDiscardable; - std::unique_ptr<BackingStore> m_backingStore; + void stop(); + void didDraw(); + + WebPageProxy& m_webPage; + double m_startTime { 0 }; + std::function<void (CallbackBase::Error)> m_callback; + RunLoop::Timer<DrawingMonitor> m_timer; + }; + bool m_isBackingStoreDiscardable { true }; + std::unique_ptr<BackingStore> m_backingStore; RunLoop::Timer<DrawingAreaProxyImpl> m_discardBackingStoreTimer; + std::unique_ptr<DrawingMonitor> m_drawingMonitor; }; } // namespace WebKit |