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

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: did some rebased work Created 7 years, 8 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 }
tyoshino (SeeGerritForStatus) 2013/04/15 14:23:28 Not to surprise reader, please write some short co
Li Yin 2013/04/16 12:07:37 There is an issue here. OnError is almost called t
tyoshino (SeeGerritForStatus) 2013/04/17 08:15:49 Oh, right. We need to fix SocketStream. Could you
112 if (!Send(new SocketStreamMsg_Failed(socket_id, error))) {
113 LOG(ERROR) << "SocketStreamMsg_Failed failed.";
tyoshino (SeeGerritForStatus) 2013/04/15 14:23:28 Add DeleteSocketStreamHost(socket_id); ?
Li Yin 2013/04/16 12:07:37 Good catch. I'll fix it. Thanks.
114 }
115 }
116
104 void SocketStreamDispatcherHost::OnSSLCertificateError( 117 void SocketStreamDispatcherHost::OnSSLCertificateError(
105 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) { 118 net::SocketStream* socket, const net::SSLInfo& ssl_info, bool fatal) {
106 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket); 119 int socket_id = SocketStreamHost::SocketIdFromSocketStream(socket);
107 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id=" 120 DVLOG(1) << "SocketStreamDispatcherHost::OnSSLCertificateError socket_id="
108 << socket_id; 121 << socket_id;
109 if (socket_id == kNoSocketId) { 122 if (socket_id == kNoSocketId) {
110 LOG(ERROR) << "NoSocketId in OnSSLCertificateError"; 123 LOG(ERROR) << "NoSocketId in OnSSLCertificateError";
111 return; 124 return;
112 } 125 }
113 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); 126 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."; 236 LOG(ERROR) << "SocketStreamMsg_Closed failed.";
224 } 237 }
225 } 238 }
226 239
227 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() { 240 net::URLRequestContext* SocketStreamDispatcherHost::GetURLRequestContext() {
228 return url_request_context_selector_->GetRequestContext( 241 return url_request_context_selector_->GetRequestContext(
229 ResourceType::SUB_RESOURCE); 242 ResourceType::SUB_RESOURCE);
230 } 243 }
231 244
232 } // namespace content 245 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698