Bug 1016573 - Put logging of APZ test data behind a pref. r=kats

This commit is contained in:
Botond Ballo 2014-05-29 12:51:28 -04:00
parent caf4b2134b
commit 1897fda700
8 changed files with 41 additions and 10 deletions

View File

@ -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 <algorithm> // 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);

View File

@ -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

View File

@ -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,

View File

@ -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);

View File

@ -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<LayerManager> lm = aPresShell->GetPresContext()->GetRootPresContext()
->GetPresShell()->GetLayerManager();

View File

@ -27,6 +27,7 @@
#include "mozilla/gfx/2D.h"
#include "Units.h"
#include "mozilla/ToString.h"
#include "gfxPrefs.h"
#include <limits>
#include <algorithm>
@ -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)

View File

@ -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

View File

@ -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);