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

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

Issue 10917167: Refactor the P2PSocketDispatcher to be created on the RenderThread instead of the RenderView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Removed unnecessary destruction callback. Removed remaining routing_id. Created 8 years, 3 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_DISPATCHER_HOST_H_ 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_
7 7
8 #include <map> 8 #include <map>
9 9
10 #include "content/common/p2p_sockets.h" 10 #include "content/common/p2p_sockets.h"
(...skipping 22 matching lines...) Expand all
33 // net::NetworkChangeNotifier::IPAddressObserver interface. 33 // net::NetworkChangeNotifier::IPAddressObserver interface.
34 virtual void OnIPAddressChanged() OVERRIDE; 34 virtual void OnIPAddressChanged() OVERRIDE;
35 35
36 protected: 36 protected:
37 virtual ~P2PSocketDispatcherHost(); 37 virtual ~P2PSocketDispatcherHost();
38 38
39 private: 39 private:
40 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; 40 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
41 friend class base::DeleteHelper<P2PSocketDispatcherHost>; 41 friend class base::DeleteHelper<P2PSocketDispatcherHost>;
42 42
43 typedef std::pair<int32, int> ExtendedSocketId; 43 typedef std::pair<int, P2PSocketHost*> SocketPair;
tommi (sloooow) - chröme 2012/09/11 12:09:09 You don't need this typedef actually. See comment
perkj_chrome 2012/09/11 14:27:30 Done.
44 typedef std::map<ExtendedSocketId, P2PSocketHost*> SocketsMap; 44 typedef std::map<int, P2PSocketHost*> SocketsMap;
45 45
46 class DnsRequest; 46 class DnsRequest;
47 47
48 P2PSocketHost* LookupSocket(int32 routing_id, int socket_id); 48 P2PSocketHost* LookupSocket(int socket_id);
49 49
50 // Handlers for the messages coming from the renderer. 50 // Handlers for the messages coming from the renderer.
51 void OnStartNetworkNotifications(const IPC::Message& msg); 51 void OnStartNetworkNotifications(const IPC::Message& msg);
52 void OnStopNetworkNotifications(const IPC::Message& msg); 52 void OnStopNetworkNotifications(const IPC::Message& msg);
53 53
54 void OnGetHostAddress(const IPC::Message& msg, 54 void OnGetHostAddress(const std::string& host_name,
55 const std::string& host_name,
56 int32 request_id); 55 int32 request_id);
57 56
58 void OnCreateSocket(const IPC::Message& msg, 57 void OnCreateSocket(P2PSocketType type,
59 P2PSocketType type,
60 int socket_id, 58 int socket_id,
61 const net::IPEndPoint& local_address, 59 const net::IPEndPoint& local_address,
62 const net::IPEndPoint& remote_address); 60 const net::IPEndPoint& remote_address);
63 void OnAcceptIncomingTcpConnection(const IPC::Message& msg, 61 void OnAcceptIncomingTcpConnection(int listen_socket_id,
64 int listen_socket_id,
65 const net::IPEndPoint& remote_address, 62 const net::IPEndPoint& remote_address,
66 int connected_socket_id); 63 int connected_socket_id);
67 void OnSend(const IPC::Message& msg, int socket_id, 64 void OnSend(int socket_id,
68 const net::IPEndPoint& socket_address, 65 const net::IPEndPoint& socket_address,
69 const std::vector<char>& data); 66 const std::vector<char>& data);
70 void OnDestroySocket(const IPC::Message& msg, int socket_id); 67 void OnDestroySocket(int socket_id);
71 68
72 void DoGetNetworkList(); 69 void DoGetNetworkList();
73 void SendNetworkList(const net::NetworkInterfaceList& list); 70 void SendNetworkList(const net::NetworkInterfaceList& list);
74 71
75 void OnAddressResolved(DnsRequest* request, 72 void OnAddressResolved(DnsRequest* request,
76 const net::IPAddressNumber& result); 73 const net::IPAddressNumber& result);
77 74
78 content::ResourceContext* resource_context_; 75 content::ResourceContext* resource_context_;
79 76
80 SocketsMap sockets_; 77 SocketsMap sockets_;
81 78
82 bool monitoring_networks_; 79 bool monitoring_networks_;
83 80
84 // List or routing IDs for the hosts that have subscribed to the
85 // network list notifications.
86 std::set<int> notifications_routing_ids_;
87
88 std::set<DnsRequest*> dns_requests_; 81 std::set<DnsRequest*> dns_requests_;
89 82
90 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); 83 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost);
91 }; 84 };
92 85
93 } // namespace content 86 } // namespace content
94 87
95 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ 88 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698