Bug 961289 - Client-side instance of APZ test data and utilities for writing to it. r=tn,kats

--HG--
extra : source : 1462852a44bee091ebf42d48d87e9c0e4acfac0b
This commit is contained in:
Botond Ballo 2014-04-21 19:48:54 -04:00
parent 229a7a632a
commit 6e03af65aa
4 changed files with 74 additions and 1 deletions

View File

@ -164,6 +164,7 @@ ClientLayerManager::BeginTransactionWithTarget(gfxContext* aTarget)
// If this is a new paint, increment the paint sequence number.
if (!mIsRepeatTransaction) {
++mPaintSequenceNumber;
mApzTestData.StartNewPaint(mPaintSequenceNumber);
}
}

View File

@ -16,6 +16,7 @@
#include "mozilla/layers/CompositorTypes.h"
#include "mozilla/layers/LayersTypes.h" // for BufferMode, LayersBackend, etc
#include "mozilla/layers/ShadowLayers.h" // for ShadowLayerForwarder, etc
#include "mozilla/layers/APZTestData.h" // for APZTestData
#include "nsAutoPtr.h" // for nsRefPtr
#include "nsCOMPtr.h" // for already_AddRefed
#include "nsDebug.h" // for NS_ABORT_IF_FALSE
@ -172,6 +173,31 @@ public:
return (GetTextureFactoryIdentifier().mSupportedBlendModes & aMixBlendModes) == aMixBlendModes;
}
// Log APZ test data for the current paint. We supply the paint sequence
// number ourselves, and take care of calling APZTestData::StartNewPaint()
// when a new paint is started.
void LogTestDataForCurrentPaint(FrameMetrics::ViewID aScrollId,
const std::string& aKey,
const std::string& aValue)
{
mApzTestData.LogTestDataForPaint(mPaintSequenceNumber, aScrollId, aKey, aValue);
}
// Log APZ test data for a repaint request. The sequence number must be
// passed in from outside, and APZTestData::StartNewRepaintRequest() needs
// to be called from the outside as well when a new repaint request is started.
void StartNewRepaintRequest(SequenceNumber aSequenceNumber)
{
mApzTestData.StartNewRepaintRequest(aSequenceNumber);
}
void LogTestDataForRepaintRequest(SequenceNumber aSequenceNumber,
FrameMetrics::ViewID aScrollId,
const std::string& aKey,
const std::string& aValue)
{
mApzTestData.LogTestDataForRepaintRequest(aSequenceNumber, aScrollId, aKey, aValue);
}
protected:
enum TransactionPhase {
PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
@ -236,6 +262,8 @@ private:
// Incremented in BeginTransaction(), but not for repeat transactions.
uint32_t mPaintSequenceNumber;
APZTestData mApzTestData;
RefPtr<ShadowLayerForwarder> mForwarder;
nsAutoTArray<RefPtr<TextureClientPool>,2> mTexturePools;
nsAutoTArray<dom::OverfillCallback*,0> mOverfillCallbacks;

View File

@ -77,6 +77,7 @@
#include "mozilla/LookAndFeel.h"
#include "UnitTransforms.h"
#include "TiledLayerBuffer.h" // For TILEDLAYERBUFFER_TILE_SIZE
#include "ClientLayerManager.h"
#include "mozilla/Preferences.h"
@ -6514,7 +6515,21 @@ nsLayoutUtils::WantSubAPZC()
}
#endif
return wantSubAPZC;
}
}
/* static */ void
nsLayoutUtils::LogTestDataForPaint(nsIPresShell* aPresShell,
ViewID aScrollId,
const std::string& aKey,
const std::string& aValue)
{
nsRefPtr<LayerManager> lm = aPresShell->GetPresContext()->GetRootPresContext()
->GetPresShell()->GetLayerManager();
if (lm && lm->GetBackendType() == LayersBackend::LAYERS_CLIENT) {
static_cast<ClientLayerManager*>(lm.get())->LogTestDataForCurrentPaint(aScrollId, aKey, aValue);
}
}
nsLayoutUtils::SurfaceFromElementResult::SurfaceFromElementResult()
// Use safe default values here

View File

@ -26,6 +26,7 @@
#include "imgIContainer.h"
#include "mozilla/gfx/2D.h"
#include "Units.h"
#include "mozilla/ToString.h"
#include <limits>
#include <algorithm>
@ -2170,6 +2171,34 @@ public:
*/
static bool WantSubAPZC();
/**
* Log a key/value pair for APZ testing during a paint.
* @param aPresShell The pres shell that identifies where to log to. The data
* will be written to the APZTestData associated with the
* pres shell's layer manager.
* @param aScrollId Identifies the scroll frame to which the data pertains.
* @param aKey The key under which to log the data.
* @param aValue The value of the data to be logged.
*/
static void LogTestDataForPaint(nsIPresShell* aPresShell,
ViewID aScrollId,
const std::string& aKey,
const std::string& aValue);
/**
* A convenience overload of LogTestDataForPaint() that accepts any type
* as the value, and passes it through mozilla::ToString() to obtain a string
* value. The type passed must support streaming to an std::ostream.
*/
template <typename Value>
static void LogTestDataForPaint(nsIPresShell* aPresShell,
ViewID aScrollId,
const std::string& aKey,
const Value& aValue) {
LogTestDataForPaint(aPresShell, aScrollId, aKey,
mozilla::ToString(aValue));
}
/**
* Get the display port for |aScrollFrame|'s content. If |aScrollFrame|
* WantsAsyncScroll() and we don't have a scrollable displayport yet (as