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

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
Index: remoting/protocol/pseudotcp_adapter.h
diff --git a/remoting/protocol/pseudotcp_adapter.h b/remoting/protocol/pseudotcp_adapter.h
index 0399258448551abca8341150fa1c1ceebfbf1a7a..83eaa2b9dc4c8716b15eaadf924054a8d684222e 100644
--- a/remoting/protocol/pseudotcp_adapter.h
+++ b/remoting/protocol/pseudotcp_adapter.h
@@ -11,51 +11,37 @@
#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.
+ // P2PStreamSocket implementation.
int Read(net::IOBuffer* buffer,
int buffer_size,
const net::CompletionCallback& callback) override;
int Write(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);

Powered by Google App Engine
This is Rietveld 408576698