| Index: content/child/websocket_bridge.cc
|
| diff --git a/content/child/websocket_bridge.cc b/content/child/websocket_bridge.cc
|
| index e1810dd64789802b25d4be5803eec365a576aab6..27ae565212ab19d780b228bdc9c1261ff0fcce05 100644
|
| --- a/content/child/websocket_bridge.cc
|
| +++ b/content/child/websocket_bridge.cc
|
| @@ -31,10 +31,25 @@ using WebKit::WebVector;
|
|
|
| namespace content {
|
|
|
| +namespace {
|
| +
|
| +const unsigned short kAbnormalShutdownOpCode = 1006;
|
| +
|
| +} // namespace
|
| +
|
| WebSocketBridge::WebSocketBridge()
|
| : channel_id_(kInvalidChannelId), client_(NULL) {}
|
|
|
| WebSocketBridge::~WebSocketBridge() {
|
| + if (channel_id_ != kInvalidChannelId) {
|
| + // The connection is abruptly disconnected by the renderer without
|
| + // closing handshake.
|
| + ChildThread::current()->Send(
|
| + new WebSocketMsg_DropChannel(channel_id_,
|
| + true,
|
| + kAbnormalShutdownOpCode,
|
| + std::string()));
|
| + }
|
| Disconnect();
|
| }
|
|
|
| @@ -106,9 +121,11 @@ void WebSocketBridge::DidReceiveFlowControl(int64_t quota) {
|
| // |this| can be deleted here.
|
| }
|
|
|
| -void WebSocketBridge::DidClose(unsigned short code,
|
| +void WebSocketBridge::DidClose(bool fail,
|
| + unsigned short code,
|
| const std::string& reason) {
|
| DVLOG(1) << "WebSocketBridge::DidClose("
|
| + << fail << ", "
|
| << code << ", "
|
| << reason << ")";
|
| WebSocketHandleClient* client = client_;
|
| @@ -117,7 +134,7 @@ void WebSocketBridge::DidClose(unsigned short code,
|
| return;
|
|
|
| WebString reason_to_pass = WebString::fromUTF8(reason);
|
| - client->didClose(this, code, reason_to_pass);
|
| + client->didClose(this, fail, code, reason_to_pass);
|
| // |this| can be deleted here.
|
| }
|
|
|
| @@ -197,8 +214,9 @@ void WebSocketBridge::close(unsigned short code,
|
| std::string reason_to_pass = reason.utf8();
|
| DVLOG(1) << "Bridge #" << channel_id_ << " Close("
|
| << code << ", " << reason_to_pass << ")";
|
| + // This method is for closing handshake and hence |fail| shall be false.
|
| ChildThread::current()->Send(
|
| - new WebSocketMsg_DropChannel(channel_id_, code, reason_to_pass));
|
| + new WebSocketMsg_DropChannel(channel_id_, false, code, reason_to_pass));
|
| }
|
|
|
| void WebSocketBridge::Disconnect() {
|
|
|