Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: third_party/WebKit/Source/core/html/HTMLMediaElement.h

Issue 1522463003: Refactor resource load and resource selection algorithms as per spec (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address nits Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved. 2 * Copyright (C) 2007, 2008, 2009, 2010, 2011, 2012, 2013 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 1. Redistributions of source code must retain the above copyright 7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright 9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 bool hasAudio() const; 90 bool hasAudio() const;
91 91
92 bool supportsSave() const; 92 bool supportsSave() const;
93 93
94 WebLayer* platformLayer() const; 94 WebLayer* platformLayer() const;
95 95
96 enum DelayedActionType { 96 enum DelayedActionType {
97 LoadMediaResource = 1 << 0, 97 LoadMediaResource = 1 << 0,
98 LoadTextTrackResource = 1 << 1 98 LoadTextTrackResource = 1 << 1
99 }; 99 };
100 void scheduleDelayedAction(DelayedActionType); 100 void scheduleTextTrackResourceLoad();
101 101
102 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; } 102 bool hasRemoteRoutes() const { return m_remoteRoutesAvailable; }
103 bool isPlayingRemotely() const { return m_playingRemotely; } 103 bool isPlayingRemotely() const { return m_playingRemotely; }
104 104
105 // error state 105 // error state
106 MediaError* error() const; 106 MediaError* error() const;
107 107
108 // network state 108 // network state
109 void setSrc(const AtomicString&); 109 void setSrc(const AtomicString&);
110 const KURL& currentSrc() const { return m_currentSrc; } 110 const KURL& currentSrc() const { return m_currentSrc; }
111 111
112 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO _SOURCE }; 112 enum NetworkState { NETWORK_EMPTY, NETWORK_IDLE, NETWORK_LOADING, NETWORK_NO _SOURCE };
113 NetworkState getNetworkState() const; 113 NetworkState getNetworkState() const;
114 114
115 String preloadTypeToString(WebMediaPlayer::Preload preloadType) const;
philipj_slow 2016/03/15 04:51:34 This ought to be a helper in the cpp file only, it
115 String preload() const; 116 String preload() const;
116 void setPreload(const AtomicString&); 117 void setPreload(const AtomicString&);
117 WebMediaPlayer::Preload preloadType() const; 118 WebMediaPlayer::Preload preloadType() const;
119 String effectivePreload() const;
118 WebMediaPlayer::Preload effectivePreloadType() const; 120 WebMediaPlayer::Preload effectivePreloadType() const;
119 121
120 TimeRanges* buffered() const; 122 TimeRanges* buffered() const;
121 void load(); 123 void load();
122 String canPlayType(const String& mimeType) const; 124 String canPlayType(const String& mimeType) const;
123 125
124 // ready state 126 // ready state
125 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR E_DATA, HAVE_ENOUGH_DATA }; 127 enum ReadyState { HAVE_NOTHING, HAVE_METADATA, HAVE_CURRENT_DATA, HAVE_FUTUR E_DATA, HAVE_ENOUGH_DATA };
126 ReadyState getReadyState() const; 128 ReadyState getReadyState() const;
127 bool seeking() const; 129 bool seeking() const;
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 void stopPeriodicTimers(); 340 void stopPeriodicTimers();
339 341
340 void seek(double time); 342 void seek(double time);
341 void finishSeek(); 343 void finishSeek();
342 void checkIfSeekNeeded(); 344 void checkIfSeekNeeded();
343 void addPlayedRange(double start, double end); 345 void addPlayedRange(double start, double end);
344 346
345 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity. 347 void scheduleEvent(const AtomicString& eventName); // FIXME: Rename to sched uleNamedEvent for clarity.
346 348
347 // loading 349 // loading
348 void prepareForLoad(); 350 void invokeLoadAlgorithm();
351 void invokeResourceSelectionAlgorithm();
349 void loadInternal(); 352 void loadInternal();
350 void selectMediaResource(); 353 void selectMediaResource();
351 void loadResource(const KURL&, ContentType&); 354 void loadResource(const KURL&, ContentType&);
352 void startPlayerLoad(); 355 void startPlayerLoad();
353 void setPlayerPreload(); 356 void setPlayerPreload();
354 WebMediaPlayer::LoadType loadType() const; 357 WebMediaPlayer::LoadType loadType() const;
355 void scheduleNextSourceChild(); 358 void scheduleNextSourceChild();
356 void loadNextSourceChild(); 359 void loadNextSourceChild();
357 void clearMediaPlayer(int flags); 360 void clearMediaPlayer();
358 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking(); 361 void clearMediaPlayerAndAudioSourceProviderClientWithoutLocking();
359 bool havePotentialSourceChild(); 362 bool havePotentialSourceChild();
360 void noneSupported(); 363 void noneSupported();
361 void mediaEngineError(MediaError*); 364 void mediaEngineError(MediaError*);
362 void cancelPendingEventsAndCallbacks(); 365 void cancelPendingEventsAndCallbacks();
363 void waitForSourceChange(); 366 void waitForSourceChange();
364 void prepareToPlay(); 367 void setIgnorePreloadNone();
365 368
366 KURL selectNextSourceChild(ContentType*, InvalidURLAction); 369 KURL selectNextSourceChild(ContentType*, InvalidURLAction);
367 370
368 void mediaLoadingFailed(WebMediaPlayer::NetworkState); 371 void mediaLoadingFailed(WebMediaPlayer::NetworkState);
369 372
370 // deferred loading (preload=none) 373 // deferred loading (preload=none)
371 bool loadIsDeferred() const; 374 bool loadIsDeferred() const;
372 void deferLoad(); 375 void deferLoad();
373 void cancelDeferredLoad(); 376 void cancelDeferredLoad();
374 void startDeferredLoad(); 377 void startDeferredLoad();
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
545 bool m_seeking : 1; 548 bool m_seeking : 1;
546 549
547 // data has not been loaded since sending a "stalled" event 550 // data has not been loaded since sending a "stalled" event
548 bool m_sentStalledEvent : 1; 551 bool m_sentStalledEvent : 1;
549 552
550 // time has not changed since sending an "ended" event 553 // time has not changed since sending an "ended" event
551 bool m_sentEndEvent : 1; 554 bool m_sentEndEvent : 1;
552 555
553 bool m_closedCaptionsVisible : 1; 556 bool m_closedCaptionsVisible : 1;
554 557
555 bool m_havePreparedToPlay : 1; 558 bool m_ignorePreloadNone : 1;
556
557 bool m_tracksAreReady : 1; 559 bool m_tracksAreReady : 1;
558 bool m_processingPreferenceChange : 1; 560 bool m_processingPreferenceChange : 1;
559 bool m_remoteRoutesAvailable : 1; 561 bool m_remoteRoutesAvailable : 1;
560 bool m_playingRemotely : 1; 562 bool m_playingRemotely : 1;
561 bool m_isFinalizing : 1; 563 bool m_isFinalizing : 1;
562 bool m_initialPlayWithoutUserGesture : 1; 564 bool m_initialPlayWithoutUserGesture : 1;
563 bool m_autoplayMediaCounted : 1; 565 bool m_autoplayMediaCounted : 1;
564 // Whether this element is in overlay fullscreen mode. 566 // Whether this element is in overlay fullscreen mode.
565 bool m_inOverlayFullscreenVideo : 1; 567 bool m_inOverlayFullscreenVideo : 1;
566 568
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
643 inline bool isHTMLMediaElement(const HTMLElement& element) 645 inline bool isHTMLMediaElement(const HTMLElement& element)
644 { 646 {
645 return isHTMLAudioElement(element) || isHTMLVideoElement(element); 647 return isHTMLAudioElement(element) || isHTMLVideoElement(element);
646 } 648 }
647 649
648 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement); 650 DEFINE_HTMLELEMENT_TYPE_CASTS_WITH_FUNCTION(HTMLMediaElement);
649 651
650 } // namespace blink 652 } // namespace blink
651 653
652 #endif // HTMLMediaElement_h 654 #endif // HTMLMediaElement_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698