| 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 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 void ChannelMultiplexer::MuxSocket::OnWriteFailed() { | 337 void ChannelMultiplexer::MuxSocket::OnWriteFailed() { |
| 338 if (!write_callback_.is_null()) { | 338 if (!write_callback_.is_null()) { |
| 339 net::CompletionCallback cb; | 339 net::CompletionCallback cb; |
| 340 std::swap(cb, write_callback_); | 340 std::swap(cb, write_callback_); |
| 341 cb.Run(net::ERR_FAILED); | 341 cb.Run(net::ERR_FAILED); |
| 342 } | 342 } |
| 343 } | 343 } |
| 344 | 344 |
| 345 void ChannelMultiplexer::MuxSocket::OnPacketReceived() { | 345 void ChannelMultiplexer::MuxSocket::OnPacketReceived() { |
| 346 if (!read_callback_.is_null()) { | 346 if (!read_callback_.is_null()) { |
| 347 int result = channel_->DoRead(read_buffer_, read_buffer_size_); | 347 int result = channel_->DoRead(read_buffer_.get(), read_buffer_size_); |
| 348 read_buffer_ = NULL; | 348 read_buffer_ = NULL; |
| 349 DCHECK_GT(result, 0); | 349 DCHECK_GT(result, 0); |
| 350 net::CompletionCallback cb; | 350 net::CompletionCallback cb; |
| 351 std::swap(cb, read_callback_); | 351 std::swap(cb, read_callback_); |
| 352 cb.Run(result); | 352 cb.Run(result); |
| 353 } | 353 } |
| 354 } | 354 } |
| 355 | 355 |
| 356 ChannelMultiplexer::ChannelMultiplexer(ChannelFactory* factory, | 356 ChannelMultiplexer::ChannelMultiplexer(ChannelFactory* factory, |
| 357 const std::string& base_channel_name) | 357 const std::string& base_channel_name) |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 channel->OnIncomingPacket(packet.Pass(), done_task); | 510 channel->OnIncomingPacket(packet.Pass(), done_task); |
| 511 } | 511 } |
| 512 | 512 |
| 513 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, | 513 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, |
| 514 const base::Closure& done_task) { | 514 const base::Closure& done_task) { |
| 515 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); | 515 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); |
| 516 } | 516 } |
| 517 | 517 |
| 518 } // namespace protocol | 518 } // namespace protocol |
| 519 } // namespace remoting | 519 } // namespace remoting |
| OLD | NEW |