OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "remoting/protocol/pseudotcp_adapter.h" | 5 #include "remoting/protocol/pseudotcp_adapter.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <utility> | 9 #include <utility> |
10 | 10 |
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 } | 448 } |
449 } | 449 } |
450 } | 450 } |
451 | 451 |
452 // Public interface implementation. | 452 // Public interface implementation. |
453 | 453 |
454 PseudoTcpAdapter::PseudoTcpAdapter(std::unique_ptr<P2PDatagramSocket> socket) | 454 PseudoTcpAdapter::PseudoTcpAdapter(std::unique_ptr<P2PDatagramSocket> socket) |
455 : core_(new Core(std::move(socket))) {} | 455 : core_(new Core(std::move(socket))) {} |
456 | 456 |
457 PseudoTcpAdapter::~PseudoTcpAdapter() { | 457 PseudoTcpAdapter::~PseudoTcpAdapter() { |
| 458 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
458 // Make sure that the underlying socket is destroyed before PseudoTcp. | 459 // Make sure that the underlying socket is destroyed before PseudoTcp. |
459 core_->DeleteSocket(); | 460 core_->DeleteSocket(); |
460 } | 461 } |
461 | 462 |
462 int PseudoTcpAdapter::Read(const scoped_refptr<net::IOBuffer>& buffer, | 463 int PseudoTcpAdapter::Read(const scoped_refptr<net::IOBuffer>& buffer, |
463 int buffer_size, | 464 int buffer_size, |
464 const net::CompletionCallback& callback) { | 465 const net::CompletionCallback& callback) { |
465 DCHECK(CalledOnValidThread()); | 466 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
466 return core_->Read(buffer, buffer_size, callback); | 467 return core_->Read(buffer, buffer_size, callback); |
467 } | 468 } |
468 | 469 |
469 int PseudoTcpAdapter::Write(const scoped_refptr<net::IOBuffer>& buffer, | 470 int PseudoTcpAdapter::Write(const scoped_refptr<net::IOBuffer>& buffer, |
470 int buffer_size, | 471 int buffer_size, |
471 const net::CompletionCallback& callback) { | 472 const net::CompletionCallback& callback) { |
472 DCHECK(CalledOnValidThread()); | 473 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
473 return core_->Write(buffer, buffer_size, callback); | 474 return core_->Write(buffer, buffer_size, callback); |
474 } | 475 } |
475 | 476 |
476 int PseudoTcpAdapter::SetReceiveBufferSize(int32_t size) { | 477 int PseudoTcpAdapter::SetReceiveBufferSize(int32_t size) { |
477 DCHECK(CalledOnValidThread()); | 478 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
478 core_->SetReceiveBufferSize(size); | 479 core_->SetReceiveBufferSize(size); |
479 return net::OK; | 480 return net::OK; |
480 } | 481 } |
481 | 482 |
482 int PseudoTcpAdapter::SetSendBufferSize(int32_t size) { | 483 int PseudoTcpAdapter::SetSendBufferSize(int32_t size) { |
483 DCHECK(CalledOnValidThread()); | 484 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
484 core_->SetSendBufferSize(size); | 485 core_->SetSendBufferSize(size); |
485 return net::OK; | 486 return net::OK; |
486 } | 487 } |
487 | 488 |
488 int PseudoTcpAdapter::Connect(const net::CompletionCallback& callback) { | 489 int PseudoTcpAdapter::Connect(const net::CompletionCallback& callback) { |
489 DCHECK(CalledOnValidThread()); | 490 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
490 return core_->Connect(callback); | 491 return core_->Connect(callback); |
491 } | 492 } |
492 | 493 |
493 void PseudoTcpAdapter::SetAckDelay(int delay_ms) { | 494 void PseudoTcpAdapter::SetAckDelay(int delay_ms) { |
494 DCHECK(CalledOnValidThread()); | 495 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
495 core_->SetAckDelay(delay_ms); | 496 core_->SetAckDelay(delay_ms); |
496 } | 497 } |
497 | 498 |
498 void PseudoTcpAdapter::SetNoDelay(bool no_delay) { | 499 void PseudoTcpAdapter::SetNoDelay(bool no_delay) { |
499 DCHECK(CalledOnValidThread()); | 500 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
500 core_->SetNoDelay(no_delay); | 501 core_->SetNoDelay(no_delay); |
501 } | 502 } |
502 | 503 |
503 void PseudoTcpAdapter::SetWriteWaitsForSend(bool write_waits_for_send) { | 504 void PseudoTcpAdapter::SetWriteWaitsForSend(bool write_waits_for_send) { |
504 DCHECK(CalledOnValidThread()); | 505 DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_); |
505 core_->SetWriteWaitsForSend(write_waits_for_send); | 506 core_->SetWriteWaitsForSend(write_waits_for_send); |
506 } | 507 } |
507 | 508 |
508 } // namespace protocol | 509 } // namespace protocol |
509 } // namespace remoting | 510 } // namespace remoting |
OLD | NEW |