diff --git a/gfx/layers/apz/src/APZCTreeManager.cpp b/gfx/layers/apz/src/APZCTreeManager.cpp index 9c0572efb904..9cf18ea1ba63 100644 --- a/gfx/layers/apz/src/APZCTreeManager.cpp +++ b/gfx/layers/apz/src/APZCTreeManager.cpp @@ -22,6 +22,7 @@ #include "nsThreadUtils.h" // for NS_IsMainThread #include "mozilla/gfx/Logging.h" // for gfx::TreeLog #include "UnitTransforms.h" // for ViewAs +#include "gfxPrefs.h" // for gfxPrefs #include // for std::stable_sort @@ -127,9 +128,11 @@ APZCTreeManager::UpdatePanZoomControllerTree(CompositorParent* aCompositor, // For testing purposes, we log some data to the APZTestData associated with // the layers id that originated this update. APZTestData* testData = nullptr; - if (CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aOriginatingLayersId)) { - testData = &state->mApzTestData; - testData->StartNewPaint(aPaintSequenceNumber); + if (gfxPrefs::APZTestLoggingEnabled()) { + if (CompositorParent::LayerTreeState* state = CompositorParent::GetIndirectShadowTree(aOriginatingLayersId)) { + testData = &state->mApzTestData; + testData->StartNewPaint(aPaintSequenceNumber); + } } APZPaintLogHelper paintLogger(testData, aPaintSequenceNumber); diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 4b1e71e4a0be..f75eb887fe59 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -228,6 +228,9 @@ typedef GeckoContentController::APZStateChange APZStateChange; * Maximum amount of time while panning before sending a viewport change. This * will asynchronously repaint the page. It is also forced when panning stops. * + * "apz.test.logging_enabled" + * Enable logging of APZ test data (see bug 961289). + * * "apz.touch_start_tolerance" * Constant describing the tolerance in distance we use, multiplied by the * device DPI, before we start panning the screen. This is to prevent us from diff --git a/gfx/layers/client/ClientLayerManager.h b/gfx/layers/client/ClientLayerManager.h index 9b541f3ea1c7..958a59407da8 100644 --- a/gfx/layers/client/ClientLayerManager.h +++ b/gfx/layers/client/ClientLayerManager.h @@ -190,6 +190,9 @@ public: { mApzTestData.StartNewRepaintRequest(aSequenceNumber); } + // TODO(botond): When we start using this and write a wrapper similar to + // nsLayoutUtils::LogTestDataForPaint(), make sure that wrapper checks + // gfxPrefs::APZTestLoggingEnabled(). void LogTestDataForRepaintRequest(SequenceNumber aSequenceNumber, FrameMetrics::ViewID aScrollId, const std::string& aKey, diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index f80aec2942e1..9fc20f09b545 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -126,6 +126,7 @@ private: DECL_GFX_PREF(Live, "apz.overscroll.snap_back_init_vel", APZSnapBackInitialVelocity, float, 1.0f); DECL_GFX_PREF(Live, "apz.pan_repaint_interval", APZPanRepaintInterval, int32_t, 250); DECL_GFX_PREF(Live, "apz.subframe.enabled", APZSubframeEnabled, bool, false); + DECL_GFX_PREF(Once, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false); DECL_GFX_PREF(Live, "apz.touch_start_tolerance", APZTouchStartTolerance, float, 1.0f/4.5f); DECL_GFX_PREF(Live, "apz.use_paint_duration", APZUsePaintDuration, bool, true); DECL_GFX_PREF(Live, "apz.velocity_bias", APZVelocityBias, float, 1.0f); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 70a5e3edd2d7..2a248e6e5954 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -6577,10 +6577,10 @@ nsLayoutUtils::WantSubAPZC() } /* static */ void -nsLayoutUtils::LogTestDataForPaint(nsIPresShell* aPresShell, - ViewID aScrollId, - const std::string& aKey, - const std::string& aValue) +nsLayoutUtils::DoLogTestDataForPaint(nsIPresShell* aPresShell, + ViewID aScrollId, + const std::string& aKey, + const std::string& aValue) { nsRefPtr lm = aPresShell->GetPresContext()->GetRootPresContext() ->GetPresShell()->GetLayerManager(); diff --git a/layout/base/nsLayoutUtils.h b/layout/base/nsLayoutUtils.h index 670d2f7a1b0e..b4534ccaf88d 100644 --- a/layout/base/nsLayoutUtils.h +++ b/layout/base/nsLayoutUtils.h @@ -27,6 +27,7 @@ #include "mozilla/gfx/2D.h" #include "Units.h" #include "mozilla/ToString.h" +#include "gfxPrefs.h" #include #include @@ -2184,7 +2185,11 @@ public: static void LogTestDataForPaint(nsIPresShell* aPresShell, ViewID aScrollId, const std::string& aKey, - const std::string& aValue); + const std::string& aValue) { + if (gfxPrefs::APZTestLoggingEnabled()) { + DoLogTestDataForPaint(aPresShell, aScrollId, aKey, aValue); + } + } /** * A convenience overload of LogTestDataForPaint() that accepts any type @@ -2196,8 +2201,10 @@ public: ViewID aScrollId, const std::string& aKey, const Value& aValue) { - LogTestDataForPaint(aPresShell, aScrollId, aKey, - mozilla::ToString(aValue)); + if (gfxPrefs::APZTestLoggingEnabled()) { + DoLogTestDataForPaint(aPresShell, aScrollId, aKey, + mozilla::ToString(aValue)); + } } /** @@ -2231,6 +2238,14 @@ private: static bool sInvalidationDebuggingIsEnabled; static bool sCSSVariablesEnabled; static bool sInterruptibleReflowEnabled; + + /** + * Helper function for LogTestDataForPaint(). + */ + static void DoLogTestDataForPaint(nsIPresShell* aPresShell, + ViewID aScrollId, + const std::string& aKey, + const std::string& aValue); }; MOZ_FINISH_NESTED_ENUM_CLASS(nsLayoutUtils::RepaintMode) diff --git a/modules/libpref/src/init/all.js b/modules/libpref/src/init/all.js index 7b4b7bf3bb0b..76122ebcbec3 100644 --- a/modules/libpref/src/init/all.js +++ b/modules/libpref/src/init/all.js @@ -371,6 +371,9 @@ pref("apz.printtree", false); // Layerize scrollable subframes to allow async panning pref("apz.subframe.enabled", false); +// APZ testing (bug 961289) +pref("apz.test.logging_enabled", false); + #ifdef XP_MACOSX // Whether to run in native HiDPI mode on machines with "Retina"/HiDPI display; // <= 0 : hidpi mode disabled, display will just use pixel-based upscaling diff --git a/testing/profiles/prefs_general.js b/testing/profiles/prefs_general.js index c56052b2ca49..cb97283aaac9 100644 --- a/testing/profiles/prefs_general.js +++ b/testing/profiles/prefs_general.js @@ -190,3 +190,6 @@ user_pref('toolkit.telemetry.server', 'https://%(server)s/telemetry-dummy/'); // actually need a functioning FxA server, so just set it to something that // resolves and accepts requests, even if they all fail. user_pref('identity.fxaccounts.auth.uri', 'https://%(server)s/fxa-dummy/'); + +// Enable logging of APZ test data (see bug 961289). +user_pref('apz.test.logging_enabled', true);