Skip to content

Commit

Permalink
Bug 1016573 - Put logging of APZ test data behind a pref. r=kats
Browse files Browse the repository at this point in the history
  • Loading branch information
theres-waldo committed May 29, 2014
1 parent caf4b21 commit 1897fda
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 10 deletions.
9 changes: 6 additions & 3 deletions gfx/layers/apz/src/APZCTreeManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);

Expand Down
3 changes: 3 additions & 0 deletions gfx/layers/apz/src/AsyncPanZoomController.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions gfx/layers/client/ClientLayerManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ class ClientLayerManager : public LayerManager
{
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,
Expand Down
1 change: 1 addition & 0 deletions gfx/thebes/gfxPrefs.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class gfxPrefs MOZ_FINAL
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);
Expand Down
8 changes: 4 additions & 4 deletions layout/base/nsLayoutUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
21 changes: 18 additions & 3 deletions layout/base/nsLayoutUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "mozilla/gfx/2D.h"
#include "Units.h"
#include "mozilla/ToString.h"
#include "gfxPrefs.h"

#include <limits>
#include <algorithm>
Expand Down Expand Up @@ -2184,7 +2185,11 @@ class nsLayoutUtils
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
Expand All @@ -2196,8 +2201,10 @@ class nsLayoutUtils
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));
}
}

/**
Expand Down Expand Up @@ -2231,6 +2238,14 @@ class nsLayoutUtils
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)
Expand Down
3 changes: 3 additions & 0 deletions modules/libpref/src/init/all.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions testing/profiles/prefs_general.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);

0 comments on commit 1897fda

Please sign in to comment.