OLD | NEW |
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 "jingle/glue/pseudotcp_adapter.h" | 5 #include "jingle/glue/pseudotcp_adapter.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 socket_write_pending_ = false; | 362 socket_write_pending_ = false; |
363 if (result < 0) { | 363 if (result < 0) { |
364 LOG(WARNING) << "Write failed. Error code: " << result; | 364 LOG(WARNING) << "Write failed. Error code: " << result; |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 void PseudoTcpAdapter::Core::AdjustClock() { | 368 void PseudoTcpAdapter::Core::AdjustClock() { |
369 long timeout = 0; | 369 long timeout = 0; |
370 if (pseudo_tcp_.GetNextClock(PseudoTcp::Now(), timeout)) { | 370 if (pseudo_tcp_.GetNextClock(PseudoTcp::Now(), timeout)) { |
371 timer_.Stop(); | 371 timer_.Stop(); |
372 timer_.Start(base::TimeDelta::FromMilliseconds(std::max(timeout, 0L)), this, | 372 timer_.Start(FROM_HERE, |
| 373 base::TimeDelta::FromMilliseconds(std::max(timeout, 0L)), this, |
373 &PseudoTcpAdapter::Core::HandleTcpClock); | 374 &PseudoTcpAdapter::Core::HandleTcpClock); |
374 } | 375 } |
375 } | 376 } |
376 | 377 |
377 void PseudoTcpAdapter::Core::HandleTcpClock() { | 378 void PseudoTcpAdapter::Core::HandleTcpClock() { |
378 // Reference the Core in case a callback deletes the adapter. | 379 // Reference the Core in case a callback deletes the adapter. |
379 scoped_refptr<Core> core(this); | 380 scoped_refptr<Core> core(this); |
380 | 381 |
381 pseudo_tcp_.NotifyClock(PseudoTcp::Now()); | 382 pseudo_tcp_.NotifyClock(PseudoTcp::Now()); |
382 AdjustClock(); | 383 AdjustClock(); |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 DCHECK(CalledOnValidThread()); | 500 DCHECK(CalledOnValidThread()); |
500 core_->SetAckDelay(delay_ms); | 501 core_->SetAckDelay(delay_ms); |
501 } | 502 } |
502 | 503 |
503 void PseudoTcpAdapter::SetNoDelay(bool no_delay) { | 504 void PseudoTcpAdapter::SetNoDelay(bool no_delay) { |
504 DCHECK(CalledOnValidThread()); | 505 DCHECK(CalledOnValidThread()); |
505 core_->SetNoDelay(no_delay); | 506 core_->SetNoDelay(no_delay); |
506 } | 507 } |
507 | 508 |
508 } // namespace jingle_glue | 509 } // namespace jingle_glue |
OLD | NEW |