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

Side by Side Diff: net/curvecp/client_packetizer.cc

Issue 9572036: Convert uses of int ms to TimeDelta in chrome/browser and net. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 9 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
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 "net/curvecp/client_packetizer.h" 5 #include "net/curvecp/client_packetizer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "net/base/io_buffer.h" 8 #include "net/base/io_buffer.h"
9 #include "net/base/net_errors.h" 9 #include "net/base/net_errors.h"
10 #include "net/base/sys_addrinfo.h" 10 #include "net/base/sys_addrinfo.h"
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 if (!endpoint.FromSockAddr(current_address_->ai_addr, 306 if (!endpoint.FromSockAddr(current_address_->ai_addr,
307 current_address_->ai_addrlen)) 307 current_address_->ai_addrlen))
308 return ERR_FAILED; 308 return ERR_FAILED;
309 309
310 int rv = socket_->Connect(endpoint); 310 int rv = socket_->Connect(endpoint);
311 DCHECK_NE(ERR_IO_PENDING, rv); 311 DCHECK_NE(ERR_IO_PENDING, rv);
312 312
313 return rv; 313 return rv;
314 } 314 }
315 315
316 void ClientPacketizer::StartHelloTimer(int milliseconds) { 316 void ClientPacketizer::StartHelloTimer(int milliseconds) {
jar (doing other things) 2012/03/03 22:54:43 Another *possible* candidate for using TimeDelta
317 MessageLoop::current()->PostDelayedTask( 317 MessageLoop::current()->PostDelayedTask(
318 FROM_HERE, 318 FROM_HERE,
319 base::Bind(&ClientPacketizer::OnHelloTimeout, weak_factory_.GetWeakPtr()), 319 base::Bind(&ClientPacketizer::OnHelloTimeout, weak_factory_.GetWeakPtr()),
320 milliseconds); 320 base::TimeDelta::FromMilliseconds(milliseconds));
321 } 321 }
322 322
323 void ClientPacketizer::RevokeHelloTimer() { 323 void ClientPacketizer::RevokeHelloTimer() {
324 weak_factory_.InvalidateWeakPtrs(); 324 weak_factory_.InvalidateWeakPtrs();
325 } 325 }
326 326
327 void ClientPacketizer::OnHelloTimeout() { 327 void ClientPacketizer::OnHelloTimeout() {
328 DCHECK_EQ(WAITING_COOKIE_COMPLETE, next_state_); 328 DCHECK_EQ(WAITING_COOKIE_COMPLETE, next_state_);
329 next_state_ = SENDING_HELLO; 329 next_state_ = SENDING_HELLO;
330 DLOG(INFO) << "HelloTimeout #" << hello_attempts_; 330 DLOG(INFO) << "HelloTimeout #" << hello_attempts_;
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 return rv; 380 return rv;
381 } 381 }
382 382
383 void ClientPacketizer::OnIOComplete(int result) { 383 void ClientPacketizer::OnIOComplete(int result) {
384 int rv = DoLoop(result); 384 int rv = DoLoop(result);
385 if (rv != ERR_IO_PENDING) 385 if (rv != ERR_IO_PENDING)
386 DoCallback(rv); 386 DoCallback(rv);
387 } 387 }
388 388
389 } // namespace net 389 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698