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 <string.h> | 7 #include <string.h> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 void ChannelMultiplexer::MuxSocket::OnWriteFailed() { | 345 void ChannelMultiplexer::MuxSocket::OnWriteFailed() { |
346 if (!write_callback_.is_null()) { | 346 if (!write_callback_.is_null()) { |
347 net::CompletionCallback cb; | 347 net::CompletionCallback cb; |
348 std::swap(cb, write_callback_); | 348 std::swap(cb, write_callback_); |
349 cb.Run(net::ERR_FAILED); | 349 cb.Run(net::ERR_FAILED); |
350 } | 350 } |
351 } | 351 } |
352 | 352 |
353 void ChannelMultiplexer::MuxSocket::OnPacketReceived() { | 353 void ChannelMultiplexer::MuxSocket::OnPacketReceived() { |
354 if (!read_callback_.is_null()) { | 354 if (!read_callback_.is_null()) { |
355 int result = channel_->DoRead(read_buffer_, read_buffer_size_); | 355 int result = channel_->DoRead(read_buffer_.get(), read_buffer_size_); |
356 read_buffer_ = NULL; | 356 read_buffer_ = NULL; |
357 DCHECK_GT(result, 0); | 357 DCHECK_GT(result, 0); |
358 net::CompletionCallback cb; | 358 net::CompletionCallback cb; |
359 std::swap(cb, read_callback_); | 359 std::swap(cb, read_callback_); |
360 cb.Run(result); | 360 cb.Run(result); |
361 } | 361 } |
362 } | 362 } |
363 | 363 |
364 ChannelMultiplexer::ChannelMultiplexer(ChannelFactory* factory, | 364 ChannelMultiplexer::ChannelMultiplexer(ChannelFactory* factory, |
365 const std::string& base_channel_name) | 365 const std::string& base_channel_name) |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 channel->OnIncomingPacket(packet.Pass(), done_task); | 518 channel->OnIncomingPacket(packet.Pass(), done_task); |
519 } | 519 } |
520 | 520 |
521 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, | 521 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, |
522 const base::Closure& done_task) { | 522 const base::Closure& done_task) { |
523 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); | 523 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); |
524 } | 524 } |
525 | 525 |
526 } // namespace protocol | 526 } // namespace protocol |
527 } // namespace remoting | 527 } // namespace remoting |
OLD | NEW |