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

Side by Side Diff: content/browser/renderer_host/socket_stream_dispatcher_host.cc

Issue 10668018: Websocket should fire 'error' event if no server available (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: For reland (tyoshino) Created 7 years, 7 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h" 5 #include "content/browser/renderer_host/socket_stream_dispatcher_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "content/browser/renderer_host/socket_stream_host.h" 8 #include "content/browser/renderer_host/socket_stream_host.h"
9 #include "content/browser/ssl/ssl_manager.h" 9 #include "content/browser/ssl/ssl_manager.h"
10 #include "content/common/resource_messages.h" 10 #include "content/common/resource_messages.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) { 94 void SocketStreamDispatcherHost::OnClose(net::SocketStream* socket) {
95 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); 95 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);
96 DVLOG(1) << "SocketStreamDispatcherHost::OnClosed socket_id=" << socket_id; 96 DVLOG(1) << "SocketStreamDispatcherHost::OnClosed socket_id=" << socket_id;
97 if (socket_id == kNoSocketId) { 97 if (socket_id == kNoSocketId) {
98 LOG(ERROR) << "NoSocketId in OnClose"; 98 LOG(ERROR) << "NoSocketId in OnClose";
99 return; 99 return;
100 } 100 }
101 DeleteSocketStreamHost(socket_id); 101 DeleteSocketStreamHost(socket_id);
102 } 102 }
103 103
104 void SocketStreamDispatcherHost::OnError(const net::SocketStream* socket,
105 int error) {
106 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);
107 DVLOG(1) << "SocketStreamDispatcherHost::OnError socket_id=" << socket_id;
108 if (socket_id == content::kNoSocketId) {
109 LOG(ERROR) << "NoSocketId in OnError";
110 return;
111 }
112 // SocketStream::Delegate::OnError() events are handled as WebSocket error
113 // event when user agent was required to fail WebSocket connection or the
114 // WebSocket connection is closed with prejudice.
115 if (!Send(new SocketStreamMsg_Failed(socket_id, error))) {
116 LOG(ERROR) << "SocketStreamMsg_Failed failed.";
117 DeleteSocketStreamHost(socket_id);
118 }
119 }
120
104 void SocketStreamDispatcherHost::OnSSLCertificateError( 121 void SocketStreamDispatcherHost::OnSSLCertificateError(
105 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { 122 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) {
106 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); 123 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);
107 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" 124 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id="
108 << socket_id; 125 << socket_id;
109 if (socket_id == kNoSocketId) { 126 if (socket_id == kNoSocketId) {
110 LOG(ERROR) << "NoSocketId in OnSSLCertificateError"; 127 LOG(ERROR) << "NoSocketId in OnSSLCertificateError";
111 return; 128 return;
112 } 129 }
113 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); 130 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id);
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 LOG(ERROR) << "SocketStreamMsg_Closed failed."; 240 LOG(ERROR) << "SocketStreamMsg_Closed failed.";
224 } 241 }
225 } 242 }
226 243
227 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { 244 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() {
228 return url_request_context_selector_->GetRequestContext( 245 return url_request_context_selector_->GetRequestContext(
229 ResourceType::SUB_RESOURCE); 246 ResourceType::SUB_RESOURCE);
230 } 247 }
231 248
232 } // namespace content 249 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/socket_stream_dispatcher_host.h ('k') | content/browser/renderer_host/socket_stream_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698