| OLD | NEW |
| 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 "remoting/protocol/channel_multiplexer.h" | 5 #include "remoting/protocol/channel_multiplexer.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <string.h> | 8 #include <string.h> |
| 9 | 9 |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 void ChannelMultiplexer::OnBaseChannelReady( | 365 void ChannelMultiplexer::OnBaseChannelReady( |
| 366 scoped_ptr<P2PStreamSocket> socket) { | 366 scoped_ptr<P2PStreamSocket> socket) { |
| 367 base_channel_factory_ = nullptr; | 367 base_channel_factory_ = nullptr; |
| 368 base_channel_ = std::move(socket); | 368 base_channel_ = std::move(socket); |
| 369 | 369 |
| 370 if (base_channel_.get()) { | 370 if (base_channel_.get()) { |
| 371 // Initialize reader and writer. | 371 // Initialize reader and writer. |
| 372 reader_.StartReading(base_channel_.get(), | 372 reader_.StartReading(base_channel_.get(), |
| 373 base::Bind(&ChannelMultiplexer::OnBaseChannelError, | 373 base::Bind(&ChannelMultiplexer::OnBaseChannelError, |
| 374 base::Unretained(this))); | 374 base::Unretained(this))); |
| 375 writer_.Init(base::Bind(&P2PStreamSocket::Write, | 375 writer_.Start(base::Bind(&P2PStreamSocket::Write, |
| 376 base::Unretained(base_channel_.get())), | 376 base::Unretained(base_channel_.get())), |
| 377 base::Bind(&ChannelMultiplexer::OnBaseChannelError, | 377 base::Bind(&ChannelMultiplexer::OnBaseChannelError, |
| 378 base::Unretained(this))); | 378 base::Unretained(this))); |
| 379 } | 379 } |
| 380 | 380 |
| 381 DoCreatePendingChannels(); | 381 DoCreatePendingChannels(); |
| 382 } | 382 } |
| 383 | 383 |
| 384 void ChannelMultiplexer::DoCreatePendingChannels() { | 384 void ChannelMultiplexer::DoCreatePendingChannels() { |
| 385 if (pending_channels_.empty()) | 385 if (pending_channels_.empty()) |
| 386 return; | 386 return; |
| 387 | 387 |
| 388 // Every time this function is called it connects a single channel and posts a | 388 // Every time this function is called it connects a single channel and posts a |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 464 channel->OnIncomingPacket(std::move(packet), done_task); | 464 channel->OnIncomingPacket(std::move(packet), done_task); |
| 465 } | 465 } |
| 466 | 466 |
| 467 void ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, | 467 void ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, |
| 468 const base::Closure& done_task) { | 468 const base::Closure& done_task) { |
| 469 writer_.Write(SerializeAndFrameMessage(*packet), done_task); | 469 writer_.Write(SerializeAndFrameMessage(*packet), done_task); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace protocol | 472 } // namespace protocol |
| 473 } // namespace remoting | 473 } // namespace remoting |
| OLD | NEW |