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

Side by Side Diff: chrome/browser/sync/notifier/communicator/ssl_socket_adapter.cc

Issue 1696005: Add net log entries that summarize transmit and receive byte counts. (Closed)
Patch Set: More tests and address comments Created 10 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
« no previous file with comments | « chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h ('k') | net/base/net_log.h » ('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) 2009 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 #include "chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h" 5 #include "chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/net/url_request_context_getter.h" 9 #include "chrome/browser/net/url_request_context_getter.h"
10 #include "chrome/browser/profile.h" 10 #include "chrome/browser/profile.h"
11 #include "net/base/address_list.h" 11 #include "net/base/address_list.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 // SSLConfigService is not thread-safe, and the default values for SSLConfig 96 // SSLConfigService is not thread-safe, and the default values for SSLConfig
97 // are correct for us, so we don't use the config service to initialize this 97 // are correct for us, so we don't use the config service to initialize this
98 // object. 98 // object.
99 net::SSLConfig ssl_config; 99 net::SSLConfig ssl_config;
100 transport_socket_->set_addr(talk_base::SocketAddress(hostname_.c_str())); 100 transport_socket_->set_addr(talk_base::SocketAddress(hostname_.c_str()));
101 ssl_socket_.reset( 101 ssl_socket_.reset(
102 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket( 102 net::ClientSocketFactory::GetDefaultFactory()->CreateSSLClientSocket(
103 transport_socket_, hostname_.c_str(), ssl_config)); 103 transport_socket_, hostname_.c_str(), ssl_config));
104 104
105 int result = ssl_socket_->Connect(&connected_callback_, NULL); 105 int result = ssl_socket_->Connect(&connected_callback_);
106 106
107 if (result == net::ERR_IO_PENDING || result == net::OK) { 107 if (result == net::ERR_IO_PENDING || result == net::OK) {
108 return 0; 108 return 0;
109 } else { 109 } else {
110 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result); 110 LOG(ERROR) << "Could not start SSL: " << net::ErrorToString(result);
111 return result; 111 return result;
112 } 112 }
113 } 113 }
114 114
115 int SSLSocketAdapter::Send(const void* buf, size_t len) { 115 int SSLSocketAdapter::Send(const void* buf, size_t len) {
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 SSLSocketAdapter *ssl_adapter) 231 SSLSocketAdapter *ssl_adapter)
232 : connect_callback_(NULL), 232 : connect_callback_(NULL),
233 read_callback_(NULL), 233 read_callback_(NULL),
234 write_callback_(NULL), 234 write_callback_(NULL),
235 read_buffer_len_(0), 235 read_buffer_len_(0),
236 write_buffer_len_(0), 236 write_buffer_len_(0),
237 socket_(socket) { 237 socket_(socket) {
238 socket_->SignalConnectEvent.connect(this, &TransportSocket::OnConnectEvent); 238 socket_->SignalConnectEvent.connect(this, &TransportSocket::OnConnectEvent);
239 } 239 }
240 240
241 int TransportSocket::Connect(net::CompletionCallback* callback, 241 int TransportSocket::Connect(net::CompletionCallback* callback) {
242 const net::BoundNetLog& /* net_log */) {
243 connect_callback_ = callback; 242 connect_callback_ = callback;
244 return socket_->Connect(addr_); 243 return socket_->Connect(addr_);
245 } 244 }
246 245
247 void TransportSocket::Disconnect() { 246 void TransportSocket::Disconnect() {
248 socket_->Close(); 247 socket_->Close();
249 } 248 }
250 249
251 bool TransportSocket::IsConnected() const { 250 bool TransportSocket::IsConnected() const {
252 return (socket_->GetState() == talk_base::Socket::CS_CONNECTED); 251 return (socket_->GetState() == talk_base::Socket::CS_CONNECTED);
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 } 382 }
384 callback->RunWithParams(Tuple1<int>(result)); 383 callback->RunWithParams(Tuple1<int>(result));
385 return true; 384 return true;
386 } else { 385 } else {
387 LOG(WARNING) << "OnWriteEvent called with no callback."; 386 LOG(WARNING) << "OnWriteEvent called with no callback.";
388 return false; 387 return false;
389 } 388 }
390 } 389 }
391 390
392 } // namespace notifier 391 } // namespace notifier
OLDNEW
« no previous file with comments | « chrome/browser/sync/notifier/communicator/ssl_socket_adapter.h ('k') | net/base/net_log.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698