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

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, 2 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/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 c7f9e9baefebb695f4a25310e8cc5aeb7c57cccf..0a7fd8e477dd0eb9ded77dfd6bb2f75c5a069d32 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"
@@ -256,8 +257,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;
@@ -388,6 +387,15 @@ 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.
+ const unsigned short abnormalClosure = 1006;
abarth-chromium 2013/10/31 17:54:49 Where does this number come from? If it's in the
yhirano 2013/11/01 03:51:47 Done.
+ didClose(handle, false, abnormalClosure, "");
+ // |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);
@@ -439,9 +447,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