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

Side by Side Diff: jingle/notifier/base/fake_ssl_client_socket.cc

Issue 8801005: base::Bind: Convert Socket::Read. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase. Created 9 years 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) 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 #include "jingle/notifier/base/fake_ssl_client_socket.h" 5 #include "jingle/notifier/base/fake_ssl_client_socket.h"
6 6
7 #include <cstdlib> 7 #include <cstdlib>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 old_user_connect_callback_(NULL), 92 old_user_connect_callback_(NULL),
93 write_buf_(NewDrainableIOBufferWithSize(arraysize(kSslClientHello))), 93 write_buf_(NewDrainableIOBufferWithSize(arraysize(kSslClientHello))),
94 read_buf_(NewDrainableIOBufferWithSize(arraysize(kSslServerHello))) { 94 read_buf_(NewDrainableIOBufferWithSize(arraysize(kSslServerHello))) {
95 CHECK(transport_socket_.get()); 95 CHECK(transport_socket_.get());
96 std::memcpy(write_buf_->data(), kSslClientHello, arraysize(kSslClientHello)); 96 std::memcpy(write_buf_->data(), kSslClientHello, arraysize(kSslClientHello));
97 } 97 }
98 98
99 FakeSSLClientSocket::~FakeSSLClientSocket() {} 99 FakeSSLClientSocket::~FakeSSLClientSocket() {}
100 100
101 int FakeSSLClientSocket::Read(net::IOBuffer* buf, int buf_len, 101 int FakeSSLClientSocket::Read(net::IOBuffer* buf, int buf_len,
102 net::OldCompletionCallback* callback) { 102 net::OldCompletionCallback* callback) {
103 DCHECK_EQ(next_handshake_state_, STATE_NONE); 103 DCHECK_EQ(next_handshake_state_, STATE_NONE);
104 DCHECK(handshake_completed_); 104 DCHECK(handshake_completed_);
105 return transport_socket_->Read(buf, buf_len, callback); 105 return transport_socket_->Read(buf, buf_len, callback);
106 }
107 int FakeSSLClientSocket::Read(net::IOBuffer* buf, int buf_len,
108 const net::CompletionCallback& callback) {
109 DCHECK_EQ(next_handshake_state_, STATE_NONE);
110 DCHECK(handshake_completed_);
111 return transport_socket_->Read(buf, buf_len, callback);
106 } 112 }
107 113
108 int FakeSSLClientSocket::Write(net::IOBuffer* buf, int buf_len, 114 int FakeSSLClientSocket::Write(net::IOBuffer* buf, int buf_len,
109 net::OldCompletionCallback* callback) { 115 net::OldCompletionCallback* callback) {
110 DCHECK_EQ(next_handshake_state_, STATE_NONE); 116 DCHECK_EQ(next_handshake_state_, STATE_NONE);
111 DCHECK(handshake_completed_); 117 DCHECK(handshake_completed_);
112 return transport_socket_->Write(buf, buf_len, callback); 118 return transport_socket_->Write(buf, buf_len, callback);
113 } 119 }
114 120
115 bool FakeSSLClientSocket::SetReceiveBufferSize(int32 size) { 121 bool FakeSSLClientSocket::SetReceiveBufferSize(int32 size) {
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 369
364 int64 FakeSSLClientSocket::NumBytesRead() const { 370 int64 FakeSSLClientSocket::NumBytesRead() const {
365 return transport_socket_->NumBytesRead(); 371 return transport_socket_->NumBytesRead();
366 } 372 }
367 373
368 base::TimeDelta FakeSSLClientSocket::GetConnectTimeMicros() const { 374 base::TimeDelta FakeSSLClientSocket::GetConnectTimeMicros() const {
369 return transport_socket_->GetConnectTimeMicros(); 375 return transport_socket_->GetConnectTimeMicros();
370 } 376 }
371 377
372 } // namespace notifier 378 } // namespace notifier
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698