| 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 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 475 | 475 |
| 476 void ChannelMultiplexer::NotifyWriteFailed(const std::string& name) { | 476 void ChannelMultiplexer::NotifyWriteFailed(const std::string& name) { |
| 477 std::map<std::string, MuxChannel*>::iterator it = channels_.find(name); | 477 std::map<std::string, MuxChannel*>::iterator it = channels_.find(name); |
| 478 if (it != channels_.end()) { | 478 if (it != channels_.end()) { |
| 479 it->second->OnWriteFailed(); | 479 it->second->OnWriteFailed(); |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 void ChannelMultiplexer::OnIncomingPacket(scoped_ptr<MultiplexPacket> packet, | 483 void ChannelMultiplexer::OnIncomingPacket(scoped_ptr<MultiplexPacket> packet, |
| 484 const base::Closure& done_task) { | 484 const base::Closure& done_task) { |
| 485 DCHECK(packet->has_channel_id()); |
| 485 if (!packet->has_channel_id()) { | 486 if (!packet->has_channel_id()) { |
| 486 LOG(ERROR) << "Received packet without channel_id."; | 487 LOG(ERROR) << "Received packet without channel_id."; |
| 487 done_task.Run(); | 488 done_task.Run(); |
| 488 return; | 489 return; |
| 489 } | 490 } |
| 490 | 491 |
| 491 int receive_id = packet->channel_id(); | 492 int receive_id = packet->channel_id(); |
| 492 MuxChannel* channel = NULL; | 493 MuxChannel* channel = NULL; |
| 493 std::map<int, MuxChannel*>::iterator it = | 494 std::map<int, MuxChannel*>::iterator it = |
| 494 channels_by_receive_id_.find(receive_id); | 495 channels_by_receive_id_.find(receive_id); |
| (...skipping 15 matching lines...) Expand all Loading... |
| 510 channel->OnIncomingPacket(packet.Pass(), done_task); | 511 channel->OnIncomingPacket(packet.Pass(), done_task); |
| 511 } | 512 } |
| 512 | 513 |
| 513 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, | 514 bool ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet, |
| 514 const base::Closure& done_task) { | 515 const base::Closure& done_task) { |
| 515 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); | 516 return writer_.Write(SerializeAndFrameMessage(*packet), done_task); |
| 516 } | 517 } |
| 517 | 518 |
| 518 } // namespace protocol | 519 } // namespace protocol |
| 519 } // namespace remoting | 520 } // namespace remoting |
| OLD | NEW |