2012-12-11 14:15:32 -08:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
2009-10-07 20:22:42 -07:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
2012-05-21 04:12:37 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2009-10-07 20:22:42 -07:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Code to notify things that animate before a refresh, at an appropriate
|
|
|
|
* refresh rate. (Perhaps temporary, until replaced by compositor.)
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef nsRefreshDriver_h_
|
|
|
|
#define nsRefreshDriver_h_
|
|
|
|
|
|
|
|
#include "mozilla/TimeStamp.h"
|
|
|
|
#include "mozFlushType.h"
|
|
|
|
#include "nsTObserverArray.h"
|
2010-08-11 14:05:27 -07:00
|
|
|
#include "nsTArray.h"
|
2011-11-09 13:39:16 -08:00
|
|
|
#include "nsTHashtable.h"
|
2013-05-17 13:57:26 -07:00
|
|
|
#include "nsClassHashtable.h"
|
2011-11-09 13:39:16 -08:00
|
|
|
#include "nsHashKeys.h"
|
2012-06-18 20:26:34 -07:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-08-27 15:10:28 -07:00
|
|
|
#include "mozilla/Maybe.h"
|
2014-04-22 11:13:00 -07:00
|
|
|
#include "GeckoProfiler.h"
|
2014-05-28 14:42:17 -07:00
|
|
|
#include "mozilla/layers/TransactionIdAllocator.h"
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2009-12-21 13:46:24 -08:00
|
|
|
class nsPresContext;
|
2010-08-11 14:05:27 -07:00
|
|
|
class nsIPresShell;
|
2010-08-11 14:05:28 -07:00
|
|
|
class nsIDocument;
|
2011-11-09 13:39:16 -08:00
|
|
|
class imgIRequest;
|
2013-08-19 06:08:44 -07:00
|
|
|
class nsIRunnable;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
class RefreshDriverTimer;
|
|
|
|
}
|
2009-12-21 13:46:24 -08:00
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
/**
|
|
|
|
* An abstract base class to be implemented by callers wanting to be
|
|
|
|
* notified at refresh times. When nothing needs to be painted, callers
|
|
|
|
* may not be notified.
|
|
|
|
*/
|
|
|
|
class nsARefreshObserver {
|
|
|
|
public:
|
2009-12-21 13:46:25 -08:00
|
|
|
// AddRef and Release signatures that match nsISupports. Implementors
|
|
|
|
// must implement reference counting, and those that do implement
|
|
|
|
// nsISupports will already have methods with the correct signature.
|
|
|
|
//
|
|
|
|
// The refresh driver does NOT hold references to refresh observers
|
2010-06-26 19:43:13 -07:00
|
|
|
// except while it is notifying them.
|
2014-03-27 13:38:33 -07:00
|
|
|
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) = 0;
|
|
|
|
NS_IMETHOD_(MozExternalRefCountType) Release(void) = 0;
|
2009-12-21 13:46:25 -08:00
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
virtual void WillRefresh(mozilla::TimeStamp aTime) = 0;
|
|
|
|
};
|
|
|
|
|
2013-08-19 06:08:44 -07:00
|
|
|
/**
|
|
|
|
* An abstract base class to be implemented by callers wanting to be notified
|
|
|
|
* that a refresh has occurred. Callers must ensure an observer is removed
|
|
|
|
* before it is destroyed.
|
|
|
|
*/
|
|
|
|
class nsAPostRefreshObserver {
|
|
|
|
public:
|
|
|
|
virtual void DidRefresh() = 0;
|
|
|
|
};
|
|
|
|
|
2014-05-28 14:43:41 -07:00
|
|
|
class nsRefreshDriver MOZ_FINAL : public mozilla::layers::TransactionIdAllocator,
|
|
|
|
public nsARefreshObserver {
|
2009-10-07 20:22:42 -07:00
|
|
|
public:
|
2009-12-21 13:46:24 -08:00
|
|
|
nsRefreshDriver(nsPresContext *aPresContext);
|
2009-10-07 20:22:42 -07:00
|
|
|
~nsRefreshDriver();
|
|
|
|
|
2011-03-07 08:58:48 -08:00
|
|
|
static void InitializeStatics();
|
2012-12-11 14:15:32 -08:00
|
|
|
static void Shutdown();
|
2011-03-07 08:58:48 -08:00
|
|
|
|
2011-04-11 23:18:43 -07:00
|
|
|
/**
|
|
|
|
* Methods for testing, exposed via nsIDOMWindowUtils. See
|
|
|
|
* nsIDOMWindowUtils.advanceTimeAndRefresh for description.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
void AdvanceTimeAndRefresh(int64_t aMilliseconds);
|
2011-04-11 23:18:43 -07:00
|
|
|
void RestoreNormalRefresh();
|
2012-12-11 14:15:32 -08:00
|
|
|
void DoTick();
|
|
|
|
bool IsTestControllingRefreshesEnabled() const
|
|
|
|
{
|
|
|
|
return mTestControllingRefreshes;
|
|
|
|
}
|
2011-04-11 23:18:43 -07:00
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
/**
|
|
|
|
* Return the time of the most recent refresh. This is intended to be
|
|
|
|
* used by callers who want to start an animation now and want to know
|
|
|
|
* what time to consider the start of the animation. (This helps
|
|
|
|
* ensure that multiple animations started during the same event off
|
|
|
|
* the main event loop have the same start time.)
|
|
|
|
*/
|
|
|
|
mozilla::TimeStamp MostRecentRefresh() const;
|
2010-08-11 14:05:28 -07:00
|
|
|
/**
|
|
|
|
* Same thing, but in microseconds since the epoch.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
int64_t MostRecentRefreshEpochTime() const;
|
2009-10-07 20:22:42 -07:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Add / remove refresh observers. Returns whether the operation
|
|
|
|
* succeeded.
|
|
|
|
*
|
|
|
|
* The flush type affects:
|
|
|
|
* + the order in which the observers are notified (lowest flush
|
|
|
|
* type to highest, in order registered)
|
|
|
|
* + (in the future) which observers are suppressed when the display
|
|
|
|
* doesn't require current position data or isn't currently
|
|
|
|
* painting, and, correspondingly, which get notified when there
|
|
|
|
* is a flush during such suppression
|
|
|
|
* and it must be either Flush_Style, Flush_Layout, or Flush_Display.
|
2009-12-21 13:46:25 -08:00
|
|
|
*
|
|
|
|
* The refresh driver does NOT own a reference to these observers;
|
|
|
|
* they must remove themselves before they are destroyed.
|
2013-08-19 06:08:44 -07:00
|
|
|
*
|
|
|
|
* The observer will be called even if there is no other activity.
|
2009-10-07 20:22:42 -07:00
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AddRefreshObserver(nsARefreshObserver *aObserver,
|
2013-08-19 06:08:44 -07:00
|
|
|
mozFlushType aFlushType);
|
2011-09-28 23:19:26 -07:00
|
|
|
bool RemoveRefreshObserver(nsARefreshObserver *aObserver,
|
2013-08-19 06:08:44 -07:00
|
|
|
mozFlushType aFlushType);
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Add an observer that will be called after each refresh. The caller
|
|
|
|
* must remove the observer before it is deleted. This does not trigger
|
|
|
|
* refresh driver ticks.
|
|
|
|
*/
|
|
|
|
void AddPostRefreshObserver(nsAPostRefreshObserver *aObserver);
|
|
|
|
void RemovePostRefreshObserver(nsAPostRefreshObserver *aObserver);
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2011-11-09 13:39:16 -08:00
|
|
|
/**
|
|
|
|
* Add/Remove imgIRequest versions of observers.
|
|
|
|
*
|
|
|
|
* These are used for hooking into the refresh driver for
|
|
|
|
* controlling animated images.
|
|
|
|
*
|
|
|
|
* @note The refresh driver owns a reference to these listeners.
|
|
|
|
*
|
|
|
|
* @note Technically, imgIRequest objects are not nsARefreshObservers, but
|
|
|
|
* for controlling animated image repaint events, we subscribe the
|
|
|
|
* imgIRequests to the nsRefreshDriver for notification of paint events.
|
|
|
|
*
|
|
|
|
* @returns whether the operation succeeded, or void in the case of removal.
|
|
|
|
*/
|
|
|
|
bool AddImageRequest(imgIRequest* aRequest);
|
|
|
|
void RemoveImageRequest(imgIRequest* aRequest);
|
|
|
|
|
2010-08-11 14:05:27 -07:00
|
|
|
/**
|
|
|
|
* Add / remove presshells that we should flush style and layout on
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AddStyleFlushObserver(nsIPresShell* aShell) {
|
2010-08-11 14:05:27 -07:00
|
|
|
NS_ASSERTION(!mStyleFlushObservers.Contains(aShell),
|
|
|
|
"Double-adding style flush observer");
|
2014-04-22 11:13:00 -07:00
|
|
|
// We only get the cause for the first observer each frame because capturing
|
|
|
|
// a stack is expensive. This is still useful if (1) you're trying to remove
|
|
|
|
// all flushes for a particial frame or (2) the costly flush is triggered
|
|
|
|
// near the call site where the first observer is triggered.
|
|
|
|
if (!mStyleCause) {
|
|
|
|
mStyleCause = profiler_get_backtrace();
|
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
bool appended = mStyleFlushObservers.AppendElement(aShell) != nullptr;
|
2011-04-21 20:17:32 -07:00
|
|
|
EnsureTimerStarted(false);
|
2014-04-22 11:13:00 -07:00
|
|
|
|
2010-08-11 14:05:27 -07:00
|
|
|
return appended;
|
|
|
|
}
|
|
|
|
void RemoveStyleFlushObserver(nsIPresShell* aShell) {
|
|
|
|
mStyleFlushObservers.RemoveElement(aShell);
|
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool AddLayoutFlushObserver(nsIPresShell* aShell) {
|
2010-08-11 14:05:27 -07:00
|
|
|
NS_ASSERTION(!IsLayoutFlushObserver(aShell),
|
|
|
|
"Double-adding layout flush observer");
|
2014-04-22 11:13:00 -07:00
|
|
|
// We only get the cause for the first observer each frame because capturing
|
|
|
|
// a stack is expensive. This is still useful if (1) you're trying to remove
|
|
|
|
// all flushes for a particial frame or (2) the costly flush is triggered
|
|
|
|
// near the call site where the first observer is triggered.
|
|
|
|
if (!mReflowCause) {
|
|
|
|
mReflowCause = profiler_get_backtrace();
|
|
|
|
}
|
2012-07-30 07:20:58 -07:00
|
|
|
bool appended = mLayoutFlushObservers.AppendElement(aShell) != nullptr;
|
2011-04-21 20:17:32 -07:00
|
|
|
EnsureTimerStarted(false);
|
2010-08-11 14:05:27 -07:00
|
|
|
return appended;
|
|
|
|
}
|
|
|
|
void RemoveLayoutFlushObserver(nsIPresShell* aShell) {
|
|
|
|
mLayoutFlushObservers.RemoveElement(aShell);
|
|
|
|
}
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsLayoutFlushObserver(nsIPresShell* aShell) {
|
2010-08-11 14:05:27 -07:00
|
|
|
return mLayoutFlushObservers.Contains(aShell);
|
|
|
|
}
|
2012-08-28 22:48:44 -07:00
|
|
|
bool AddPresShellToInvalidateIfHidden(nsIPresShell* aShell) {
|
|
|
|
NS_ASSERTION(!mPresShellsToInvalidateIfHidden.Contains(aShell),
|
|
|
|
"Double-adding style flush observer");
|
|
|
|
bool appended = mPresShellsToInvalidateIfHidden.AppendElement(aShell) != nullptr;
|
|
|
|
EnsureTimerStarted(false);
|
|
|
|
return appended;
|
|
|
|
}
|
|
|
|
void RemovePresShellToInvalidateIfHidden(nsIPresShell* aShell) {
|
|
|
|
mPresShellsToInvalidateIfHidden.RemoveElement(aShell);
|
|
|
|
}
|
2010-08-11 14:05:27 -07:00
|
|
|
|
2011-12-23 19:52:22 -08:00
|
|
|
/**
|
|
|
|
* Remember whether our presshell's view manager needs a flush
|
|
|
|
*/
|
2012-09-16 22:06:12 -07:00
|
|
|
void ScheduleViewManagerFlush();
|
2011-12-23 19:52:22 -08:00
|
|
|
void RevokeViewManagerFlush() {
|
|
|
|
mViewManagerFlushIsPending = false;
|
|
|
|
}
|
2012-08-28 22:47:18 -07:00
|
|
|
bool ViewManagerFlushIsPending() {
|
|
|
|
return mViewManagerFlushIsPending;
|
|
|
|
}
|
2011-12-23 19:52:22 -08:00
|
|
|
|
2010-09-08 22:38:04 -07:00
|
|
|
/**
|
2011-11-28 04:48:30 -08:00
|
|
|
* Add a document for which we have nsIFrameRequestCallbacks
|
2010-09-08 22:38:04 -07:00
|
|
|
*/
|
2011-11-28 04:48:30 -08:00
|
|
|
void ScheduleFrameRequestCallbacks(nsIDocument* aDocument);
|
2010-09-08 22:38:04 -07:00
|
|
|
|
|
|
|
/**
|
2011-11-28 04:48:30 -08:00
|
|
|
* Remove a document for which we have nsIFrameRequestCallbacks
|
2010-09-08 22:38:04 -07:00
|
|
|
*/
|
2011-11-28 04:48:30 -08:00
|
|
|
void RevokeFrameRequestCallbacks(nsIDocument* aDocument);
|
2010-09-08 22:38:04 -07:00
|
|
|
|
2009-12-21 13:46:24 -08:00
|
|
|
/**
|
|
|
|
* Tell the refresh driver that it is done driving refreshes and
|
|
|
|
* should stop its timer and forget about its pres context. This may
|
|
|
|
* be called from within a refresh.
|
|
|
|
*/
|
|
|
|
void Disconnect() {
|
|
|
|
StopTimer();
|
2012-07-30 07:20:58 -07:00
|
|
|
mPresContext = nullptr;
|
2009-12-21 13:46:24 -08:00
|
|
|
}
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2013-12-19 13:38:35 -08:00
|
|
|
bool IsFrozen() { return mFreezeCount > 0; }
|
|
|
|
|
2010-02-03 13:17:55 -08:00
|
|
|
/**
|
|
|
|
* Freeze the refresh driver. It should stop delivering future
|
2013-12-19 13:38:35 -08:00
|
|
|
* refreshes until thawed. Note that the number of calls to Freeze() must
|
|
|
|
* match the number of calls to Thaw() in order for the refresh driver to
|
|
|
|
* be un-frozen.
|
2010-02-03 13:17:55 -08:00
|
|
|
*/
|
|
|
|
void Freeze();
|
|
|
|
|
|
|
|
/**
|
2013-12-19 13:38:35 -08:00
|
|
|
* Thaw the refresh driver. If the number of calls to Freeze() matches the
|
|
|
|
* number of calls to this function, the refresh driver should start
|
|
|
|
* delivering refreshes again.
|
2010-02-03 13:17:55 -08:00
|
|
|
*/
|
|
|
|
void Thaw();
|
|
|
|
|
2010-08-26 21:26:23 -07:00
|
|
|
/**
|
|
|
|
* Throttle or unthrottle the refresh driver. This is done if the
|
|
|
|
* corresponding presshell is hidden or shown.
|
|
|
|
*/
|
|
|
|
void SetThrottled(bool aThrottled);
|
|
|
|
|
2010-08-11 14:05:27 -07:00
|
|
|
/**
|
|
|
|
* Return the prescontext we were initialized with
|
|
|
|
*/
|
|
|
|
nsPresContext* PresContext() const { return mPresContext; }
|
|
|
|
|
2010-02-19 09:11:40 -08:00
|
|
|
#ifdef DEBUG
|
|
|
|
/**
|
|
|
|
* Check whether the given observer is an observer for the given flush type
|
|
|
|
*/
|
2011-09-28 23:19:26 -07:00
|
|
|
bool IsRefreshObserver(nsARefreshObserver *aObserver,
|
2010-02-19 09:11:40 -08:00
|
|
|
mozFlushType aFlushType);
|
|
|
|
#endif
|
|
|
|
|
2011-12-23 19:52:26 -08:00
|
|
|
/**
|
|
|
|
* Default interval the refresh driver uses, in ms.
|
|
|
|
*/
|
2012-08-22 08:56:38 -07:00
|
|
|
static int32_t DefaultInterval();
|
2011-12-23 19:52:26 -08:00
|
|
|
|
2013-09-04 04:47:21 -07:00
|
|
|
bool IsInRefresh() { return mInRefresh; }
|
|
|
|
|
2014-05-28 14:42:17 -07:00
|
|
|
// mozilla::layers::TransactionIdAllocator
|
|
|
|
virtual uint64_t GetTransactionId() MOZ_OVERRIDE;
|
|
|
|
void NotifyTransactionCompleted(uint64_t aTransactionId) MOZ_OVERRIDE;
|
|
|
|
void RevokeTransactionId(uint64_t aTransactionId) MOZ_OVERRIDE;
|
2014-05-28 14:42:17 -07:00
|
|
|
|
2014-05-28 14:43:41 -07:00
|
|
|
bool IsWaitingForPaint();
|
|
|
|
|
|
|
|
// nsARefreshObserver
|
|
|
|
NS_IMETHOD_(MozExternalRefCountType) AddRef(void) { return TransactionIdAllocator::AddRef(); }
|
|
|
|
NS_IMETHOD_(MozExternalRefCountType) Release(void) { return TransactionIdAllocator::Release(); }
|
|
|
|
virtual void WillRefresh(mozilla::TimeStamp aTime);
|
2009-12-21 13:46:24 -08:00
|
|
|
private:
|
2009-10-07 20:22:42 -07:00
|
|
|
typedef nsTObserverArray<nsARefreshObserver*> ObserverArray;
|
2011-11-09 13:39:16 -08:00
|
|
|
typedef nsTHashtable<nsISupportsHashKey> RequestTable;
|
2013-05-17 13:57:26 -07:00
|
|
|
struct ImageStartData {
|
|
|
|
ImageStartData()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
mozilla::Maybe<mozilla::TimeStamp> mStartTime;
|
|
|
|
RequestTable mEntries;
|
|
|
|
};
|
|
|
|
typedef nsClassHashtable<nsUint32HashKey, ImageStartData> ImageStartTable;
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2012-12-11 14:15:32 -08:00
|
|
|
void Tick(int64_t aNowEpoch, mozilla::TimeStamp aNowTime);
|
|
|
|
|
2011-04-21 20:17:32 -07:00
|
|
|
void EnsureTimerStarted(bool aAdjustingTimer);
|
2009-10-07 20:22:42 -07:00
|
|
|
void StopTimer();
|
2011-11-09 13:39:16 -08:00
|
|
|
|
2012-08-22 08:56:38 -07:00
|
|
|
uint32_t ObserverCount() const;
|
|
|
|
uint32_t ImageRequestCount() const;
|
2011-11-09 13:39:16 -08:00
|
|
|
static PLDHashOperator ImageRequestEnumerator(nsISupportsHashKey* aEntry,
|
2013-05-17 13:57:26 -07:00
|
|
|
void* aUserArg);
|
|
|
|
static PLDHashOperator StartTableRequestCounter(const uint32_t& aKey,
|
|
|
|
ImageStartData* aEntry,
|
|
|
|
void* aUserArg);
|
|
|
|
static PLDHashOperator StartTableRefresh(const uint32_t& aKey,
|
|
|
|
ImageStartData* aEntry,
|
|
|
|
void* aUserArg);
|
|
|
|
static PLDHashOperator BeginRefreshingImages(nsISupportsHashKey* aEntry,
|
|
|
|
void* aUserArg);
|
2009-10-07 20:22:42 -07:00
|
|
|
ObserverArray& ArrayFor(mozFlushType aFlushType);
|
2010-02-03 13:17:55 -08:00
|
|
|
// Trigger a refresh immediately, if haven't been disconnected or frozen.
|
|
|
|
void DoRefresh();
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2012-12-11 14:15:32 -08:00
|
|
|
double GetRefreshTimerInterval() const;
|
2013-05-29 03:31:16 -07:00
|
|
|
double GetRegularTimerInterval(bool *outIsDefault = nullptr) const;
|
2012-12-11 14:15:32 -08:00
|
|
|
double GetThrottledTimerInterval() const;
|
2011-03-04 07:27:02 -08:00
|
|
|
|
2011-11-28 04:48:30 -08:00
|
|
|
bool HaveFrameRequestCallbacks() const {
|
|
|
|
return mFrameRequestCallbackDocs.Length() != 0;
|
2011-03-07 08:58:48 -08:00
|
|
|
}
|
|
|
|
|
2014-05-28 14:42:17 -07:00
|
|
|
void FinishedWaitingForTransaction();
|
|
|
|
|
2012-12-11 14:15:32 -08:00
|
|
|
mozilla::RefreshDriverTimer* ChooseTimer() const;
|
|
|
|
mozilla::RefreshDriverTimer *mActiveTimer;
|
2009-10-07 20:22:42 -07:00
|
|
|
|
2014-04-22 11:13:00 -07:00
|
|
|
ProfilerBacktrace* mReflowCause;
|
|
|
|
ProfilerBacktrace* mStyleCause;
|
|
|
|
|
2009-12-21 13:46:24 -08:00
|
|
|
nsPresContext *mPresContext; // weak; pres context passed in constructor
|
|
|
|
// and unset in Disconnect
|
|
|
|
|
2014-05-28 14:43:41 -07:00
|
|
|
nsRefPtr<nsRefreshDriver> mRootRefresh;
|
|
|
|
|
2014-05-28 14:42:17 -07:00
|
|
|
// The most recently allocated transaction id.
|
|
|
|
uint64_t mPendingTransaction;
|
|
|
|
// The most recently completed transaction id.
|
|
|
|
uint64_t mCompletedTransaction;
|
|
|
|
|
2013-12-19 13:38:35 -08:00
|
|
|
uint32_t mFreezeCount;
|
2010-08-26 21:26:23 -07:00
|
|
|
bool mThrottled;
|
2011-04-11 23:18:43 -07:00
|
|
|
bool mTestControllingRefreshes;
|
2011-12-23 19:52:22 -08:00
|
|
|
bool mViewManagerFlushIsPending;
|
2012-12-11 14:15:32 -08:00
|
|
|
bool mRequestedHighPrecision;
|
2013-09-04 04:47:21 -07:00
|
|
|
bool mInRefresh;
|
2012-12-11 14:15:32 -08:00
|
|
|
|
2014-05-28 14:42:17 -07:00
|
|
|
// True if the refresh driver is suspended waiting for transaction
|
|
|
|
// id's to be returned and shouldn't do any work during Tick().
|
|
|
|
bool mWaitingForTransaction;
|
|
|
|
// True if Tick() was skipped because of mWaitingForTransaction and
|
|
|
|
// we should schedule a new Tick immediately when resumed instead
|
|
|
|
// of waiting until the next interval.
|
2014-05-28 14:45:06 -07:00
|
|
|
uint32_t mSkippedPaints;
|
2014-05-28 14:42:17 -07:00
|
|
|
|
2012-12-11 14:15:32 -08:00
|
|
|
int64_t mMostRecentRefreshEpochTime;
|
|
|
|
mozilla::TimeStamp mMostRecentRefresh;
|
2010-02-03 13:17:55 -08:00
|
|
|
|
2009-10-07 20:22:42 -07:00
|
|
|
// separate arrays for each flush type we support
|
|
|
|
ObserverArray mObservers[3];
|
2011-11-09 13:39:16 -08:00
|
|
|
RequestTable mRequests;
|
2013-05-17 13:57:26 -07:00
|
|
|
ImageStartTable mStartTable;
|
2011-11-09 13:39:16 -08:00
|
|
|
|
2010-08-11 14:05:27 -07:00
|
|
|
nsAutoTArray<nsIPresShell*, 16> mStyleFlushObservers;
|
|
|
|
nsAutoTArray<nsIPresShell*, 16> mLayoutFlushObservers;
|
2012-08-28 22:48:44 -07:00
|
|
|
nsAutoTArray<nsIPresShell*, 16> mPresShellsToInvalidateIfHidden;
|
2010-08-11 14:05:28 -07:00
|
|
|
// nsTArray on purpose, because we want to be able to swap.
|
2011-11-28 04:48:30 -08:00
|
|
|
nsTArray<nsIDocument*> mFrameRequestCallbackDocs;
|
2013-08-19 06:08:44 -07:00
|
|
|
nsTArray<nsAPostRefreshObserver*> mPostRefreshObservers;
|
2011-03-04 07:27:02 -08:00
|
|
|
|
2011-11-09 13:39:16 -08:00
|
|
|
// Helper struct for processing image requests
|
|
|
|
struct ImageRequestParameters {
|
2013-05-17 13:57:26 -07:00
|
|
|
mozilla::TimeStamp mCurrent;
|
|
|
|
mozilla::TimeStamp mPrevious;
|
|
|
|
RequestTable* mRequests;
|
|
|
|
mozilla::TimeStamp mDesired;
|
2011-11-09 13:39:16 -08:00
|
|
|
};
|
2012-12-11 14:15:32 -08:00
|
|
|
|
|
|
|
friend class mozilla::RefreshDriverTimer;
|
|
|
|
|
|
|
|
// turn on or turn off high precision based on various factors
|
|
|
|
void ConfigureHighPrecision();
|
|
|
|
void SetHighPrecisionTimersEnabled(bool aEnable);
|
2009-10-07 20:22:42 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif /* !defined(nsRefreshDriver_h_) */
|