From a3d47ba1cdb2ab46bac8f71a574c3788074d212f Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 25 Sep 2015 13:54:11 -0400 Subject: [PATCH] Bug 1207270 - Update tests to ensure that TaskThrottlers are created as appropriate. r=botond --HG-- extra : commitid : LcF5dobJwsF --- .../test/gtest/TestAsyncPanZoomController.cpp | 38 +++++++++---------- gfx/layers/ipc/CompositorParent.cpp | 4 +- gfx/layers/ipc/CompositorParent.h | 3 +- 3 files changed, 24 insertions(+), 21 deletions(-) diff --git a/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp b/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp index 258e47d0644c..3f5a51c28d46 100644 --- a/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/layers/apz/test/gtest/TestAsyncPanZoomController.cpp @@ -2113,7 +2113,7 @@ protected: // A simple hit testing test that doesn't involve any transforms on layers. TEST_F(APZHitTestingTester, HitTesting1) { CreateHitTesting1LayerTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); // No APZC attached so hit testing will return no APZC at (20,20) nsRefPtr hit = GetTargetAPZC(ScreenPoint(20, 20)); @@ -2178,7 +2178,7 @@ TEST_F(APZHitTestingTester, HitTesting1) { // A more involved hit testing test that involves css and async transforms. TEST_F(APZHitTestingTester, HitTesting2) { CreateHitTesting2LayerTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); @@ -2290,7 +2290,7 @@ TEST_F(APZHitTestingTester, HitTesting2) { TEST_F(APZCTreeManagerTester, ScrollablePaintedLayers) { CreateSimpleMultiLayerTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); // both layers have the same scrollId SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID); @@ -2318,7 +2318,7 @@ TEST_F(APZCTreeManagerTester, ScrollablePaintedLayers) { TEST_F(APZCTreeManagerTester, Bug1068268) { CreatePotentiallyLeakingTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); nsRefPtr root = manager->GetRootNode(); @@ -2340,7 +2340,7 @@ TEST_F(APZCTreeManagerTester, Bug1068268) { TEST_F(APZCTreeManagerTester, Bug1194876) { CreateBug1194876Tree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); uint64_t blockId; @@ -2378,7 +2378,7 @@ TEST_F(APZCTreeManagerTester, Bug1198900) { // This is just a test that cancels a wheel event to make sure it doesn't // crash. CreateSimpleDTCScrollingLayer(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); ScreenPoint origin(100, 50); @@ -2392,7 +2392,7 @@ TEST_F(APZCTreeManagerTester, Bug1198900) { TEST_F(APZHitTestingTester, ComplexMultiLayerTree) { CreateComplexMultiLayerTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); /* The layer tree looks like this: @@ -2482,7 +2482,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnNewInputBlock) { // and the transform to gecko space should be empty. CreateSimpleScrollingLayer(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); TestAsyncPanZoomController* apzcroot = ApzcOf(root); @@ -2547,7 +2547,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) { // flush as per bug 1166871, and that the wheel event untransform is a no-op. CreateSimpleScrollingLayer(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); TestAsyncPanZoomController* apzcroot = ApzcOf(root); @@ -2574,7 +2574,7 @@ TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) { TEST_F(APZHitTestingTester, Bug1148350) { CreateBug1148350LayerTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); MockFunction check; @@ -2621,7 +2621,7 @@ protected: SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 200, 200)); SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 100, 100)); SetScrollHandoff(layers[1], root); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); rootApzc = ApzcOf(root); } @@ -2662,7 +2662,7 @@ protected: SetScrollableFrameMetrics(layers[4], FrameMetrics::START_SCROLL_ID + 3, CSSRect(0, 50, 100, 100)); SetScrollHandoff(layers[2], layers[1]); SetScrollHandoff(layers[4], layers[3]); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); } @@ -2677,7 +2677,7 @@ protected: SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID, CSSRect(0, 0, 100, parentHeight)); SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1, CSSRect(0, 0, 100, 200)); SetScrollHandoff(layers[1], root); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); rootApzc = ApzcOf(root); rootApzc->GetFrameMetrics().SetHasScrollgrab(true); @@ -2963,7 +2963,7 @@ protected: regions.mHitRegion = nsIntRegion(IntRect(0, 100, 200, 100)); layers[2]->SetEventRegions(regions); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); rootApzc = ApzcOf(root); } @@ -2984,7 +2984,7 @@ protected: regions.mHitRegion = nsIntRegion(IntRect(0, 150, 100, 100)); layers[1]->SetEventRegions(regions); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); rootApzc = ApzcOf(root); } @@ -3018,7 +3018,7 @@ protected: regions.mHitRegion = nsIntRegion(IntRect(0, 100, 200, 100)); layers[2]->SetEventRegions(regions); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); rootApzc = ApzcOf(root); } @@ -3040,7 +3040,7 @@ protected: SetScrollableFrameMetrics(root, FrameMetrics::START_SCROLL_ID); SetScrollableFrameMetrics(layers[1], FrameMetrics::START_SCROLL_ID + 1); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); } @@ -3076,7 +3076,7 @@ protected: regions.mDispatchToContentHitRegion = nsIntRegion(IntRect(0, 0, 100, 100)); layers[3]->SetEventRegions(regions); - registration = MakeUnique(0, root, mcc); + registration = MakeUnique(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); } }; @@ -3148,7 +3148,7 @@ TEST_F(APZEventRegionsTester, HitRegionAccumulatesChildren) { TEST_F(APZEventRegionsTester, Obscuration) { CreateObscuringLayerTree(); - ScopedLayerTreeRegistration registration(0, root, mcc); + ScopedLayerTreeRegistration registration(manager, 0, root, mcc); manager->UpdateHitTestingTree(nullptr, root, false, 0, 0); diff --git a/gfx/layers/ipc/CompositorParent.cpp b/gfx/layers/ipc/CompositorParent.cpp index e7695f3cc2ef..921ad3373852 100644 --- a/gfx/layers/ipc/CompositorParent.cpp +++ b/gfx/layers/ipc/CompositorParent.cpp @@ -1541,12 +1541,14 @@ UpdateControllerForLayersId(uint64_t aLayersId, already_AddRefed(aController); } -ScopedLayerTreeRegistration::ScopedLayerTreeRegistration(uint64_t aLayersId, +ScopedLayerTreeRegistration::ScopedLayerTreeRegistration(APZCTreeManager* aApzctm, + uint64_t aLayersId, Layer* aRoot, GeckoContentController* aController) : mLayersId(aLayersId) { EnsureLayerTreeMapReady(); + aApzctm->InitializeForLayersId(aLayersId); MonitorAutoLock lock(*sIndirectLayerTreesLock); sIndirectLayerTrees[aLayersId].mRoot = aRoot; sIndirectLayerTrees[aLayersId].mController = aController; diff --git a/gfx/layers/ipc/CompositorParent.h b/gfx/layers/ipc/CompositorParent.h index 4ac9e3d085ba..8c0e429e8a74 100644 --- a/gfx/layers/ipc/CompositorParent.h +++ b/gfx/layers/ipc/CompositorParent.h @@ -57,7 +57,8 @@ class LayerTransactionParent; struct ScopedLayerTreeRegistration { - ScopedLayerTreeRegistration(uint64_t aLayersId, + ScopedLayerTreeRegistration(APZCTreeManager* aApzctm, + uint64_t aLayersId, Layer* aRoot, GeckoContentController* aController); ~ScopedLayerTreeRegistration();