diff --git a/dom/base/nsDOMWindowUtils.cpp b/dom/base/nsDOMWindowUtils.cpp index 718a532d6461..73d86550e140 100644 --- a/dom/base/nsDOMWindowUtils.cpp +++ b/dom/base/nsDOMWindowUtils.cpp @@ -24,7 +24,6 @@ #include "nsIObjectLoadingContent.h" #include "nsFrame.h" #include "mozilla/layers/ShadowLayers.h" -#include "mozilla/layers/APZCCallbackHelper.h" #include "ClientLayerManager.h" #include "nsQueryObject.h" #ifdef MOZ_FMP4 @@ -2456,35 +2455,6 @@ nsDOMWindowUtils::SetAsyncScrollOffset(nsIDOMNode* aNode, return NS_OK; } -NS_IMETHODIMP -nsDOMWindowUtils::FlushApzRepaints(bool* aOutResult) -{ - nsIWidget* widget = GetWidget(); - if (!widget) { - *aOutResult = false; - return NS_OK; - } - // If APZ is not enabled, this function is a no-op. After bug 1162064 this - // should be a widget->IsAsyncPanZoomEnabled() check. - if (!gfxPrefs::AsyncPanZoomEnabled()) { - *aOutResult = false; - return NS_OK; - } - LayerManager* manager = widget->GetLayerManager(); - if (!manager) { - *aOutResult = false; - return NS_OK; - } - ShadowLayerForwarder* forwarder = manager->AsShadowForwarder(); - if (!forwarder || !forwarder->HasShadowManager()) { - *aOutResult = false; - return NS_OK; - } - forwarder->GetShadowManager()->SendFlushApzRepaints(); - *aOutResult = true; - return NS_OK; -} - NS_IMETHODIMP nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement, const nsAString& aProperty, diff --git a/dom/interfaces/base/nsIDOMWindowUtils.idl b/dom/interfaces/base/nsIDOMWindowUtils.idl index 1edb636170fa..72602da9f868 100644 --- a/dom/interfaces/base/nsIDOMWindowUtils.idl +++ b/dom/interfaces/base/nsIDOMWindowUtils.idl @@ -49,7 +49,7 @@ interface nsIJSRAIIHelper; interface nsIContentPermissionRequest; interface nsIObserver; -[scriptable, uuid(663e4d9a-c963-4949-b68e-3a6f71c0414f)] +[scriptable, uuid(0ce789cc-3fb6-48b8-a58e-32deefc337b4)] interface nsIDOMWindowUtils : nsISupports { /** @@ -1428,16 +1428,6 @@ interface nsIDOMWindowUtils : nsISupports { */ void setAsyncScrollOffset(in nsIDOMNode aNode, in int32_t aX, in int32_t aY); - /** - * Do a round-trip to the compositor to ensure any pending APZ repaint requests - * get flushed to the main thread. If the function returns true, the flush was - * triggered and an "apz-repaints-flushed" notification will be dispatched via - * the observer service once the flush is complete. If the function returns - * false, an error occurred or a flush is not needed, and the notification - * will not fire. This is intended to be used by test code only! - */ - bool flushApzRepaints(); - /** * Method for testing StyleAnimationValue::ComputeDistance. * diff --git a/dom/ipc/PBrowser.ipdl b/dom/ipc/PBrowser.ipdl index 4ad50026973f..29cb07c5a22b 100644 --- a/dom/ipc/PBrowser.ipdl +++ b/dom/ipc/PBrowser.ipdl @@ -589,7 +589,6 @@ child: HandleSingleTap(CSSPoint aPoint, Modifiers aModifiers, ScrollableLayerGuid aGuid); HandleLongTap(CSSPoint point, Modifiers aModifiers, ScrollableLayerGuid aGuid, uint64_t aInputBlockId); NotifyAPZStateChange(ViewID aViewId, APZStateChange aChange, int aArg); - NotifyFlushComplete(); /** diff --git a/dom/ipc/TabChild.cpp b/dom/ipc/TabChild.cpp index eb2a3f9e762b..f6c37981eaf2 100644 --- a/dom/ipc/TabChild.cpp +++ b/dom/ipc/TabChild.cpp @@ -2138,13 +2138,6 @@ TabChild::RecvNotifyAPZStateChange(const ViewID& aViewId, return true; } -bool -TabChild::RecvNotifyFlushComplete() -{ - APZCCallbackHelper::NotifyFlushComplete(); - return true; -} - bool TabChild::RecvActivate() { diff --git a/dom/ipc/TabChild.h b/dom/ipc/TabChild.h index 9039079715b6..a69368a24b25 100644 --- a/dom/ipc/TabChild.h +++ b/dom/ipc/TabChild.h @@ -342,7 +342,6 @@ public: virtual bool RecvNotifyAPZStateChange(const ViewID& aViewId, const APZStateChange& aChange, const int& aArg) override; - virtual bool RecvNotifyFlushComplete() override; virtual bool RecvActivate() override; virtual bool RecvDeactivate() override; virtual bool RecvMouseEvent(const nsString& aType, diff --git a/dom/ipc/TabParent.cpp b/dom/ipc/TabParent.cpp index c51b3f3cf5df..300f4c4471e0 100644 --- a/dom/ipc/TabParent.cpp +++ b/dom/ipc/TabParent.cpp @@ -1069,14 +1069,6 @@ TabParent::NotifyMouseScrollTestEvent(const ViewID& aScrollId, const nsString& a } } -void -TabParent::NotifyFlushComplete() -{ - if (!mIsDestroyed) { - unused << SendNotifyFlushComplete(); - } -} - void TabParent::Activate() { diff --git a/dom/ipc/TabParent.h b/dom/ipc/TabParent.h index 0d36160e048c..81e0c7e1654b 100644 --- a/dom/ipc/TabParent.h +++ b/dom/ipc/TabParent.h @@ -274,7 +274,6 @@ public: APZStateChange aChange, int aArg); void NotifyMouseScrollTestEvent(const ViewID& aScrollId, const nsString& aEvent); - void NotifyFlushComplete(); void Activate(); void Deactivate(); diff --git a/gfx/layers/apz/public/GeckoContentController.h b/gfx/layers/apz/public/GeckoContentController.h index 6673516c55ab..9756f8e95294 100644 --- a/gfx/layers/apz/public/GeckoContentController.h +++ b/gfx/layers/apz/public/GeckoContentController.h @@ -158,11 +158,6 @@ public: virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent) {} - /** - * Notify content that the repaint requests have been flushed. - */ - virtual void NotifyFlushComplete() = 0; - GeckoContentController() {} virtual void Destroy() {} diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index b510dcd5a08d..7e68e177a1b4 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -554,19 +554,6 @@ APZCTreeManager::UpdateHitTestingTree(TreeBuildingState& aState, return node; } -void -APZCTreeManager::FlushApzRepaints(uint64_t aLayersId) -{ - { // scope lock - MonitorAutoLock lock(mTreeLock); - FlushPendingRepaintRecursively(mRootNode, aLayersId); - } - const CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aLayersId); - MOZ_ASSERT(state && state->mController); - NS_DispatchToMainThread(NS_NewRunnableMethod( - state->mController.get(), &GeckoContentController::NotifyFlushComplete)); -} - nsEventStatus APZCTreeManager::ReceiveInputEvent(InputData& aEvent, ScrollableLayerGuid* aOutTargetGuid, @@ -1084,23 +1071,6 @@ APZCTreeManager::FlushRepaintsRecursively(HitTestingTreeNode* aNode) } } -void -APZCTreeManager::FlushPendingRepaintRecursively(HitTestingTreeNode* aNode, uint64_t aLayersId) -{ - mTreeLock.AssertCurrentThreadOwns(); - - for (HitTestingTreeNode* node = aNode; node; node = node->GetPrevSibling()) { - if (node->IsPrimaryHolder()) { - AsyncPanZoomController* apzc = node->GetApzc(); - MOZ_ASSERT(apzc); - if (apzc->GetGuid().mLayersId == aLayersId) { - apzc->FlushRepaintIfPending(); - } - } - FlushPendingRepaintRecursively(node->GetLastChild(), aLayersId); - } -} - void APZCTreeManager::CancelAnimation(const ScrollableLayerGuid &aGuid) { diff --git a/gfx/layers/apz/src/APZCTreeManager.h b/gfx/layers/apz/src/APZCTreeManager.h index 3819f89ab8b6..5403e1fa4776 100644 --- a/gfx/layers/apz/src/APZCTreeManager.h +++ b/gfx/layers/apz/src/APZCTreeManager.h @@ -130,13 +130,6 @@ public: uint64_t aOriginatingLayersId, uint32_t aPaintSequenceNumber); - /** - * Walk the tree of APZCs and flushes the repaint requests for all the APZCS - * corresponding to the given layers id. Finally, sends a flush complete - * notification to the GeckoContentController for the layers id. - */ - void FlushApzRepaints(uint64_t aLayersId); - /** * General handler for incoming input events. Manipulates the frame metrics * based on what type of input it is. For example, a PinchGestureEvent will @@ -437,7 +430,6 @@ private: void UpdateZoomConstraintsRecursively(HitTestingTreeNode* aNode, const ZoomConstraints& aConstraints); void FlushRepaintsRecursively(HitTestingTreeNode* aNode); - void FlushPendingRepaintRecursively(HitTestingTreeNode* aNode, uint64_t aLayersId); already_AddRefed RecycleOrCreateNode(TreeBuildingState& aState, AsyncPanZoomController* aApzc); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 4e2d67fe9f24..9c1dc5601e7c 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -2446,13 +2446,6 @@ void AsyncPanZoomController::FlushRepaintForNewInputBlock() { UpdateSharedCompositorFrameMetrics(); } -void AsyncPanZoomController::FlushRepaintIfPending() { - // Just tell the paint throttler to send the pending repaint request if - // there is one. - ReentrantMonitorAutoEnter lock(mMonitor); - mPaintThrottler.TaskComplete(GetFrameTime()); -} - bool AsyncPanZoomController::SnapBackIfOverscrolled() { ReentrantMonitorAutoEnter lock(mMonitor); // It's possible that we're already in the middle of an overscroll diff --git a/gfx/layers/apz/src/AsyncPanZoomController.h b/gfx/layers/apz/src/AsyncPanZoomController.h index cd64c5fa9621..ba756ef40a8c 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.h +++ b/gfx/layers/apz/src/AsyncPanZoomController.h @@ -183,11 +183,6 @@ public: */ void NotifyLayersUpdated(const FrameMetrics& aLayerMetrics, bool aIsFirstPaint); - /** - * Flush any pending repaint request. - */ - void FlushRepaintIfPending(); - /** * The platform implementation must set the compositor parent so that we can * request composites. diff --git a/gfx/layers/apz/util/APZCCallbackHelper.cpp b/gfx/layers/apz/util/APZCCallbackHelper.cpp index a7de7efd1be5..4db76d7f03df 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -710,15 +710,6 @@ APZCCallbackHelper::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrol true, true); } -void -APZCCallbackHelper::NotifyFlushComplete() -{ - MOZ_ASSERT(NS_IsMainThread()); - nsCOMPtr observerService = mozilla::services::GetObserverService(); - MOZ_ASSERT(observerService); - observerService->NotifyObservers(nullptr, "apz-repaints-flushed", nullptr); -} - } } diff --git a/gfx/layers/apz/util/APZCCallbackHelper.h b/gfx/layers/apz/util/APZCCallbackHelper.h index 171e0ea09c55..396d28f3ee2d 100644 --- a/gfx/layers/apz/util/APZCCallbackHelper.h +++ b/gfx/layers/apz/util/APZCCallbackHelper.h @@ -161,9 +161,6 @@ public: /* Notify content of a mouse scroll testing event. */ static void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent); - - /* Notify content that the repaint flush is complete. */ - static void NotifyFlushComplete(); }; } diff --git a/gfx/layers/apz/util/ChromeProcessController.cpp b/gfx/layers/apz/util/ChromeProcessController.cpp index 1f7d02d71b16..f60cae1f30a7 100644 --- a/gfx/layers/apz/util/ChromeProcessController.cpp +++ b/gfx/layers/apz/util/ChromeProcessController.cpp @@ -213,10 +213,3 @@ ChromeProcessController::NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& a APZCCallbackHelper::NotifyMozMouseScrollEvent(aScrollId, aEvent); } - -void -ChromeProcessController::NotifyFlushComplete() -{ - MOZ_ASSERT(NS_IsMainThread()); - APZCCallbackHelper::NotifyFlushComplete(); -} diff --git a/gfx/layers/apz/util/ChromeProcessController.h b/gfx/layers/apz/util/ChromeProcessController.h index 0678afde0996..19e301d1f3e9 100644 --- a/gfx/layers/apz/util/ChromeProcessController.h +++ b/gfx/layers/apz/util/ChromeProcessController.h @@ -56,7 +56,6 @@ public: int aArg) override; virtual void NotifyMozMouseScrollEvent(const FrameMetrics::ViewID& aScrollId, const nsString& aEvent) override; - virtual void NotifyFlushComplete() override; private: nsCOMPtr mWidget; nsRefPtr mAPZEventState; diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index 4a213bc8426f..787bd0f9cbea 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -1326,13 +1326,6 @@ CompositorParent::RecvRequestOverfill() return true; } -void -CompositorParent::FlushApzRepaints(const LayerTransactionParent* aLayerTree) -{ - MOZ_ASSERT(mApzcTreeManager); - mApzcTreeManager->FlushApzRepaints(aLayerTree->GetId()); -} - void CompositorParent::GetAPZTestData(const LayerTransactionParent* aLayerTree, APZTestData* aOutData) @@ -1741,7 +1734,6 @@ public: virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) override; virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) override; - virtual void FlushApzRepaints(const LayerTransactionParent* aLayerTree) override; virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree, APZTestData* aOutData) override; virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree, @@ -2154,21 +2146,6 @@ CrossProcessCompositorParent::ApplyAsyncProperties( state->mParent->ApplyAsyncProperties(aLayerTree); } -void -CrossProcessCompositorParent::FlushApzRepaints(const LayerTransactionParent* aLayerTree) -{ - uint64_t id = aLayerTree->GetId(); - MOZ_ASSERT(id != 0); - const CompositorParent::LayerTreeState* state = - CompositorParent::GetIndirectShadowTree(id); - if (!state) { - return; - } - - MOZ_ASSERT(state->mParent); - state->mParent->FlushApzRepaints(aLayerTree); -} - void CrossProcessCompositorParent::GetAPZTestData(const LayerTransactionParent* aLayerTree, APZTestData* aOutData) diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index e28db7ed3d8a..bedf15d0554c 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -268,7 +268,6 @@ public: virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) override; virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) override; - virtual void FlushApzRepaints(const LayerTransactionParent* aLayerTree) override; virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree, APZTestData* aOutData) override; virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree, diff --git a/gfx/layers/ipc/LayerTransactionParent.cpp b/gfx/layers/ipc/LayerTransactionParent.cpp index f811b6d9df66..8fde530862fe 100644 --- a/gfx/layers/ipc/LayerTransactionParent.cpp +++ b/gfx/layers/ipc/LayerTransactionParent.cpp @@ -783,13 +783,6 @@ LayerTransactionParent::RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aSc return true; } -bool -LayerTransactionParent::RecvFlushApzRepaints() -{ - mShadowLayersManager->FlushApzRepaints(this); - return true; -} - bool LayerTransactionParent::RecvGetAPZTestData(APZTestData* aOutData) { diff --git a/gfx/layers/ipc/LayerTransactionParent.h b/gfx/layers/ipc/LayerTransactionParent.h index 79c1796fbe25..d63a3117d6b9 100644 --- a/gfx/layers/ipc/LayerTransactionParent.h +++ b/gfx/layers/ipc/LayerTransactionParent.h @@ -133,7 +133,6 @@ protected: override; virtual bool RecvSetAsyncScrollOffset(const FrameMetrics::ViewID& aId, const int32_t& aX, const int32_t& aY) override; - virtual bool RecvFlushApzRepaints() override; virtual bool RecvGetAPZTestData(APZTestData* aOutData) override; virtual bool RecvRequestProperty(const nsString& aProperty, float* aValue) override; virtual bool RecvSetConfirmedTargetAPZC(const uint64_t& aBlockId, diff --git a/gfx/layers/ipc/PLayerTransaction.ipdl b/gfx/layers/ipc/PLayerTransaction.ipdl index f160d15d0241..11a8ac65cf14 100644 --- a/gfx/layers/ipc/PLayerTransaction.ipdl +++ b/gfx/layers/ipc/PLayerTransaction.ipdl @@ -89,9 +89,6 @@ parent: // Useful for testing rendering of async scrolling. sync SetAsyncScrollOffset(ViewID id, int32_t x, int32_t y); - // Flush any pending APZ repaints to the main thread. - async FlushApzRepaints(); - // Drop any front buffers that might be retained on the compositor // side. async ClearCachedResources(); diff --git a/gfx/layers/ipc/ShadowLayersManager.h b/gfx/layers/ipc/ShadowLayersManager.h index a17c5828824b..a11623e27c57 100644 --- a/gfx/layers/ipc/ShadowLayersManager.h +++ b/gfx/layers/ipc/ShadowLayersManager.h @@ -36,7 +36,6 @@ public: const TimeStamp& aTime) { return true; } virtual void LeaveTestMode(LayerTransactionParent* aLayerTree) { } virtual void ApplyAsyncProperties(LayerTransactionParent* aLayerTree) = 0; - virtual void FlushApzRepaints(const LayerTransactionParent* aLayerTree) = 0; virtual void GetAPZTestData(const LayerTransactionParent* aLayerTree, APZTestData* aOutData) { } virtual void SetConfirmedTargetAPZC(const LayerTransactionParent* aLayerTree, diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 1290ec30bff6..61005661135d 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -70,7 +70,6 @@ public: MOCK_METHOD3(SendAsyncScrollDOMEvent, void(bool aIsRoot, const CSSRect &aContentRect, const CSSSize &aScrollableSize)); MOCK_METHOD2(PostDelayedTask, void(Task* aTask, int aDelayMs)); MOCK_METHOD3(NotifyAPZStateChange, void(const ScrollableLayerGuid& aGuid, APZStateChange aChange, int aArg)); - MOCK_METHOD0(NotifyFlushComplete, void()); }; class MockContentControllerDelayed : public MockContentController { diff --git a/layout/ipc/RenderFrameParent.cpp b/layout/ipc/RenderFrameParent.cpp index 78541cc790b2..52097f26fbf3 100644 --- a/layout/ipc/RenderFrameParent.cpp +++ b/layout/ipc/RenderFrameParent.cpp @@ -270,14 +270,6 @@ public: } } - void NotifyFlushComplete() override { - MOZ_ASSERT(NS_IsMainThread()); - if (mRenderFrame) { - TabParent* browser = TabParent::GetFrom(mRenderFrame->Manager()); - browser->NotifyFlushComplete(); - } - } - // Methods used by RenderFrameParent to set fields stored here. void SaveZoomConstraints(const ZoomConstraints& aConstraints) diff --git a/layout/tools/reftest/reftest-content.js b/layout/tools/reftest/reftest-content.js index 0cebf6a003fb..acf7cf3fff79 100644 --- a/layout/tools/reftest/reftest-content.js +++ b/layout/tools/reftest/reftest-content.js @@ -14,7 +14,6 @@ const XHTML_NS = "http://www.w3.org/1999/xhtml"; const DEBUG_CONTRACTID = "@mozilla.org/xpcom/debug;1"; const PRINTSETTINGS_CONTRACTID = "@mozilla.org/gfx/printsettings-service;1"; const ENVIRONMENT_CONTRACTID = "@mozilla.org/process/environment;1"; -const NS_OBSERVER_SERVICE_CONTRACTID = "@mozilla.org/observer-service;1"; // "" const BLANK_URL_FOR_CLEARING = "data:text/html;charset=UTF-8,%3C%21%2D%2DCLEAR%2D%2D%3E"; @@ -364,13 +363,10 @@ const STATE_WAITING_FOR_REFTEST_WAIT_REMOVAL = 1; // When spell checking is done on all spell-checked elements, we can move to the // next state. const STATE_WAITING_FOR_SPELL_CHECKS = 2; -// When any pending compositor-side repaint requests have been flushed, we can -// move to the next state. -const STATE_WAITING_FOR_APZ_FLUSH = 3; // When all MozAfterPaint events and all explicit paint waits are flushed, we're // done and can move to the COMPLETED state. -const STATE_WAITING_TO_FINISH = 4; -const STATE_COMPLETED = 5; +const STATE_WAITING_TO_FINISH = 3; +const STATE_COMPLETED = 4; function FlushRendering() { var anyPendingPaintsGeneratedInDescendants = false; @@ -536,31 +532,9 @@ function WaitForTestEnd(contentRootElement, inPrintMode, spellCheckedElements) { return; } - state = STATE_WAITING_FOR_APZ_FLUSH; - LogInfo("MakeProgress: STATE_WAITING_FOR_APZ_FLUSH"); - gFailureReason = "timed out waiting for APZ flush to complete"; - - var os = CC[NS_OBSERVER_SERVICE_CONTRACTID].getService(CI.nsIObserverService); - var flushWaiter = function(aSubject, aTopic, aData) { - if (aTopic) LogInfo("MakeProgress: apz-repaints-flushed fired"); - os.removeObserver(flushWaiter, "apz-repaints-flushed"); - state = STATE_WAITING_TO_FINISH; - MakeProgress(); - }; - os.addObserver(flushWaiter, "apz-repaints-flushed", false); - - if (windowUtils().flushApzRepaints()) { - LogInfo("MakeProgress: done requesting APZ flush"); - } else { - LogInfo("MakeProgress: APZ flush not required"); - flushWaiter(null, null, null); - } - return; - - case STATE_WAITING_FOR_APZ_FLUSH: - LogInfo("MakeProgress: STATE_WAITING_FOR_APZ_FLUSH"); - // Nothing to do here; once we get the apz-repaints-flushed event - // we will go to STATE_WAITING_TO_FINISH + state = STATE_WAITING_TO_FINISH; + // Try next state + MakeProgress(); return; case STATE_WAITING_TO_FINISH: