Bug 1061846 - Add constants for transaction delay indicator. r=milan

--HG--
extra : rebase_source : 7176c689bd00e90590cc021ab35189720019c73e
This commit is contained in:
Benoit Girard 2014-09-02 14:37:34 -04:00
Родитель c3dc5bb115
Коммит 3ce2052a5c
3 изменённых файлов: 9 добавлений и 5 удалений

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

@ -351,8 +351,7 @@ LayerManagerComposite::RenderDebugOverlay(const Rect& aBounds)
int width; int width;
int border; int border;
float alpha = 1; float alpha = 1;
if ((now - mWarnTime).ToMilliseconds() < 150) { if ((now - mWarnTime).ToMilliseconds() < kVisualWarningDuration) {
printf_stderr("Draw\n");
EffectChain effects; EffectChain effects;
// Black blorder // Black blorder

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

@ -67,6 +67,10 @@ class TextRenderer;
class CompositingRenderTarget; class CompositingRenderTarget;
struct FPSState; struct FPSState;
static const int kVisualWarningTrigger = 200; // ms
static const int kVisualWarningMax = 1000; // ms
static const int kVisualWarningDuration = 150; // ms
class LayerManagerComposite MOZ_FINAL : public LayerManager class LayerManagerComposite MOZ_FINAL : public LayerManager
{ {
typedef mozilla::gfx::DrawTarget DrawTarget; typedef mozilla::gfx::DrawTarget DrawTarget;
@ -247,7 +251,7 @@ public:
mozilla::TimeStamp now = TimeStamp::Now(); mozilla::TimeStamp now = TimeStamp::Now();
if (mWarnTime.IsNull() || if (mWarnTime.IsNull() ||
severity > mWarningLevel || severity > mWarningLevel ||
mWarnTime + TimeDuration::FromMilliseconds(150) < now) { mWarnTime + TimeDuration::FromMilliseconds(kVisualWarningDuration) < now) {
mWarnTime = now; mWarnTime = now;
mWarningLevel = severity; mWarningLevel = severity;
} }

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

@ -571,8 +571,9 @@ LayerTransactionParent::RecvUpdate(const InfallibleTArray<Edit>& cset,
TimeDuration latency = TimeStamp::Now() - aTransactionStart; TimeDuration latency = TimeStamp::Now() - aTransactionStart;
// Theshold is 200ms to trigger, 1000ms to hit red // Theshold is 200ms to trigger, 1000ms to hit red
if (latency > TimeDuration::FromMilliseconds(200)) { if (latency > TimeDuration::FromMilliseconds(kVisualWarningTrigger)) {
float severity = (latency - TimeDuration::FromMilliseconds(200)).ToMilliseconds() / 800; float severity = (latency - TimeDuration::FromMilliseconds(kVisualWarningTrigger)).ToMilliseconds() /
(kVisualWarningMax - kVisualWarningTrigger);
if (severity > 1.f) { if (severity > 1.f) {
severity = 1.f; severity = 1.f;
} }