Bug 1563871 - Pass the result of apz.test.logging_enabled pref value to APZPaintLogHelper. r=botond

APZCTreeManager::UpdateHitTestingTree runs on the updater thread, so it's
possible that querying StaticPrefs::apz_test_logging_enabled() at different
places will return different results.

Differential Revision: https://phabricator.services.mozilla.com/D201180
This commit is contained in:
Hiroyuki Ikezoe 2024-02-22 00:47:08 +00:00
Родитель 5c05fd6109
Коммит c5b7ab5870
2 изменённых файлов: 8 добавлений и 7 удалений

Просмотреть файл

@ -83,10 +83,10 @@ typedef CompositorBridgeParent::LayerTreeState LayerTreeState;
struct APZCTreeManager::TreeBuildingState {
TreeBuildingState(LayersId aRootLayersId, bool aIsFirstPaint,
LayersId aOriginatingLayersId, APZTestData* aTestData,
uint32_t aPaintSequence)
uint32_t aPaintSequence, bool aIsTestLoggingEnabled)
: mIsFirstPaint(aIsFirstPaint),
mOriginatingLayersId(aOriginatingLayersId),
mPaintLogger(aTestData, aPaintSequence) {
mPaintLogger(aTestData, aPaintSequence, aIsTestLoggingEnabled) {
CompositorBridgeParent::CallWithIndirectShadowTree(
aRootLayersId, [this](LayerTreeState& aState) -> void {
mCompositorController = aState.GetCompositorController();
@ -430,7 +430,8 @@ void APZCTreeManager::UpdateHitTestingTree(
// For testing purposes, we log some data to the APZTestData associated with
// the layers id that originated this update.
APZTestData* testData = nullptr;
if (StaticPrefs::apz_test_logging_enabled()) {
const bool testLoggingEnabled = StaticPrefs::apz_test_logging_enabled();
if (testLoggingEnabled) {
MutexAutoLock lock(mTestDataLock);
UniquePtr<APZTestData> ptr = MakeUnique<APZTestData>();
auto result =
@ -440,7 +441,7 @@ void APZCTreeManager::UpdateHitTestingTree(
}
TreeBuildingState state(mRootLayersId, aIsFirstPaint, aOriginatingLayersId,
testData, aPaintSequenceNumber);
testData, aPaintSequenceNumber, testLoggingEnabled);
// We do this business with collecting the entire tree into an array because
// otherwise it's very hard to determine which APZC instances need to be

Просмотреть файл

@ -144,10 +144,10 @@ class APZTestData {
// A helper class for logging data for a paint.
class APZPaintLogHelper {
public:
APZPaintLogHelper(APZTestData* aTestData, SequenceNumber aPaintSequenceNumber)
APZPaintLogHelper(APZTestData* aTestData, SequenceNumber aPaintSequenceNumber,
bool aIsTestLoggingEnabled)
: mTestData(aTestData), mPaintSequenceNumber(aPaintSequenceNumber) {
MOZ_ASSERT(!aTestData || StaticPrefs::apz_test_logging_enabled(),
"don't call me");
MOZ_ASSERT(!aTestData || aIsTestLoggingEnabled, "don't call me");
}
template <typename Value>