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

Side by Side Diff: net/socket_stream/socket_stream.cc

Issue 7185032: WebSocket over SPDY: WebSocketJob handling SpdyWebSocketStream (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: leak fixed (don't call AddRef) Created 9 years, 5 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
« no previous file with comments | « no previous file | net/socket_stream/socket_stream_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // TODO(ukai): code is similar with http_network_transaction.cc. We should 5 // TODO(ukai): code is similar with http_network_transaction.cc. We should
6 // think about ways to share code, if possible. 6 // think about ways to share code, if possible.
7 7
8 #include "net/socket_stream/socket_stream.h" 8 #include "net/socket_stream/socket_stream.h"
9 9
10 #include <set> 10 #include <set>
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 void SocketStream::Finish(int result) { 283 void SocketStream::Finish(int result) {
284 DCHECK(MessageLoop::current()) << 284 DCHECK(MessageLoop::current()) <<
285 "The current MessageLoop must exist"; 285 "The current MessageLoop must exist";
286 DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << 286 DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) <<
287 "The current MessageLoop must be TYPE_IO"; 287 "The current MessageLoop must be TYPE_IO";
288 DCHECK_LE(result, OK); 288 DCHECK_LE(result, OK);
289 if (result == OK) 289 if (result == OK)
290 result = ERR_CONNECTION_CLOSED; 290 result = ERR_CONNECTION_CLOSED;
291 DCHECK_EQ(next_state_, STATE_NONE); 291 DCHECK_EQ(next_state_, STATE_NONE);
292 DVLOG(1) << "Finish result=" << ErrorToString(result); 292 DVLOG(1) << "Finish result=" << ErrorToString(result);
293 if (delegate_)
294 delegate_->OnError(this, result);
295 293
296 metrics_->OnClose(); 294 metrics_->OnClose();
297 Delegate* delegate = delegate_; 295 Delegate* delegate = delegate_;
298 delegate_ = NULL; 296 delegate_ = NULL;
299 if (delegate) { 297 if (delegate) {
300 delegate->OnClose(this); 298 delegate->OnError(this, result);
299 if (result != ERR_PROTOCOL_SWITCHED)
300 delegate->OnClose(this);
301 } 301 }
302 Release(); 302 Release();
303 } 303 }
304 304
305 int SocketStream::DidEstablishConnection() { 305 int SocketStream::DidEstablishConnection() {
306 if (!socket_.get() || !socket_->IsConnected()) { 306 if (!socket_.get() || !socket_->IsConnected()) {
307 next_state_ = STATE_CLOSE; 307 next_state_ = STATE_CLOSE;
308 return ERR_CONNECTION_FAILED; 308 return ERR_CONNECTION_FAILED;
309 } 309 }
310 next_state_ = STATE_READ_WRITE; 310 next_state_ = STATE_READ_WRITE;
(...skipping 767 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 1078
1079 SSLConfigService* SocketStream::ssl_config_service() const { 1079 SSLConfigService* SocketStream::ssl_config_service() const {
1080 return context_->ssl_config_service(); 1080 return context_->ssl_config_service();
1081 } 1081 }
1082 1082
1083 ProxyService* SocketStream::proxy_service() const { 1083 ProxyService* SocketStream::proxy_service() const {
1084 return context_->proxy_service(); 1084 return context_->proxy_service();
1085 } 1085 }
1086 1086
1087 } // namespace net 1087 } // namespace net
OLDNEW
« no previous file with comments | « no previous file | net/socket_stream/socket_stream_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698