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

Unified Diff: remoting/protocol/fake_datagram_socket.h

Issue 1197853003: Add P2PDatagramSocket and P2PStreamSocket interfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/fake_authenticator.cc ('k') | remoting/protocol/fake_datagram_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_datagram_socket.h
diff --git a/remoting/protocol/fake_datagram_socket.h b/remoting/protocol/fake_datagram_socket.h
index 9669c0bd01cccc2be970dbe21b46bee6c1edfb32..7270e1d8ca5f04d2949a0cdb14c3825b5820a9d9 100644
--- a/remoting/protocol/fake_datagram_socket.h
+++ b/remoting/protocol/fake_datagram_socket.h
@@ -12,8 +12,8 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "net/base/completion_callback.h"
-#include "net/socket/socket.h"
#include "remoting/protocol/datagram_channel_factory.h"
+#include "remoting/protocol/p2p_datagram_socket.h"
namespace base {
class SingleThreadTaskRunner;
@@ -22,7 +22,7 @@ class SingleThreadTaskRunner;
namespace remoting {
namespace protocol {
-// FakeDatagramSocket implement net::StreamSocket interface. All data written to
+// FakeDatagramSocket implement P2PStreamSocket interface. All data written to
// FakeDatagramSocket is stored in a buffer returned by written_packets().
// Read() reads data from another buffer that can be set with
// AppendInputPacket(). Pending reads are supported, so if there is a pending
@@ -32,7 +32,7 @@ namespace protocol {
// PairWith() method, e.g.: a->PairWith(b). After this all data
// written to |a| can be read from |b| and vice versa. Two connected
// sockets |a| and |b| must be created and used on the same thread.
-class FakeDatagramSocket : public net::Socket {
+class FakeDatagramSocket : public P2PDatagramSocket {
public:
FakeDatagramSocket();
~FakeDatagramSocket() override;
@@ -44,7 +44,7 @@ class FakeDatagramSocket : public net::Socket {
void AppendInputPacket(const std::string& data);
// Current position in the input in number of packets, i.e. number of finished
- // Read() calls.
+ // Recv() calls.
int input_pos() const { return input_pos_; }
// Pairs the socket with |peer_socket|. Deleting either of the paired sockets
@@ -53,18 +53,14 @@ class FakeDatagramSocket : public net::Socket {
base::WeakPtr<FakeDatagramSocket> GetWeakPtr();
- // net::Socket implementation.
- int Read(net::IOBuffer* buf,
- int buf_len,
+ // P2PDatagramSocket implementation.
+ int Recv(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
+ const net::CompletionCallback& callback) override;
+ int Send(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
const net::CompletionCallback& callback) override;
- int Write(net::IOBuffer* buf,
- int buf_len,
- const net::CompletionCallback& callback) override;
- int SetReceiveBufferSize(int32 size) override;
- int SetSendBufferSize(int32 size) override;
private:
- int CopyReadData(net::IOBuffer* buf, int buf_len);
+ int CopyReadData(const scoped_refptr<net::IOBuffer>& buf, int buf_len);
base::WeakPtr<FakeDatagramSocket> peer_socket_;
« no previous file with comments | « remoting/protocol/fake_authenticator.cc ('k') | remoting/protocol/fake_datagram_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698