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

Side by Side Diff: remoting/protocol/fake_session.h

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 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_ 5 #ifndef REMOTING_PROTOCOL_FAKE_SESSION_H_
6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_ 6 #define REMOTING_PROTOCOL_FAKE_SESSION_H_
7 7
8 #include <map> 8 #include <map>
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 22 matching lines...) Expand all
33 33
34 const std::string& written_data() const { return written_data_; } 34 const std::string& written_data() const { return written_data_; }
35 35
36 void AppendInputData(const char* data, int data_size); 36 void AppendInputData(const char* data, int data_size);
37 int input_pos() const { return input_pos_; } 37 int input_pos() const { return input_pos_; }
38 bool read_pending() const { return read_pending_; } 38 bool read_pending() const { return read_pending_; }
39 39
40 // net::Socket implementation. 40 // net::Socket implementation.
41 virtual int Read(net::IOBuffer* buf, int buf_len, 41 virtual int Read(net::IOBuffer* buf, int buf_len,
42 net::OldCompletionCallback* callback) OVERRIDE; 42 net::OldCompletionCallback* callback) OVERRIDE;
43 virtual int Read(net::IOBuffer* buf, int buf_len,
44 const net::CompletionCallback& callback) OVERRIDE;
43 virtual int Write(net::IOBuffer* buf, int buf_len, 45 virtual int Write(net::IOBuffer* buf, int buf_len,
44 net::OldCompletionCallback* callback) OVERRIDE; 46 net::OldCompletionCallback* callback) OVERRIDE;
45 47
46 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 48 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
47 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 49 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
48 50
49 // net::StreamSocket implementation. 51 // net::StreamSocket implementation.
50 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE; 52 virtual int Connect(net::OldCompletionCallback* callback) OVERRIDE;
51 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE; 53 virtual int Connect(const net::CompletionCallback& callback) OVERRIDE;
52 virtual void Disconnect() OVERRIDE; 54 virtual void Disconnect() OVERRIDE;
53 virtual bool IsConnected() const OVERRIDE; 55 virtual bool IsConnected() const OVERRIDE;
54 virtual bool IsConnectedAndIdle() const OVERRIDE; 56 virtual bool IsConnectedAndIdle() const OVERRIDE;
55 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE; 57 virtual int GetPeerAddress(net::AddressList* address) const OVERRIDE;
56 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE; 58 virtual int GetLocalAddress(net::IPEndPoint* address) const OVERRIDE;
57 virtual const net::BoundNetLog& NetLog() const OVERRIDE; 59 virtual const net::BoundNetLog& NetLog() const OVERRIDE;
58 virtual void SetSubresourceSpeculation() OVERRIDE; 60 virtual void SetSubresourceSpeculation() OVERRIDE;
59 virtual void SetOmniboxSpeculation() OVERRIDE; 61 virtual void SetOmniboxSpeculation() OVERRIDE;
60 virtual bool WasEverUsed() const OVERRIDE; 62 virtual bool WasEverUsed() const OVERRIDE;
61 virtual bool UsingTCPFastOpen() const OVERRIDE; 63 virtual bool UsingTCPFastOpen() const OVERRIDE;
62 virtual int64 NumBytesRead() const OVERRIDE; 64 virtual int64 NumBytesRead() const OVERRIDE;
63 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; 65 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
64 66
65 private: 67 private:
66 bool read_pending_; 68 bool read_pending_;
67 scoped_refptr<net::IOBuffer> read_buffer_; 69 scoped_refptr<net::IOBuffer> read_buffer_;
68 int read_buffer_size_; 70 int read_buffer_size_;
69 net::OldCompletionCallback* read_callback_; 71 net::OldCompletionCallback* old_read_callback_;
72 net::CompletionCallback read_callback_;
James Hawkins 2011/12/07 00:01:57 #include "net/base/completion_callback.h"
James Hawkins 2011/12/07 00:08:11 Done.
70 73
71 std::string written_data_; 74 std::string written_data_;
72 std::string input_data_; 75 std::string input_data_;
73 int input_pos_; 76 int input_pos_;
74 77
75 net::BoundNetLog net_log_; 78 net::BoundNetLog net_log_;
76 79
77 MessageLoop* message_loop_; 80 MessageLoop* message_loop_;
78 81
79 DISALLOW_COPY_AND_ASSIGN(FakeSocket); 82 DISALLOW_COPY_AND_ASSIGN(FakeSocket);
(...skipping 10 matching lines...) Expand all
90 const std::vector<std::string>& written_packets() const { 93 const std::vector<std::string>& written_packets() const {
91 return written_packets_; 94 return written_packets_;
92 } 95 }
93 96
94 void AppendInputPacket(const char* data, int data_size); 97 void AppendInputPacket(const char* data, int data_size);
95 int input_pos() const { return input_pos_; } 98 int input_pos() const { return input_pos_; }
96 99
97 // net::Socket implementation. 100 // net::Socket implementation.
98 virtual int Read(net::IOBuffer* buf, int buf_len, 101 virtual int Read(net::IOBuffer* buf, int buf_len,
99 net::OldCompletionCallback* callback) OVERRIDE; 102 net::OldCompletionCallback* callback) OVERRIDE;
103 virtual int Read(net::IOBuffer* buf, int buf_len,
104 const net::CompletionCallback& callback) OVERRIDE;
100 virtual int Write(net::IOBuffer* buf, int buf_len, 105 virtual int Write(net::IOBuffer* buf, int buf_len,
101 net::OldCompletionCallback* callback) OVERRIDE; 106 net::OldCompletionCallback* callback) OVERRIDE;
102 107
103 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE; 108 virtual bool SetReceiveBufferSize(int32 size) OVERRIDE;
104 virtual bool SetSendBufferSize(int32 size) OVERRIDE; 109 virtual bool SetSendBufferSize(int32 size) OVERRIDE;
105 110
106 private: 111 private:
107 bool read_pending_; 112 bool read_pending_;
108 scoped_refptr<net::IOBuffer> read_buffer_; 113 scoped_refptr<net::IOBuffer> read_buffer_;
109 int read_buffer_size_; 114 int read_buffer_size_;
110 net::OldCompletionCallback* read_callback_; 115 net::OldCompletionCallback* old_read_callback_;
116 net::CompletionCallback read_callback_;
111 117
112 std::vector<std::string> written_packets_; 118 std::vector<std::string> written_packets_;
113 std::vector<std::string> input_packets_; 119 std::vector<std::string> input_packets_;
114 int input_pos_; 120 int input_pos_;
115 121
116 MessageLoop* message_loop_; 122 MessageLoop* message_loop_;
117 123
118 DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket); 124 DISALLOW_COPY_AND_ASSIGN(FakeUdpSocket);
119 }; 125 };
120 126
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 Session::Error error_; 179 Session::Error error_;
174 bool closed_; 180 bool closed_;
175 181
176 DISALLOW_COPY_AND_ASSIGN(FakeSession); 182 DISALLOW_COPY_AND_ASSIGN(FakeSession);
177 }; 183 };
178 184
179 } // namespace protocol 185 } // namespace protocol
180 } // namespace remoting 186 } // namespace remoting
181 187
182 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_ 188 #endif // REMOTING_PROTOCOL_FAKE_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698