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

Unified Diff: remoting/protocol/fake_stream_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_datagram_socket.cc ('k') | remoting/protocol/fake_stream_socket.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/fake_stream_socket.h
diff --git a/remoting/protocol/fake_stream_socket.h b/remoting/protocol/fake_stream_socket.h
index 6bd1cbe940881f7746547bb25f5b6407fa440862..c234f338aa2f902599c7c4796518bddea7abb2f3 100644
--- a/remoting/protocol/fake_stream_socket.h
+++ b/remoting/protocol/fake_stream_socket.h
@@ -11,7 +11,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/memory/weak_ptr.h"
#include "net/base/completion_callback.h"
-#include "net/socket/stream_socket.h"
+#include "remoting/protocol/p2p_stream_socket.h"
#include "remoting/protocol/stream_channel_factory.h"
namespace base {
@@ -21,7 +21,7 @@ class SingleThreadTaskRunner;
namespace remoting {
namespace protocol {
-// FakeStreamSocket implement net::StreamSocket interface. All data written to
+// FakeStreamSocket implement P2PStreamSocket interface. All data written to
// FakeStreamSocket is stored in a buffer returned by written_data(). Read()
// reads data from another buffer that can be set with AppendInputData().
// Pending reads are supported, so if there is a pending read AppendInputData()
@@ -31,7 +31,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 FakeStreamSocket : public net::StreamSocket {
+class FakeStreamSocket : public P2PStreamSocket {
public:
FakeStreamSocket();
~FakeStreamSocket() override;
@@ -68,40 +68,16 @@ class FakeStreamSocket : public net::StreamSocket {
base::WeakPtr<FakeStreamSocket> GetWeakPtr();
- // net::Socket implementation.
- int Read(net::IOBuffer* buf,
- int buf_len,
+ // P2PStreamSocket interface.
+ int Read(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
const net::CompletionCallback& callback) override;
- int Write(net::IOBuffer* buf,
- int buf_len,
+ int Write(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
const net::CompletionCallback& callback) override;
- int SetReceiveBufferSize(int32 size) override;
- int SetSendBufferSize(int32 size) override;
-
- // net::StreamSocket interface.
- int Connect(const net::CompletionCallback& callback) override;
- void Disconnect() override;
- bool IsConnected() const override;
- bool IsConnectedAndIdle() const override;
- int GetPeerAddress(net::IPEndPoint* address) const override;
- int GetLocalAddress(net::IPEndPoint* address) const override;
- const net::BoundNetLog& NetLog() const override;
- void SetSubresourceSpeculation() override;
- void SetOmniboxSpeculation() override;
- bool WasEverUsed() const override;
- bool UsingTCPFastOpen() const override;
- bool WasNpnNegotiated() const override;
- net::NextProto GetNegotiatedProtocol() const override;
- bool GetSSLInfo(net::SSLInfo* ssl_info) override;
- void GetConnectionAttempts(net::ConnectionAttempts* out) const override;
- void ClearConnectionAttempts() override {}
- void AddConnectionAttempts(const net::ConnectionAttempts& attempts) override {
- }
private:
- void DoAsyncWrite(scoped_refptr<net::IOBuffer> buf, int buf_len,
+ void DoAsyncWrite(const scoped_refptr<net::IOBuffer>& buf, int buf_len,
const net::CompletionCallback& callback);
- void DoWrite(net::IOBuffer* buf, int buf_len);
+ void DoWrite(const scoped_refptr<net::IOBuffer>& buf, int buf_len);
bool async_write_;
bool write_pending_;
@@ -118,8 +94,6 @@ class FakeStreamSocket : public net::StreamSocket {
std::string input_data_;
int input_pos_;
- net::BoundNetLog net_log_;
-
scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
base::WeakPtrFactory<FakeStreamSocket> weak_factory_;
« no previous file with comments | « remoting/protocol/fake_datagram_socket.cc ('k') | remoting/protocol/fake_stream_socket.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698