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

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: Fixed nits 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
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_dispatcher_host.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) 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::map<int, P2PSocketHost*> SocketsMap;
44 typedef std::map<ExtendedSocketId, P2PSocketHost*> SocketsMap;
45 44
46 class DnsRequest; 45 class DnsRequest;
47 46
48 P2PSocketHost* LookupSocket(int32 routing_id, int socket_id); 47 P2PSocketHost* LookupSocket(int socket_id);
49 48
50 // Handlers for the messages coming from the renderer. 49 // Handlers for the messages coming from the renderer.
51 void OnStartNetworkNotifications(const IPC::Message& msg); 50 void OnStartNetworkNotifications(const IPC::Message& msg);
52 void OnStopNetworkNotifications(const IPC::Message& msg); 51 void OnStopNetworkNotifications(const IPC::Message& msg);
53 52
54 void OnGetHostAddress(const IPC::Message& msg, 53 void OnGetHostAddress(const std::string& host_name,
55 const std::string& host_name,
56 int32 request_id); 54 int32 request_id);
57 55
58 void OnCreateSocket(const IPC::Message& msg, 56 void OnCreateSocket(P2PSocketType type,
59 P2PSocketType type,
60 int socket_id, 57 int socket_id,
61 const net::IPEndPoint& local_address, 58 const net::IPEndPoint& local_address,
62 const net::IPEndPoint& remote_address); 59 const net::IPEndPoint& remote_address);
63 void OnAcceptIncomingTcpConnection(const IPC::Message& msg, 60 void OnAcceptIncomingTcpConnection(int listen_socket_id,
64 int listen_socket_id,
65 const net::IPEndPoint& remote_address, 61 const net::IPEndPoint& remote_address,
66 int connected_socket_id); 62 int connected_socket_id);
67 void OnSend(const IPC::Message& msg, int socket_id, 63 void OnSend(int socket_id,
68 const net::IPEndPoint& socket_address, 64 const net::IPEndPoint& socket_address,
69 const std::vector<char>& data); 65 const std::vector<char>& data);
70 void OnDestroySocket(const IPC::Message& msg, int socket_id); 66 void OnDestroySocket(int socket_id);
71 67
72 void DoGetNetworkList(); 68 void DoGetNetworkList();
73 void SendNetworkList(const net::NetworkInterfaceList& list); 69 void SendNetworkList(const net::NetworkInterfaceList& list);
74 70
75 void OnAddressResolved(DnsRequest* request, 71 void OnAddressResolved(DnsRequest* request,
76 const net::IPAddressNumber& result); 72 const net::IPAddressNumber& result);
77 73
78 content::ResourceContext* resource_context_; 74 content::ResourceContext* resource_context_;
79 75
80 SocketsMap sockets_; 76 SocketsMap sockets_;
81 77
82 bool monitoring_networks_; 78 bool monitoring_networks_;
83 79
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_; 80 std::set<DnsRequest*> dns_requests_;
89 81
90 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost); 82 DISALLOW_COPY_AND_ASSIGN(P2PSocketDispatcherHost);
91 }; 83 };
92 84
93 } // namespace content 85 } // namespace content
94 86
95 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_ 87 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_DISPATCHER_HOST_H_
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/p2p/socket_dispatcher_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698