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

Unified Diff: remoting/protocol/pseudotcp_adapter.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/p2p_stream_socket.h ('k') | remoting/protocol/pseudotcp_adapter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/pseudotcp_adapter.h
diff --git a/remoting/protocol/pseudotcp_adapter.h b/remoting/protocol/pseudotcp_adapter.h
index 0399258448551abca8341150fa1c1ceebfbf1a7a..a297dd7cfe81adde30679026b7f4895d6d042800 100644
--- a/remoting/protocol/pseudotcp_adapter.h
+++ b/remoting/protocol/pseudotcp_adapter.h
@@ -11,51 +11,35 @@
#include "base/memory/scoped_ptr.h"
#include "base/threading/non_thread_safe.h"
#include "net/log/net_log.h"
-#include "net/socket/stream_socket.h"
+#include "remoting/protocol/p2p_stream_socket.h"
#include "third_party/webrtc/p2p/base/pseudotcp.h"
namespace remoting {
namespace protocol {
-// PseudoTcpAdapter adapts a connectionless net::Socket to a connection-
-// oriented net::StreamSocket using PseudoTcp. Because net::StreamSockets
-// can be deleted during callbacks, while PseudoTcp cannot, the core of the
-// PseudoTcpAdapter is reference counted, with a reference held by the
-// adapter, and an additional reference held on the stack during callbacks.
-class PseudoTcpAdapter : public net::StreamSocket, base::NonThreadSafe {
+class P2PDatagramSocket;
+
+// PseudoTcpAdapter adapts a P2PDatagramSocket to P2PStreamSocket using
+// PseudoTcp. Because P2PStreamSockets can be deleted during callbacks,
+// while PseudoTcp cannot, the core of the PseudoTcpAdapter is reference
+// counted, with a reference held by the adapter, and an additional reference
+// held on the stack during callbacks.
+class PseudoTcpAdapter : public P2PStreamSocket, base::NonThreadSafe {
public:
- explicit PseudoTcpAdapter(scoped_ptr<net::Socket> socket);
+ explicit PseudoTcpAdapter(scoped_ptr<P2PDatagramSocket> socket);
~PseudoTcpAdapter() override;
- // net::Socket implementation.
- int Read(net::IOBuffer* buffer,
- int buffer_size,
+ // P2PStreamSocket implementation.
+ int Read(const scoped_refptr<net::IOBuffer>& buffer, int buffer_size,
const net::CompletionCallback& callback) override;
- int Write(net::IOBuffer* buffer,
- int buffer_size,
+ int Write(const scoped_refptr<net::IOBuffer>& buffer, int buffer_size,
const net::CompletionCallback& callback) override;
- int SetReceiveBufferSize(int32 size) override;
- int SetSendBufferSize(int32 size) override;
-
- // net::StreamSocket implementation.
- 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 {
- }
+
+ int Connect(const net::CompletionCallback& callback);
+
+ // Set receive and send buffer sizes.
+ int SetReceiveBufferSize(int32 size);
+ int SetSendBufferSize(int32 size);
// Set the delay for sending ACK.
void SetAckDelay(int delay_ms);
« no previous file with comments | « remoting/protocol/p2p_stream_socket.h ('k') | remoting/protocol/pseudotcp_adapter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698