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

Unified Diff: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp

Issue 2464163004: [RemotePlayback] Implement 'connecting' state (Closed)
Patch Set: Rebased Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
diff --git a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
index 88530f205fd29c710f6d891543122b4dc6d3f546..86c69e2d965117b42174b68a91101bc8e12f2349 100644
--- a/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
+++ b/third_party/WebKit/Source/modules/remoteplayback/RemotePlayback.cpp
@@ -205,11 +205,9 @@ void RemotePlayback::notifyInitialAvailability(int callbackId) {
}
void RemotePlayback::stateChanged(WebRemotePlaybackState state) {
- // We may get a "disconnected" state change while in the "disconnected"
- // state if initiated connection fails. So cleanup the promise resolvers
- // before checking if anything changed.
- // TODO(avayvod): cleanup this logic when implementing the "connecting"
- // state.
+ if (m_state == state)
+ return;
+
if (m_promptPromiseResolver) {
// Changing state to Disconnected from "disconnected" or "connecting" means
// that establishing connection with remote playback device failed.
@@ -220,14 +218,15 @@ void RemotePlayback::stateChanged(WebRemotePlaybackState state) {
m_promptPromiseResolver->reject(DOMException::create(
AbortError, "Failed to connect to the remote device."));
} else {
+ DCHECK((m_state == WebRemotePlaybackState::Disconnected &&
+ state == WebRemotePlaybackState::Connecting) ||
+ (m_state == WebRemotePlaybackState::Connected &&
+ state == WebRemotePlaybackState::Disconnected));
m_promptPromiseResolver->resolve();
}
m_promptPromiseResolver = nullptr;
}
- if (m_state == state)
- return;
-
m_state = state;
switch (m_state) {
case WebRemotePlaybackState::Connecting:
« no previous file with comments | « third_party/WebKit/Source/core/html/HTMLMediaElement.cpp ('k') | third_party/WebKit/public/platform/WebMediaPlayerClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698