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

Side by Side Diff: content/browser/renderer_host/p2p/socket_host_tcp.h

Issue 2841803003: Wire up rtc_packet_ids to P2PSocketHostTcp, which is required for correct BWE in WebRTC. (Closed)
Patch Set: Created 3 years, 8 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 unified diff | Download patch
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 CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 11 matching lines...) Expand all
22 namespace net { 22 namespace net {
23 class DrainableIOBuffer; 23 class DrainableIOBuffer;
24 class GrowableIOBuffer; 24 class GrowableIOBuffer;
25 class StreamSocket; 25 class StreamSocket;
26 class URLRequestContextGetter; 26 class URLRequestContextGetter;
27 } // namespace net 27 } // namespace net
28 28
29 namespace content { 29 namespace content {
30 30
31 class CONTENT_EXPORT P2PSocketHostTcpBase : public P2PSocketHost { 31 class CONTENT_EXPORT P2PSocketHostTcpBase : public P2PSocketHost {
32 public: 32 public:
Taylor_Brandstetter 2017/04/25 21:34:19 Could add a comment that the uint64_t is the packe
Stefan 2017/04/26 09:02:39 More self explanatory now that I've made this a st
33 typedef std::pair<uint64_t, scoped_refptr<net::DrainableIOBuffer>> SendBuffer;
Sergey Ulanov 2017/04/26 00:11:52 I think it would be better to replace this with a
Stefan 2017/04/26 09:02:39 Done.
34
33 P2PSocketHostTcpBase(IPC::Sender* message_sender, 35 P2PSocketHostTcpBase(IPC::Sender* message_sender,
34 int socket_id, 36 int socket_id,
35 P2PSocketType type, 37 P2PSocketType type,
36 net::URLRequestContextGetter* url_context); 38 net::URLRequestContextGetter* url_context);
37 ~P2PSocketHostTcpBase() override; 39 ~P2PSocketHostTcpBase() override;
38 40
39 bool InitAccepted(const net::IPEndPoint& remote_address, 41 bool InitAccepted(const net::IPEndPoint& remote_address,
40 std::unique_ptr<net::StreamSocket> socket); 42 std::unique_ptr<net::StreamSocket> socket);
41 43
42 // P2PSocketHost overrides. 44 // P2PSocketHost overrides.
(...skipping 10 matching lines...) Expand all
53 int id) override; 55 int id) override;
54 bool SetOption(P2PSocketOption option, int value) override; 56 bool SetOption(P2PSocketOption option, int value) override;
55 57
56 protected: 58 protected:
57 // Derived classes will provide the implementation. 59 // Derived classes will provide the implementation.
58 virtual int ProcessInput(char* input, int input_len) = 0; 60 virtual int ProcessInput(char* input, int input_len) = 0;
59 virtual void DoSend(const net::IPEndPoint& to, 61 virtual void DoSend(const net::IPEndPoint& to,
60 const std::vector<char>& data, 62 const std::vector<char>& data,
61 const rtc::PacketOptions& options) = 0; 63 const rtc::PacketOptions& options) = 0;
62 64
63 void WriteOrQueue(scoped_refptr<net::DrainableIOBuffer>& buffer); 65 void WriteOrQueue(SendBuffer& buffer);
64 void OnPacket(const std::vector<char>& data); 66 void OnPacket(const std::vector<char>& data);
65 void OnError(); 67 void OnError();
66 68
67 private: 69 private:
68 friend class P2PSocketHostTcpTestBase; 70 friend class P2PSocketHostTcpTestBase;
69 friend class P2PSocketHostTcpServerTest; 71 friend class P2PSocketHostTcpServerTest;
70 72
71 // SSL/TLS connection functions. 73 // SSL/TLS connection functions.
72 void StartTls(); 74 void StartTls();
73 void ProcessTlsSslConnectDone(int status); 75 void ProcessTlsSslConnectDone(int status);
(...skipping 10 matching lines...) Expand all
84 void OnWritten(int result); 86 void OnWritten(int result);
85 87
86 // Helper method to send socket create message and start read. 88 // Helper method to send socket create message and start read.
87 void OnOpen(); 89 void OnOpen();
88 bool DoSendSocketCreateMsg(); 90 bool DoSendSocketCreateMsg();
89 91
90 P2PHostAndIPEndPoint remote_address_; 92 P2PHostAndIPEndPoint remote_address_;
91 93
92 std::unique_ptr<net::StreamSocket> socket_; 94 std::unique_ptr<net::StreamSocket> socket_;
93 scoped_refptr<net::GrowableIOBuffer> read_buffer_; 95 scoped_refptr<net::GrowableIOBuffer> read_buffer_;
94 std::queue<scoped_refptr<net::DrainableIOBuffer> > write_queue_; 96 std::queue<SendBuffer> write_queue_;
95 scoped_refptr<net::DrainableIOBuffer> write_buffer_; 97 SendBuffer write_buffer_;
96 98
97 bool write_pending_; 99 bool write_pending_;
98 100
99 bool connected_; 101 bool connected_;
100 P2PSocketType type_; 102 P2PSocketType type_;
101 scoped_refptr<net::URLRequestContextGetter> url_context_; 103 scoped_refptr<net::URLRequestContextGetter> url_context_;
102 104
103 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpBase); 105 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpBase);
104 }; 106 };
105 107
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 private: 145 private:
144 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); 146 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes);
145 147
146 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); 148 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp);
147 }; 149 };
148 150
149 151
150 } // namespace content 152 } // namespace content
151 153
152 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ 154 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698