зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1240622 - Guard mCheckerboardEvent with a mutex to avoid races. r=botond
--HG-- extra : commitid : 9LLumoyfORc
This commit is contained in:
Родитель
e60fcbe3af
Коммит
2398798d67
|
@ -862,7 +862,8 @@ AsyncPanZoomController::AsyncPanZoomController(uint64_t aLayersId,
|
||||||
mInputQueue(aInputQueue),
|
mInputQueue(aInputQueue),
|
||||||
mAPZCId(sAsyncPanZoomControllerCount++),
|
mAPZCId(sAsyncPanZoomControllerCount++),
|
||||||
mSharedLock(nullptr),
|
mSharedLock(nullptr),
|
||||||
mAsyncTransformAppliedToContent(false)
|
mAsyncTransformAppliedToContent(false),
|
||||||
|
mCheckerboardEventLock("APZCBELock")
|
||||||
{
|
{
|
||||||
if (aGestures == USE_GESTURE_DETECTOR) {
|
if (aGestures == USE_GESTURE_DETECTOR) {
|
||||||
mGestureEventListener = new GestureEventListener(this);
|
mGestureEventListener = new GestureEventListener(this);
|
||||||
|
@ -2871,13 +2872,16 @@ AsyncPanZoomController::RequestContentRepaint(const FrameMetrics& aFrameMetrics,
|
||||||
}
|
}
|
||||||
|
|
||||||
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
|
APZC_LOG_FM(aFrameMetrics, "%p requesting content repaint", this);
|
||||||
if (mCheckerboardEvent && mCheckerboardEvent->IsRecordingTrace()) {
|
{ // scope lock
|
||||||
std::stringstream info;
|
MutexAutoLock lock(mCheckerboardEventLock);
|
||||||
info << " velocity " << aVelocity;
|
if (mCheckerboardEvent && mCheckerboardEvent->IsRecordingTrace()) {
|
||||||
std::string str = info.str();
|
std::stringstream info;
|
||||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
info << " velocity " << aVelocity;
|
||||||
CheckerboardEvent::RequestedDisplayPort, GetDisplayPortRect(aFrameMetrics),
|
std::string str = info.str();
|
||||||
str);
|
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||||
|
CheckerboardEvent::RequestedDisplayPort, GetDisplayPortRect(aFrameMetrics),
|
||||||
|
str);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
controller->RequestContentRepaint(aFrameMetrics);
|
controller->RequestContentRepaint(aFrameMetrics);
|
||||||
|
@ -2981,11 +2985,14 @@ bool AsyncPanZoomController::AdvanceAnimations(const TimeStamp& aSampleTime)
|
||||||
|
|
||||||
requestAnimationFrame = UpdateAnimation(aSampleTime, &deferredTasks);
|
requestAnimationFrame = UpdateAnimation(aSampleTime, &deferredTasks);
|
||||||
|
|
||||||
if (mCheckerboardEvent) {
|
{ // scope lock
|
||||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
MutexAutoLock lock(mCheckerboardEventLock);
|
||||||
CheckerboardEvent::UserVisible,
|
if (mCheckerboardEvent) {
|
||||||
CSSRect(mFrameMetrics.GetScrollOffset(),
|
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||||
mFrameMetrics.CalculateCompositedSizeInCssPixels()));
|
CheckerboardEvent::UserVisible,
|
||||||
|
CSSRect(mFrameMetrics.GetScrollOffset(),
|
||||||
|
mFrameMetrics.CalculateCompositedSizeInCssPixels()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3106,10 +3113,12 @@ AsyncPanZoomController::ReportCheckerboard(const TimeStamp& aSampleTime)
|
||||||
|
|
||||||
bool recordTrace = gfxPrefs::APZRecordCheckerboarding();
|
bool recordTrace = gfxPrefs::APZRecordCheckerboarding();
|
||||||
bool forTelemetry = Telemetry::CanRecordExtended();
|
bool forTelemetry = Telemetry::CanRecordExtended();
|
||||||
|
uint32_t magnitude = GetCheckerboardMagnitude();
|
||||||
|
|
||||||
|
MutexAutoLock lock(mCheckerboardEventLock);
|
||||||
if (!mCheckerboardEvent && (recordTrace || forTelemetry)) {
|
if (!mCheckerboardEvent && (recordTrace || forTelemetry)) {
|
||||||
mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace);
|
mCheckerboardEvent = MakeUnique<CheckerboardEvent>(recordTrace);
|
||||||
}
|
}
|
||||||
uint32_t magnitude = GetCheckerboardMagnitude();
|
|
||||||
if (magnitude) {
|
if (magnitude) {
|
||||||
mPotentialCheckerboardTracker.CheckerboardSeen();
|
mPotentialCheckerboardTracker.CheckerboardSeen();
|
||||||
}
|
}
|
||||||
|
@ -3168,36 +3177,39 @@ void AsyncPanZoomController::NotifyLayersUpdated(const FrameMetrics& aLayerMetri
|
||||||
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d, aThisLayerTreeUpdated=%d",
|
APZC_LOG_FM(aLayerMetrics, "%p got a NotifyLayersUpdated with aIsFirstPaint=%d, aThisLayerTreeUpdated=%d",
|
||||||
this, aIsFirstPaint, aThisLayerTreeUpdated);
|
this, aIsFirstPaint, aThisLayerTreeUpdated);
|
||||||
|
|
||||||
if (mCheckerboardEvent && mCheckerboardEvent->IsRecordingTrace()) {
|
{ // scope lock
|
||||||
std::string str;
|
MutexAutoLock lock(mCheckerboardEventLock);
|
||||||
if (aThisLayerTreeUpdated) {
|
if (mCheckerboardEvent && mCheckerboardEvent->IsRecordingTrace()) {
|
||||||
if (!aLayerMetrics.GetPaintRequestTime().IsNull()) {
|
std::string str;
|
||||||
// Note that we might get the paint request time as non-null, but with
|
if (aThisLayerTreeUpdated) {
|
||||||
// aThisLayerTreeUpdated false. That can happen if we get a layer transaction
|
if (!aLayerMetrics.GetPaintRequestTime().IsNull()) {
|
||||||
// from a different process right after we get the layer transaction with
|
// Note that we might get the paint request time as non-null, but with
|
||||||
// aThisLayerTreeUpdated == true. In this case we want to ignore the
|
// aThisLayerTreeUpdated false. That can happen if we get a layer transaction
|
||||||
// paint request time because it was already dumped in the previous layer
|
// from a different process right after we get the layer transaction with
|
||||||
// transaction.
|
// aThisLayerTreeUpdated == true. In this case we want to ignore the
|
||||||
TimeDuration paintTime = TimeStamp::Now() - aLayerMetrics.GetPaintRequestTime();
|
// paint request time because it was already dumped in the previous layer
|
||||||
std::stringstream info;
|
// transaction.
|
||||||
info << " painttime " << paintTime.ToMilliseconds();
|
TimeDuration paintTime = TimeStamp::Now() - aLayerMetrics.GetPaintRequestTime();
|
||||||
str = info.str();
|
std::stringstream info;
|
||||||
} else {
|
info << " painttime " << paintTime.ToMilliseconds();
|
||||||
// This might be indicative of a wasted paint particularly if it happens
|
str = info.str();
|
||||||
// during a checkerboard event.
|
} else {
|
||||||
str = " (this layertree updated)";
|
// This might be indicative of a wasted paint particularly if it happens
|
||||||
|
// during a checkerboard event.
|
||||||
|
str = " (this layertree updated)";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
|
||||||
CheckerboardEvent::Page, aLayerMetrics.GetScrollableRect());
|
|
||||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
|
||||||
CheckerboardEvent::PaintedDisplayPort,
|
|
||||||
aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset(),
|
|
||||||
str);
|
|
||||||
if (!aLayerMetrics.GetCriticalDisplayPort().IsEmpty()) {
|
|
||||||
mCheckerboardEvent->UpdateRendertraceProperty(
|
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||||
CheckerboardEvent::PaintedCriticalDisplayPort,
|
CheckerboardEvent::Page, aLayerMetrics.GetScrollableRect());
|
||||||
aLayerMetrics.GetCriticalDisplayPort() + aLayerMetrics.GetScrollOffset());
|
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||||
|
CheckerboardEvent::PaintedDisplayPort,
|
||||||
|
aLayerMetrics.GetDisplayPort() + aLayerMetrics.GetScrollOffset(),
|
||||||
|
str);
|
||||||
|
if (!aLayerMetrics.GetCriticalDisplayPort().IsEmpty()) {
|
||||||
|
mCheckerboardEvent->UpdateRendertraceProperty(
|
||||||
|
CheckerboardEvent::PaintedCriticalDisplayPort,
|
||||||
|
aLayerMetrics.GetCriticalDisplayPort() + aLayerMetrics.GetScrollOffset());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1102,6 +1102,8 @@ private:
|
||||||
* recording.
|
* recording.
|
||||||
*/
|
*/
|
||||||
private:
|
private:
|
||||||
|
// Mutex protecting mCheckerboardEvent
|
||||||
|
Mutex mCheckerboardEventLock;
|
||||||
// This is created when this APZC instance is first included as part of a
|
// This is created when this APZC instance is first included as part of a
|
||||||
// composite. If a checkerboard event takes place, this is destroyed at the
|
// composite. If a checkerboard event takes place, this is destroyed at the
|
||||||
// end of the event, and a new one is created on the next composite.
|
// end of the event, and a new one is created on the next composite.
|
||||||
|
|
Загрузка…
Ссылка в новой задаче