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

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

Issue 177603002: Revert 252408 "Adding talk_base::PacketOptions to P2P IPC Send m..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 6 years, 10 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/public/common/p2p_socket_type.h" 18 #include "content/public/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"
22 21
23 namespace content { 22 namespace content {
24 23
25 class P2PMessageThrottler; 24 class P2PMessageThrottler;
26 25
27 class CONTENT_EXPORT P2PSocketHostUdp : public P2PSocketHost { 26 class CONTENT_EXPORT P2PSocketHostUdp : public P2PSocketHost {
28 public: 27 public:
29 P2PSocketHostUdp(IPC::Sender* message_sender, int id, 28 P2PSocketHostUdp(IPC::Sender* message_sender, int id,
30 P2PMessageThrottler* throttler); 29 P2PMessageThrottler* throttler);
31 virtual ~P2PSocketHostUdp(); 30 virtual ~P2PSocketHostUdp();
32 31
33 // P2PSocketHost overrides. 32 // P2PSocketHost overrides.
34 virtual bool Init(const net::IPEndPoint& local_address, 33 virtual bool Init(const net::IPEndPoint& local_address,
35 const net::IPEndPoint& remote_address) OVERRIDE; 34 const net::IPEndPoint& remote_address) OVERRIDE;
36 virtual void Send(const net::IPEndPoint& to, 35 virtual void Send(const net::IPEndPoint& to,
37 const std::vector<char>& data, 36 const std::vector<char>& data,
38 const talk_base::PacketOptions& options, 37 net::DiffServCodePoint dscp,
39 uint64 packet_id) OVERRIDE; 38 uint64 packet_id) OVERRIDE;
40 virtual P2PSocketHost* AcceptIncomingTcpConnection( 39 virtual P2PSocketHost* AcceptIncomingTcpConnection(
41 const net::IPEndPoint& remote_address, int id) OVERRIDE; 40 const net::IPEndPoint& remote_address, int id) OVERRIDE;
42 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE; 41 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE;
43 42
44 private: 43 private:
45 friend class P2PSocketHostUdpTest; 44 friend class P2PSocketHostUdpTest;
46 45
47 typedef std::set<net::IPEndPoint> ConnectedPeerSet; 46 typedef std::set<net::IPEndPoint> ConnectedPeerSet;
48 47
49 struct PendingPacket { 48 struct PendingPacket {
50 PendingPacket(const net::IPEndPoint& to, 49 PendingPacket(const net::IPEndPoint& to,
51 const std::vector<char>& content, 50 const std::vector<char>& content,
52 const talk_base::PacketOptions& dscp, 51 net::DiffServCodePoint dscp,
53 uint64 id); 52 uint64 id);
54 ~PendingPacket(); 53 ~PendingPacket();
55 net::IPEndPoint to; 54 net::IPEndPoint to;
56 scoped_refptr<net::IOBuffer> data; 55 scoped_refptr<net::IOBuffer> data;
57 int size; 56 int size;
58 talk_base::PacketOptions packet_options; 57 net::DiffServCodePoint dscp;
59 uint64 id; 58 uint64 id;
60 }; 59 };
61 60
62 void OnError(); 61 void OnError();
63 62
64 void DoRead(); 63 void DoRead();
65 void OnRecv(int result); 64 void OnRecv(int result);
66 void HandleReadResult(int result); 65 void HandleReadResult(int result);
67 66
68 void DoSend(const PendingPacket& packet); 67 void DoSend(const PendingPacket& packet);
(...skipping 12 matching lines...) Expand all
81 // response or relay allocation request or response. 80 // response or relay allocation request or response.
82 ConnectedPeerSet connected_peers_; 81 ConnectedPeerSet connected_peers_;
83 P2PMessageThrottler* throttler_; 82 P2PMessageThrottler* throttler_;
84 83
85 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp); 84 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostUdp);
86 }; 85 };
87 86
88 } // namespace content 87 } // namespace content
89 88
90 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_ 89 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_UDP_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698