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

Side by Side Diff: jingle/glue/proxy_resolving_client_socket.cc

Issue 14307021: jingle: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 "jingle/glue/proxy_resolving_client_socket.h" 5 #include "jingle/glue/proxy_resolving_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/bind_helpers.h" 9 #include "base/bind_helpers.h"
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 int status = network_session_->proxy_service()->ResolveProxy( 131 int status = network_session_->proxy_service()->ResolveProxy(
132 proxy_url_, 132 proxy_url_,
133 &proxy_info_, 133 &proxy_info_,
134 proxy_resolve_callback_, 134 proxy_resolve_callback_,
135 &pac_request_, 135 &pac_request_,
136 bound_net_log_); 136 bound_net_log_);
137 if (status != net::ERR_IO_PENDING) { 137 if (status != net::ERR_IO_PENDING) {
138 // We defer execution of ProcessProxyResolveDone instead of calling it 138 // We defer execution of ProcessProxyResolveDone instead of calling it
139 // directly here for simplicity. From the caller's point of view, 139 // directly here for simplicity. From the caller's point of view,
140 // the connect always happens asynchronously. 140 // the connect always happens asynchronously.
141 MessageLoop* message_loop = MessageLoop::current(); 141 base::MessageLoop* message_loop = base::MessageLoop::current();
142 CHECK(message_loop); 142 CHECK(message_loop);
143 message_loop->PostTask( 143 message_loop->PostTask(
144 FROM_HERE, 144 FROM_HERE,
145 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone, 145 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone,
146 weak_factory_.GetWeakPtr(), status)); 146 weak_factory_.GetWeakPtr(), status));
147 } 147 }
148 user_connect_callback_ = callback; 148 user_connect_callback_ = callback;
149 return net::ERR_IO_PENDING; 149 return net::ERR_IO_PENDING;
150 } 150 }
151 151
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 // If ReconsiderProxyAfterError() failed synchronously, it means 277 // If ReconsiderProxyAfterError() failed synchronously, it means
278 // there was nothing left to fall-back to, so fail the transaction 278 // there was nothing left to fall-back to, so fail the transaction
279 // with the last connection error we got. 279 // with the last connection error we got.
280 rv = error; 280 rv = error;
281 } 281 }
282 282
283 // We either have new proxy info or there was an error in falling back. 283 // We either have new proxy info or there was an error in falling back.
284 // In both cases we want to post ProcessProxyResolveDone (in the error case 284 // In both cases we want to post ProcessProxyResolveDone (in the error case
285 // we might still want to fall back a direct connection). 285 // we might still want to fall back a direct connection).
286 if (rv != net::ERR_IO_PENDING) { 286 if (rv != net::ERR_IO_PENDING) {
287 MessageLoop* message_loop = MessageLoop::current(); 287 base::MessageLoop* message_loop = base::MessageLoop::current();
288 CHECK(message_loop); 288 CHECK(message_loop);
289 message_loop->PostTask( 289 message_loop->PostTask(
290 FROM_HERE, 290 FROM_HERE,
291 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone, 291 base::Bind(&ProxyResolvingClientSocket::ProcessProxyResolveDone,
292 weak_factory_.GetWeakPtr(), rv)); 292 weak_factory_.GetWeakPtr(), rv));
293 // Since we potentially have another try to go (trying the direct connect) 293 // Since we potentially have another try to go (trying the direct connect)
294 // set the return code code to ERR_IO_PENDING. 294 // set the return code code to ERR_IO_PENDING.
295 rv = net::ERR_IO_PENDING; 295 rv = net::ERR_IO_PENDING;
296 } 296 }
297 return rv; 297 return rv;
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return false; 388 return false;
389 } 389 }
390 390
391 void ProxyResolvingClientSocket::CloseTransportSocket() { 391 void ProxyResolvingClientSocket::CloseTransportSocket() {
392 if (transport_.get() && transport_->socket()) 392 if (transport_.get() && transport_->socket())
393 transport_->socket()->Disconnect(); 393 transport_->socket()->Disconnect();
394 transport_.reset(); 394 transport_.reset();
395 } 395 }
396 396
397 } // namespace jingle_glue 397 } // namespace jingle_glue
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698