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

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

Issue 36033003: Notify WebSocket connection failure, Blink side (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 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
« no previous file with comments | « Source/modules/websockets/NewWebSocketChannelImpl.h ('k') | public/platform/WebSocketHandleClient.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/websockets/NewWebSocketChannelImpl.cpp
diff --git a/Source/modules/websockets/NewWebSocketChannelImpl.cpp b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
index 1f04b2a847f0e5855e91bce8bac5ce44dab417cd..51c441e2cdab9f64646ac20235642af007d3c143 100644
--- a/Source/modules/websockets/NewWebSocketChannelImpl.cpp
+++ b/Source/modules/websockets/NewWebSocketChannelImpl.cpp
@@ -45,6 +45,7 @@
#include "modules/websockets/WebSocketChannel.h"
#include "modules/websockets/WebSocketChannelClient.h"
#include "platform/Logging.h"
+#include "platform/NotImplemented.h"
#include "public/platform/Platform.h"
#include "public/platform/WebSocketHandle.h"
#include "public/platform/WebString.h"
@@ -261,8 +262,6 @@ void NewWebSocketChannelImpl::disconnect()
if (m_identifier)
InspectorInstrumentation::didCloseWebSocket(document(), m_identifier);
abortAsyncOperations();
- if (m_handle)
- m_handle->close(CloseEventCodeAbnormalClosure, "");
m_handle.clear();
m_client = 0;
m_identifier = 0;
@@ -393,6 +392,16 @@ void NewWebSocketChannelImpl::didConnect(WebSocketHandle* handle, bool fail, con
m_client->didConnect();
}
+void NewWebSocketChannelImpl::didFail(WebSocketHandle* handle, const WebKit::WebString& message)
+{
+ LOG(Network, "NewWebSocketChannelImpl %p didFail(%p, %s)", this, handle, message.utf8().data());
+ // FIXME: Hande the failure correctly.
+ // CloseEventCodeAbnormalClosure is the closing code for the closure
+ // without sending or receiving a Close control frame.
+ didClose(handle, false, CloseEventCodeAbnormalClosure, WebKit::WebString());
+ // |this| may be deleted.
+}
+
void NewWebSocketChannelImpl::didReceiveData(WebSocketHandle* handle, bool fin, WebSocketHandle::MessageType type, const char* data, size_t size)
{
LOG(Network, "NewWebSocketChannelImpl %p didReceiveData(%p, %d, %d, (%p, %zu))", this, handle, fin, type, data, size);
@@ -444,9 +453,10 @@ void NewWebSocketChannelImpl::didReceiveData(WebSocketHandle* handle, bool fin,
}
}
-void NewWebSocketChannelImpl::didClose(WebSocketHandle* handle, unsigned short code, const WebKit::WebString& reason)
+void NewWebSocketChannelImpl::didClose(WebSocketHandle* handle, bool wasClean, unsigned short code, const WebKit::WebString& reason)
{
- LOG(Network, "NewWebSocketChannelImpl %p didClose(%p, %u, %s)", this, handle, code, String(reason).utf8().data());
+ // FIXME: Use |wasClean| appropriately.
+ LOG(Network, "NewWebSocketChannelImpl %p didClose(%p, %d, %u, %s)", this, handle, wasClean, code, String(reason).utf8().data());
ASSERT(m_handle);
m_handle.clear();
if (m_identifier) {
« no previous file with comments | « Source/modules/websockets/NewWebSocketChannelImpl.h ('k') | public/platform/WebSocketHandleClient.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698