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

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

Issue 9369009: Make content::ResourceContext be a real interface like the rest of the Content API (i.e. don't ha... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync Created 8 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 #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/browser/resource_context.h" 10 #include "content/browser/resource_context.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 int32 request_id_; 94 int32 request_id_;
95 net::AddressList addresses_; 95 net::AddressList addresses_;
96 96
97 std::string host_name_; 97 std::string host_name_;
98 net::SingleRequestHostResolver resolver_; 98 net::SingleRequestHostResolver resolver_;
99 99
100 DoneCallback done_callback_; 100 DoneCallback done_callback_;
101 }; 101 };
102 102
103 P2PSocketDispatcherHost::P2PSocketDispatcherHost( 103 P2PSocketDispatcherHost::P2PSocketDispatcherHost(
104 const content::ResourceContext* resource_context) 104 content::ResourceContext* resource_context)
105 : resource_context_(resource_context), 105 : resource_context_(resource_context),
106 monitoring_networks_(false) { 106 monitoring_networks_(false) {
107 } 107 }
108 108
109 P2PSocketDispatcherHost::~P2PSocketDispatcherHost() { 109 P2PSocketDispatcherHost::~P2PSocketDispatcherHost() {
110 DCHECK(sockets_.empty()); 110 DCHECK(sockets_.empty());
111 DCHECK(dns_requests_.empty()); 111 DCHECK(dns_requests_.empty());
112 112
113 if (monitoring_networks_) 113 if (monitoring_networks_)
114 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); 114 net::NetworkChangeNotifier::RemoveIPAddressObserver(this);
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 for (std::set<int>::iterator it = notifications_routing_ids_.begin(); 197 for (std::set<int>::iterator it = notifications_routing_ids_.begin();
198 it != notifications_routing_ids_.end(); ++it) { 198 it != notifications_routing_ids_.end(); ++it) {
199 Send(new P2PMsg_NetworkListChanged(*it, list)); 199 Send(new P2PMsg_NetworkListChanged(*it, list));
200 } 200 }
201 } 201 }
202 202
203 void P2PSocketDispatcherHost::OnGetHostAddress(const IPC::Message& msg, 203 void P2PSocketDispatcherHost::OnGetHostAddress(const IPC::Message& msg,
204 const std::string& host_name, 204 const std::string& host_name,
205 int32 request_id) { 205 int32 request_id) {
206 DnsRequest* request = new DnsRequest( 206 DnsRequest* request = new DnsRequest(
207 msg.routing_id(), request_id, resource_context_->host_resolver()); 207 msg.routing_id(), request_id, resource_context_->GetHostResolver());
208 dns_requests_.insert(request); 208 dns_requests_.insert(request);
209 request->Resolve(host_name, base::Bind( 209 request->Resolve(host_name, base::Bind(
210 &P2PSocketDispatcherHost::OnAddressResolved, 210 &P2PSocketDispatcherHost::OnAddressResolved,
211 base::Unretained(this), request)); 211 base::Unretained(this), request));
212 } 212 }
213 213
214 void P2PSocketDispatcherHost::OnAddressResolved( 214 void P2PSocketDispatcherHost::OnAddressResolved(
215 DnsRequest* request, 215 DnsRequest* request,
216 const net::IPAddressNumber& result) { 216 const net::IPAddressNumber& result) {
217 Send(new P2PMsg_GetHostAddressResult( 217 Send(new P2PMsg_GetHostAddressResult(
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
280 ExtendedSocketId(msg.routing_id(), socket_id)); 280 ExtendedSocketId(msg.routing_id(), socket_id));
281 if (it != sockets_.end()) { 281 if (it != sockets_.end()) {
282 delete it->second; 282 delete it->second;
283 sockets_.erase(it); 283 sockets_.erase(it);
284 } else { 284 } else {
285 LOG(ERROR) << "Received P2PHostMsg_DestroySocket for invalid socket_id."; 285 LOG(ERROR) << "Received P2PHostMsg_DestroySocket for invalid socket_id.";
286 } 286 }
287 } 287 }
288 288
289 } // namespace content 289 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/p2p/socket_dispatcher_host.h ('k') | content/browser/renderer_host/pepper_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698