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

Unified Diff: third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp

Issue 2343433002: WebSocket Mojo API: set reason when disconnecting a WebSocket interface because of insufficient res… (Closed)
Patch Set: Created 4 years, 3 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
Index: third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp
diff --git a/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp b/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp
index 304b9e7f50b5479d98d559115708b264ecf3d726..3552bee3303231e39a1d028ed8ff994c6fd6499d 100644
--- a/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp
+++ b/third_party/WebKit/Source/modules/websockets/WebSocketHandleImpl.cpp
@@ -45,8 +45,8 @@ void WebSocketHandleImpl::initialize(InterfaceProvider* interfaceProvider)
DCHECK(!m_websocket);
interfaceProvider->getInterface(mojo::GetProxy(&m_websocket));
- m_websocket.set_connection_error_handler(
- convertToBaseCallback(bind(&WebSocketHandleImpl::onConnectionError, unretained(this))));
+ m_websocket.set_connection_error_with_reason_handler(
+ convertToBaseCallback(WTF::bind(&WebSocketHandleImpl::onConnectionError, unretained(this))));
}
void WebSocketHandleImpl::connect(const KURL& url, const Vector<String>& protocols, SecurityOrigin* origin, const KURL& firstPartyForCookies, const String& userAgentOverride, WebSocketHandleClient* client)
@@ -122,7 +122,7 @@ void WebSocketHandleImpl::disconnect()
m_client = nullptr;
}
-void WebSocketHandleImpl::onConnectionError()
+void WebSocketHandleImpl::onConnectionError(uint32_t customReason, const std::string& description)
{
if (!blink::Platform::current()) {
// In the renderrer shutdown sequence, mojo channels are destructed and this
@@ -136,10 +136,7 @@ void WebSocketHandleImpl::onConnectionError()
// Our connection to the WebSocket was dropped. This could be due to
// exceeding the maximum number of concurrent websockets from this process.
- // TODO(darin): Communicate a more specific error here (see crbug/634502).
- OnFailChannel(
- "Error in connection establishment: net:"
- ":ERR_INSUFFICIENT_RESOURCES");
+ OnFailChannel(String::fromUTF8(description.c_str(), description.size()));
dcheng 2016/09/14 16:18:33 It kind of feels like we should be using customRea
yzshen1 2016/09/14 16:26:03 IIUC, this description is displayed in inspector.
darin (slow to review) 2016/09/19 17:36:13 I guess in some cases this message could be empty.
yzshen1 2016/09/19 18:26:48 Done. Thanks!
}
void WebSocketHandleImpl::OnFailChannel(const String& message)

Powered by Google App Engine
This is Rietveld 408576698