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

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

Issue 283623002: Add support for passing an arbitrary parameter to an IPC message handler. The motivation is for Web… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 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 | 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 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h" 5 #include "content/browser/renderer_host/p2p/socket_dispatcher_host.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/stl_util.h" 8 #include "base/stl_util.h"
9 #include "content/browser/renderer_host/p2p/socket_host.h" 9 #include "content/browser/renderer_host/p2p/socket_host.h"
10 #include "content/common/p2p_messages.h" 10 #include "content/common/p2p_messages.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 if (monitoring_networks_) 154 if (monitoring_networks_)
155 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 155 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
156 } 156 }
157 157
158 P2PSocketHost* P2PSocketDispatcherHost::LookupSocket(int socket_id) { 158 P2PSocketHost* P2PSocketDispatcherHost::LookupSocket(int socket_id) {
159 SocketsMap::iterator it = sockets_.find(socket_id); 159 SocketsMap::iterator it = sockets_.find(socket_id);
160 return (it == sockets_.end()) ? NULL : it->second; 160 return (it == sockets_.end()) ? NULL : it->second;
161 } 161 }
162 162
163 void P2PSocketDispatcherHost::OnStartNetworkNotifications( 163 void P2PSocketDispatcherHost::OnStartNetworkNotifications() {
164 const IPC::Message& msg) {
165 if (!monitoring_networks_) { 164 if (!monitoring_networks_) {
166 net::NetworkChangeNotifier::AddIPAddressObserver(this); 165 net::NetworkChangeNotifier::AddIPAddressObserver(this);
167 monitoring_networks_ = true; 166 monitoring_networks_ = true;
168 } 167 }
169 168
170 BrowserThread::PostTask( 169 BrowserThread::PostTask(
171 BrowserThread::FILE, FROM_HERE, base::Bind( 170 BrowserThread::FILE, FROM_HERE, base::Bind(
172 &P2PSocketDispatcherHost::DoGetNetworkList, this)); 171 &P2PSocketDispatcherHost::DoGetNetworkList, this));
173 } 172 }
174 173
175 void P2PSocketDispatcherHost::OnStopNetworkNotifications( 174 void P2PSocketDispatcherHost::OnStopNetworkNotifications() {
176 const IPC::Message& msg) {
177 if (monitoring_networks_) { 175 if (monitoring_networks_) {
178 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 176 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
179 monitoring_networks_ = false; 177 monitoring_networks_ = false;
180 } 178 }
181 } 179 }
182 180
183 void P2PSocketDispatcherHost::OnGetHostAddress(const std::string& host_name, 181 void P2PSocketDispatcherHost::OnGetHostAddress(const std::string& host_name,
184 int32 request_id) { 182 int32 request_id) {
185 DnsRequest* request = new DnsRequest(request_id, 183 DnsRequest* request = new DnsRequest(request_id,
186 resource_context_->GetHostResolver()); 184 resource_context_->GetHostResolver());
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 void P2PSocketDispatcherHost::OnAddressResolved( 289 void P2PSocketDispatcherHost::OnAddressResolved(
292 DnsRequest* request, 290 DnsRequest* request,
293 const net::IPAddressList& addresses) { 291 const net::IPAddressList& addresses) {
294 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses)); 292 Send(new P2PMsg_GetHostAddressResult(request->request_id(), addresses));
295 293
296 dns_requests_.erase(request); 294 dns_requests_.erase(request);
297 delete request; 295 delete request;
298 } 296 }
299 297
300 } // namespace content 298 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_dispatcher_host.h ('k') | content/browser/renderer_host/render_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698