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

Unified Diff: Source/modules/websockets/WebSocketChannel.cpp

Issue 13776002: MediaStream should fire ended event when all tracks are ended (Closed) Base URL: https://chromium.googlesource.com/chromium/blink@master
Patch Set: The patch is migrated from WebKit #bug 87336 Created 7 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/modules/websockets/WebSocketChannel.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/WebSocketChannel.cpp
diff --git a/Source/modules/websockets/WebSocketChannel.cpp b/Source/modules/websockets/WebSocketChannel.cpp
index 344c8b485df322a040890b43553efd2fcdedcba4..776cee48c23aca4104cbb8d963074b723056e2a5 100644
--- a/Source/modules/websockets/WebSocketChannel.cpp
+++ b/Source/modules/websockets/WebSocketChannel.cpp
@@ -75,6 +75,7 @@ WebSocketChannel::WebSocketChannel(Document* document, WebSocketChannelClient* c
, m_resumeTimer(this, &WebSocketChannel::resumeTimerFired)
, m_suspended(false)
, m_closing(false)
+ , m_failed(false)
, m_receivedClosingHandshake(false)
, m_closingTimer(this, &WebSocketChannel::closingTimerFired)
, m_closed(false)
@@ -207,7 +208,10 @@ void WebSocketChannel::fail(const String& reason)
m_deflateFramer.didFail();
m_hasContinuousFrame = false;
m_continuousFrameData.clear();
- m_client->didReceiveMessageError();
+ if (!m_failed) {
+ m_failed = true;
+ m_client->didReceiveMessageError();
+ }
if (m_handle && !m_closed)
m_handle->disconnect(); // Will call didClose().
@@ -322,20 +326,27 @@ void WebSocketChannel::didUpdateBufferedAmount(SocketStreamHandle*, size_t buffe
void WebSocketChannel::didFailSocketStream(SocketStreamHandle* handle, const SocketStreamError& error)
{
LOG(Network, "WebSocketChannel %p didFailSocketStream()", this);
- ASSERT(handle == m_handle || !m_handle);
- if (m_document) {
- String message;
- if (error.isNull())
- message = "WebSocket network error";
- else if (error.localizedDescription().isNull())
- message = "WebSocket network error: error code " + String::number(error.errorCode());
- else
- message = "WebSocket network error: " + error.localizedDescription();
- InspectorInstrumentation::didReceiveWebSocketFrameError(m_document, m_identifier, message);
- m_document->addConsoleMessage(NetworkMessageSource, ErrorMessageLevel, message);
- }
+ ASSERT_UNUSED(handle, handle == m_handle || !m_handle);
m_shouldDiscardReceivedData = true;
- handle->disconnect();
+ String message;
+ if (error.isNull())
+ message = "WebSocket network error";
+ else if (error.localizedDescription().isNull())
+ message = "WebSocket network error: error code " + String::number(error.errorCode());
+ else
+ message = "WebSocket network error: error code " + String::number(error.errorCode()) + ", " + error.localizedDescription();
+ String failingURL = error.failingURL();
+ ASSERT(failingURL.isNull() || m_handshake->url().string() == failingURL);
+ if (failingURL.isNull())
+ failingURL = m_handshake->url().string();
+ LOG(Network, "Error Message: %s, FailURL: %s", message.utf8().data(), failingURL.utf8().data());
+ RefPtr<WebSocketChannel> protect(this);
+ if (m_client && !m_closing && !m_failed) {
+ m_failed = true;
+ m_client->didReceiveMessageError();
+ }
+ if (m_handle && !m_closed)
+ m_handle->disconnect();
}
void WebSocketChannel::didReceiveAuthenticationChallenge(SocketStreamHandle*, const AuthenticationChallenge&)
« no previous file with comments | « Source/modules/websockets/WebSocketChannel.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698