Chromium Code Reviews

Unified Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.h

Issue 1576283003: Have HTMLMediaElement::play() return a Promise. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: third_party/WebKit/Source/core/html/HTMLMediaElement.h
diff --git a/third_party/WebKit/Source/core/html/HTMLMediaElement.h b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
index 0b731fbbd0c431616914cc58c7b831ad769ffcd3..7fb3aa11e5b70292f919690ce30600c8086ba62d 100644
--- a/third_party/WebKit/Source/core/html/HTMLMediaElement.h
+++ b/third_party/WebKit/Source/core/html/HTMLMediaElement.h
@@ -26,8 +26,10 @@
#ifndef HTMLMediaElement_h
#define HTMLMediaElement_h
+#include "bindings/core/v8/ScriptPromise.h"
#include "core/CoreExport.h"
#include "core/dom/ActiveDOMObject.h"
+#include "core/dom/ExceptionCode.h"
#include "core/events/GenericEventQueue.h"
#include "core/html/AutoplayExperimentHelper.h"
#include "core/html/HTMLElement.h"
@@ -52,6 +54,7 @@ class KURL;
class MediaControls;
class MediaError;
philipj_slow 2016/02/04 10:54:20 revert
mlamouri (slow - plz ping) 2016/02/18 17:06:06 Why?
philipj_slow 2016/02/19 07:32:48 Oops, I was looking at the diff between PS6 and PS
class HTMLMediaSource;
+class ScriptState;
class TextTrackContainer;
class TextTrackList;
class TimeRanges;
@@ -136,7 +139,8 @@ public:
bool shouldAutoplay(const RecordMetricsBehavior = RecordMetricsBehavior::DoNotRecord);
bool loop() const;
void setLoop(bool);
- void play();
+ ScriptPromise playForBindings(ScriptState*);
+ Nullable<ExceptionCode> play();
void pause();
void requestRemotePlayback();
void requestRemotePlaybackControl();
@@ -445,6 +449,13 @@ private:
// TODO(liberato): remove once autoplay gesture override experiment concludes.
void triggerAutoplayViewportCheckForTesting();
+ void scheduleResolvePlayPromises();
+ void scheduleRejectPlayPromises(ExceptionCode, const String&);
+ void scheduleNotifyPlaying();
+
+ void resolvePlayPromises();
+ void rejectPlayPromises(ExceptionCode, const String&);
+
UnthrottledTimer<HTMLMediaElement> m_loadTimer;
UnthrottledTimer<HTMLMediaElement> m_progressEventTimer;
UnthrottledTimer<HTMLMediaElement> m_playbackProgressTimer;
@@ -556,6 +567,8 @@ private:
OwnPtrWillBeMember<CueTimeline> m_cueTimeline;
+ PersistentHeapVectorWillBeHeapVector<Member<ScriptPromiseResolver>> m_playResolvers;
+
// This is a weak reference, since m_audioSourceNode holds a reference to us.
// FIXME: Oilpan: Consider making this a strongly traced pointer with oilpan where strong cycles are not a problem.
GC_PLUGIN_IGNORE("http://crbug.com/404577")

Powered by Google App Engine