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

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

Issue 2846243002: Wire up rtc_packet_ids to P2PSocketHostTcp, which is required for correct BWE in WebRTC. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host_tcp.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 void Send(const net::IPEndPoint& to, 47 void Send(const net::IPEndPoint& to,
48 const std::vector<char>& data, 48 const std::vector<char>& data,
49 const rtc::PacketOptions& options, 49 const rtc::PacketOptions& options,
50 uint64_t packet_id) override; 50 uint64_t packet_id) override;
51 std::unique_ptr<P2PSocketHost> AcceptIncomingTcpConnection( 51 std::unique_ptr<P2PSocketHost> AcceptIncomingTcpConnection(
52 const net::IPEndPoint& remote_address, 52 const net::IPEndPoint& remote_address,
53 int id) override; 53 int id) override;
54 bool SetOption(P2PSocketOption option, int value) override; 54 bool SetOption(P2PSocketOption option, int value) override;
55 55
56 protected: 56 protected:
57 struct SendBuffer {
58 SendBuffer();
59 SendBuffer(int32_t packet_id, scoped_refptr<net::DrainableIOBuffer> buffer);
60 SendBuffer(const SendBuffer& rhs);
61 ~SendBuffer();
62
63 int32_t rtc_packet_id;
64 scoped_refptr<net::DrainableIOBuffer> buffer;
65 };
66
57 // Derived classes will provide the implementation. 67 // Derived classes will provide the implementation.
58 virtual int ProcessInput(char* input, int input_len) = 0; 68 virtual int ProcessInput(char* input, int input_len) = 0;
59 virtual void DoSend(const net::IPEndPoint& to, 69 virtual void DoSend(const net::IPEndPoint& to,
60 const std::vector<char>& data, 70 const std::vector<char>& data,
61 const rtc::PacketOptions& options) = 0; 71 const rtc::PacketOptions& options) = 0;
62 72
63 void WriteOrQueue(scoped_refptr<net::DrainableIOBuffer>& buffer); 73 void WriteOrQueue(SendBuffer& send_buffer);
64 void OnPacket(const std::vector<char>& data); 74 void OnPacket(const std::vector<char>& data);
65 void OnError(); 75 void OnError();
66 76
67 private: 77 private:
68 friend class P2PSocketHostTcpTestBase; 78 friend class P2PSocketHostTcpTestBase;
69 friend class P2PSocketHostTcpServerTest; 79 friend class P2PSocketHostTcpServerTest;
70 80
71 // SSL/TLS connection functions. 81 // SSL/TLS connection functions.
72 void StartTls(); 82 void StartTls();
73 void ProcessTlsSslConnectDone(int status); 83 void ProcessTlsSslConnectDone(int status);
(...skipping 10 matching lines...) Expand all
84 void OnWritten(int result); 94 void OnWritten(int result);
85 95
86 // Helper method to send socket create message and start read. 96 // Helper method to send socket create message and start read.
87 void OnOpen(); 97 void OnOpen();
88 bool DoSendSocketCreateMsg(); 98 bool DoSendSocketCreateMsg();
89 99
90 P2PHostAndIPEndPoint remote_address_; 100 P2PHostAndIPEndPoint remote_address_;
91 101
92 std::unique_ptr<net::StreamSocket> socket_; 102 std::unique_ptr<net::StreamSocket> socket_;
93 scoped_refptr<net::GrowableIOBuffer> read_buffer_; 103 scoped_refptr<net::GrowableIOBuffer> read_buffer_;
94 std::queue<scoped_refptr<net::DrainableIOBuffer> > write_queue_; 104 std::queue<SendBuffer> write_queue_;
95 scoped_refptr<net::DrainableIOBuffer> write_buffer_; 105 SendBuffer write_buffer_;
96 106
97 bool write_pending_; 107 bool write_pending_;
98 108
99 bool connected_; 109 bool connected_;
100 P2PSocketType type_; 110 P2PSocketType type_;
101 scoped_refptr<net::URLRequestContextGetter> url_context_; 111 scoped_refptr<net::URLRequestContextGetter> url_context_;
102 112
103 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpBase); 113 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcpBase);
104 }; 114 };
105 115
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
143 private: 153 private:
144 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); 154 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes);
145 155
146 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); 156 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp);
147 }; 157 };
148 158
149 159
150 } // namespace content 160 } // namespace content
151 161
152 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ 162 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_host_tcp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698