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

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

Issue 1716007: Cleanup: Address some of the todos in net_log.h... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Address willchan's comments Created 10 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
« no previous file with comments | « net/socket/tcp_client_socket_win.cc ('k') | net/url_request/url_request.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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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 <string> 10 #include <string>
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 "The current MessageLoop must be TYPE_IO"; 114 "The current MessageLoop must be TYPE_IO";
115 if (context_) 115 if (context_)
116 ssl_config_service()->GetSSLConfig(&ssl_config_); 116 ssl_config_service()->GetSSLConfig(&ssl_config_);
117 DCHECK_EQ(next_state_, STATE_NONE); 117 DCHECK_EQ(next_state_, STATE_NONE);
118 118
119 AddRef(); // Released in Finish() 119 AddRef(); // Released in Finish()
120 // Open a connection asynchronously, so that delegate won't be called 120 // Open a connection asynchronously, so that delegate won't be called
121 // back before returning Connect(). 121 // back before returning Connect().
122 next_state_ = STATE_RESOLVE_PROXY; 122 next_state_ = STATE_RESOLVE_PROXY;
123 net_log_.BeginEventWithString(NetLog::TYPE_SOCKET_STREAM_CONNECT, 123 net_log_.BeginEventWithString(NetLog::TYPE_SOCKET_STREAM_CONNECT,
124 url_.possibly_invalid_spec()); 124 "url", url_.possibly_invalid_spec());
125 MessageLoop::current()->PostTask( 125 MessageLoop::current()->PostTask(
126 FROM_HERE, 126 FROM_HERE,
127 NewRunnableMethod(this, &SocketStream::DoLoop, OK)); 127 NewRunnableMethod(this, &SocketStream::DoLoop, OK));
128 } 128 }
129 129
130 bool SocketStream::SendData(const char* data, int len) { 130 bool SocketStream::SendData(const char* data, int len) {
131 DCHECK(MessageLoop::current()) << 131 DCHECK(MessageLoop::current()) <<
132 "The current MessageLoop must exist"; 132 "The current MessageLoop must exist";
133 DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) << 133 DCHECK_EQ(MessageLoop::TYPE_IO, MessageLoop::current()->type()) <<
134 "The current MessageLoop must be TYPE_IO"; 134 "The current MessageLoop must be TYPE_IO";
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
399 return; 399 return;
400 default: 400 default:
401 NOTREACHED() << "bad state"; 401 NOTREACHED() << "bad state";
402 Finish(result); 402 Finish(result);
403 return; 403 return;
404 } 404 }
405 // If the connection is not established yet and had actual errors, 405 // If the connection is not established yet and had actual errors,
406 // close the connection. 406 // close the connection.
407 if (state != STATE_READ_WRITE && result < ERR_IO_PENDING) { 407 if (state != STATE_READ_WRITE && result < ERR_IO_PENDING) {
408 DCHECK_EQ(next_state_, STATE_CLOSE); 408 DCHECK_EQ(next_state_, STATE_CLOSE);
409 net_log_.EndEventWithInteger(NetLog::TYPE_SOCKET_STREAM_CONNECT, result); 409 net_log_.EndEventWithInteger(NetLog::TYPE_SOCKET_STREAM_CONNECT,
410 "net_error", result);
410 } 411 }
411 } while (result != ERR_IO_PENDING); 412 } while (result != ERR_IO_PENDING);
412 } 413 }
413 414
414 int SocketStream::DoResolveProxy() { 415 int SocketStream::DoResolveProxy() {
415 DCHECK(!pac_request_); 416 DCHECK(!pac_request_);
416 next_state_ = STATE_RESOLVE_PROXY_COMPLETE; 417 next_state_ = STATE_RESOLVE_PROXY_COMPLETE;
417 418
418 if (!proxy_url_.is_valid()) { 419 if (!proxy_url_.is_valid()) {
419 next_state_ = STATE_CLOSE; 420 next_state_ = STATE_CLOSE;
(...skipping 519 matching lines...) Expand 10 before | Expand all | Expand 10 after
939 940
940 SSLConfigService* SocketStream::ssl_config_service() const { 941 SSLConfigService* SocketStream::ssl_config_service() const {
941 return context_->ssl_config_service(); 942 return context_->ssl_config_service();
942 } 943 }
943 944
944 ProxyService* SocketStream::proxy_service() const { 945 ProxyService* SocketStream::proxy_service() const {
945 return context_->proxy_service(); 946 return context_->proxy_service();
946 } 947 }
947 948
948 } // namespace net 949 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_client_socket_win.cc ('k') | net/url_request/url_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698