2014-12-17 15:42:41 -08:00
|
|
|
/* vim: set shiftwidth=2 tabstop=8 autoindent cindent expandtab: */
|
|
|
|
/* 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/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_PendingPlayerTracker_h
|
|
|
|
#define mozilla_dom_PendingPlayerTracker_h
|
|
|
|
|
|
|
|
#include "mozilla/dom/AnimationPlayer.h"
|
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2014-12-21 16:35:41 -08:00
|
|
|
#include "nsIDocument.h"
|
2014-12-17 15:42:41 -08:00
|
|
|
#include "nsTHashtable.h"
|
|
|
|
|
2014-12-21 16:35:41 -08:00
|
|
|
class nsIFrame;
|
|
|
|
|
2014-12-17 15:42:41 -08:00
|
|
|
namespace mozilla {
|
|
|
|
|
|
|
|
class PendingPlayerTracker MOZ_FINAL
|
|
|
|
{
|
|
|
|
public:
|
2014-12-21 16:35:41 -08:00
|
|
|
explicit PendingPlayerTracker(nsIDocument* aDocument)
|
|
|
|
: mDocument(aDocument)
|
|
|
|
{ }
|
|
|
|
|
2014-12-17 15:42:41 -08:00
|
|
|
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(PendingPlayerTracker)
|
|
|
|
NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(PendingPlayerTracker)
|
|
|
|
|
|
|
|
void AddPlayPending(dom::AnimationPlayer& aPlayer);
|
|
|
|
void RemovePlayPending(dom::AnimationPlayer& aPlayer);
|
|
|
|
bool IsWaitingToPlay(dom::AnimationPlayer const& aPlayer) const;
|
|
|
|
|
2014-12-21 16:35:41 -08:00
|
|
|
// Causes any pending players to resume at |aReadyTime| by first
|
|
|
|
// fast-forwarding their timeline to the corresponding time.
|
|
|
|
void StartPendingPlayers(const TimeStamp& aReadyTime);
|
|
|
|
|
2014-12-17 15:42:41 -08:00
|
|
|
private:
|
|
|
|
~PendingPlayerTracker() { }
|
|
|
|
|
2014-12-21 16:35:41 -08:00
|
|
|
void EnsurePaintIsScheduled();
|
|
|
|
|
2014-12-17 15:42:41 -08:00
|
|
|
typedef nsTHashtable<nsRefPtrHashKey<dom::AnimationPlayer>>
|
|
|
|
AnimationPlayerSet;
|
|
|
|
|
|
|
|
AnimationPlayerSet mPlayPendingSet;
|
2014-12-21 16:35:41 -08:00
|
|
|
nsCOMPtr<nsIDocument> mDocument;
|
2014-12-17 15:42:41 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
} // namespace mozilla
|
|
|
|
|
|
|
|
#endif // mozilla_dom_PendingPlayerTracker_h
|