gecko-dev/dom/html/PlayPromise.h
alwu 976a59a484 Bug 1686696 - part1 : store pending event runner instead of saving event name. r=bryce,mccr8
In this patch, we move all event runners to a separate file and implement an event blocker.

In order to allow us to do a special check for `timeupdate` event, we have to know that event is periodic or mandatory.

We have to save extra information for `timeupdate, however, current design for storing pending events is not flexible enough to achieve that.

Therefore, instead of storing the event name, we store the event runners which can all have different implementation and know when they should dispatch their own event.

Differential Revision: https://phabricator.services.mozilla.com/D102673
2021-02-11 20:19:23 +00:00

40 lines
1.2 KiB
C++

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=2 sts=2 et sw=2 tw=80: */
/* 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 __PlayPromise_h__
#define __PlayPromise_h__
#include "mozilla/dom/Promise.h"
#include "mozilla/Telemetry.h"
namespace mozilla {
namespace dom {
// Decorates a DOM Promise to report telemetry as to whether it was resolved
// or rejected and why.
class PlayPromise : public Promise {
public:
static already_AddRefed<PlayPromise> Create(nsIGlobalObject* aGlobal,
ErrorResult& aRv);
using PlayPromiseArr = nsTArray<RefPtr<PlayPromise>>;
static void ResolvePromisesWithUndefined(const PlayPromiseArr& aPromises);
static void RejectPromises(const PlayPromiseArr& aPromises, nsresult aError);
~PlayPromise();
void MaybeResolveWithUndefined();
void MaybeReject(nsresult aReason);
private:
explicit PlayPromise(nsIGlobalObject* aGlobal);
bool mFulfilled = false;
};
} // namespace dom
} // namespace mozilla
#endif // __PlayPromise_h__