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

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

Issue 184813006: Relanding PacketOptions CL after revert (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 | Annotate | Revision Log
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_UDP_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_
7 7
8 #include <deque> 8 #include <deque>
9 #include <set> 9 #include <set>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/compiler_specific.h" 12 #include "base/compiler_specific.h"
13 #include "base/memory/ref_counted.h" 13 #include "base/memory/ref_counted.h"
14 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "base/message_loop/message_loop.h" 15 #include "base/message_loop/message_loop.h"
16 #include "content/browser/renderer_host/p2p/socket_host.h" 16 #include "content/browser/renderer_host/p2p/socket_host.h"
17 #include "content/common/content_export.h" 17 #include "content/common/content_export.h"
18 #include "content/common/p2p_socket_type.h" 18 #include "content/common/p2p_socket_type.h"
19 #include "net/base/ip_endpoint.h" 19 #include "net/base/ip_endpoint.h"
20 #include "net/udp/udp_server_socket.h" 20 #include "net/udp/udp_server_socket.h"
21 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h"
21 22
22 namespace content { 23 namespace content {
23 24
24 class P2PMessageThrottler; 25 class P2PMessageThrottler;
25 26
26 class CONTENT_EXPORT P2PSocketHostUdp : public P2PSocketHost { 27 class CONTENT_EXPORT P2PSocketHostUdp : public P2PSocketHost {
27 public: 28 public:
28 P2PSocketHostUdp(IPC::Sender* message_sender, int id, 29 P2PSocketHostUdp(IPC::Sender* message_sender, int id,
29 P2PMessageThrottler* throttler); 30 P2PMessageThrottler* throttler);
30 virtual ~P2PSocketHostUdp(); 31 virtual ~P2PSocketHostUdp();
31 32
32 // P2PSocketHost overrides. 33 // P2PSocketHost overrides.
33 virtual bool Init(const net::IPEndPoint& local_address, 34 virtual bool Init(const net::IPEndPoint& local_address,
34 const net::IPEndPoint& remote_address) OVERRIDE; 35 const net::IPEndPoint& remote_address) OVERRIDE;
35 virtual void Send(const net::IPEndPoint& to, 36 virtual void Send(const net::IPEndPoint& to,
36 const std::vector<char>& data, 37 const std::vector<char>& data,
37 net::DiffServCodePoint dscp, 38 const talk_base::PacketOptions& options,
38 uint64 packet_id) OVERRIDE; 39 uint64 packet_id) OVERRIDE;
39 virtual P2PSocketHost* AcceptIncomingTcpConnection( 40 virtual P2PSocketHost* AcceptIncomingTcpConnection(
40 const net::IPEndPoint& remote_address, int id) OVERRIDE; 41 const net::IPEndPoint& remote_address, int id) OVERRIDE;
41 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE; 42 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE;
42 43
43 private: 44 private:
44 friend class P2PSocketHostUdpTest; 45 friend class P2PSocketHostUdpTest;
45 46
46 typedef std::set<net::IPEndPoint> ConnectedPeerSet; 47 typedef std::set<net::IPEndPoint> ConnectedPeerSet;
47 48
48 struct PendingPacket { 49 struct PendingPacket {
49 PendingPacket(const net::IPEndPoint& to, 50 PendingPacket(const net::IPEndPoint& to,
50 const std::vector<char>& content, 51 const std::vector<char>& content,
51 net::DiffServCodePoint dscp, 52 const talk_base::PacketOptions& options,
52 uint64 id); 53 uint64 id);
53 ~PendingPacket(); 54 ~PendingPacket();
54 net::IPEndPoint to; 55 net::IPEndPoint to;
55 scoped_refptr<net::IOBuffer> data; 56 scoped_refptr<net::IOBuffer> data;
56 int size; 57 int size;
57 net::DiffServCodePoint dscp; 58 talk_base::PacketOptions packet_options;
58 uint64 id; 59 uint64 id;
59 }; 60 };
60 61
61 void OnError(); 62 void OnError();
62 63
63 void DoRead(); 64 void DoRead();
64 void OnRecv(int result); 65 void OnRecv(int result);
65 void HandleReadResult(int result); 66 void HandleReadResult(int result);
66 67
67 void DoSend(const PendingPacket& packet); 68 void DoSend(const PendingPacket& packet);
(...skipping 12 matching lines...) Expand all
80 // response or relay allocation request or response. 81 // response or relay allocation request or response.
81 ConnectedPeerSet connected_peers_; 82 ConnectedPeerSet connected_peers_;
82 P2PMessageThrottler* throttler_; 83 P2PMessageThrottler* throttler_;
83 84
84 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp); 85 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp);
85 }; 86 };
86 87
87 } // namespace content 88 } // namespace content
88 89
89 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ 90 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_host_tcp_unittest.cc ('k') | content/browser/renderer_host/p2p/socket_host_udp.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698