| 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/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
| (...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 } | 378 } |
| 379 | 379 |
| 380 // Public interface implemention. | 380 // Public interface implemention. |
| 381 | 381 |
| 382 PseudoTcpAdapter::PseudoTcpAdapter(net::Socket* socket) | 382 PseudoTcpAdapter::PseudoTcpAdapter(net::Socket* socket) |
| 383 : core_(new Core(socket)) { | 383 : core_(new Core(socket)) { |
| 384 } | 384 } |
| 385 | 385 |
| 386 PseudoTcpAdapter::~PseudoTcpAdapter() { | 386 PseudoTcpAdapter::~PseudoTcpAdapter() { |
| 387 Disconnect(); | 387 Disconnect(); |
| 388 if (!destruction_callback_.is_null()) |
| 389 destruction_callback_.Run(); |
| 390 } |
| 391 |
| 392 void PseudoTcpAdapter::SetOnDestroyedCallback( |
| 393 const base::Closure& callback) { |
| 394 destruction_callback_ = callback; |
| 388 } | 395 } |
| 389 | 396 |
| 390 int PseudoTcpAdapter::Read(net::IOBuffer* buffer, int buffer_size, | 397 int PseudoTcpAdapter::Read(net::IOBuffer* buffer, int buffer_size, |
| 391 const net::CompletionCallback& callback) { | 398 const net::CompletionCallback& callback) { |
| 392 DCHECK(CalledOnValidThread()); | 399 DCHECK(CalledOnValidThread()); |
| 393 return core_->Read(buffer, buffer_size, callback); | 400 return core_->Read(buffer, buffer_size, callback); |
| 394 } | 401 } |
| 395 | 402 |
| 396 int PseudoTcpAdapter::Write(net::IOBuffer* buffer, int buffer_size, | 403 int PseudoTcpAdapter::Write(net::IOBuffer* buffer, int buffer_size, |
| 397 const net::CompletionCallback& callback) { | 404 const net::CompletionCallback& callback) { |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 DCHECK(CalledOnValidThread()); | 501 DCHECK(CalledOnValidThread()); |
| 495 core_->SetAckDelay(delay_ms); | 502 core_->SetAckDelay(delay_ms); |
| 496 } | 503 } |
| 497 | 504 |
| 498 void PseudoTcpAdapter::SetNoDelay(bool no_delay) { | 505 void PseudoTcpAdapter::SetNoDelay(bool no_delay) { |
| 499 DCHECK(CalledOnValidThread()); | 506 DCHECK(CalledOnValidThread()); |
| 500 core_->SetNoDelay(no_delay); | 507 core_->SetNoDelay(no_delay); |
| 501 } | 508 } |
| 502 | 509 |
| 503 } // namespace jingle_glue | 510 } // namespace jingle_glue |
| OLD | NEW |