| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 // TODO(hclam): Remove this header once MessageDispatcher is used. | 5 // TODO(hclam): Remove this header once MessageDispatcher is used. |
| 6 #include "remoting/base/multiple_array_input_stream.h" | 6 #include "remoting/base/multiple_array_input_stream.h" |
| 7 #include "remoting/host/client_connection.h" | 7 #include "remoting/host/client_connection.h" |
| 8 | 8 |
| 9 #include "google/protobuf/message.h" | 9 #include "google/protobuf/message.h" |
| 10 #include "net/base/io_buffer.h" | 10 #include "net/base/io_buffer.h" |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 if (!connection_) | 48 if (!connection_) |
| 49 return; | 49 return; |
| 50 | 50 |
| 51 ChromotingHostMessage msg; | 51 ChromotingHostMessage msg; |
| 52 msg.mutable_init_client()->set_width(width); | 52 msg.mutable_init_client()->set_width(width); |
| 53 msg.mutable_init_client()->set_height(height); | 53 msg.mutable_init_client()->set_height(height); |
| 54 DCHECK(msg.IsInitialized()); | 54 DCHECK(msg.IsInitialized()); |
| 55 video_writer_.SendMessage(msg); | 55 video_writer_.SendMessage(msg); |
| 56 } | 56 } |
| 57 | 57 |
| 58 void ClientConnection::SendVideoPacket(const VideoPacket& packet) { | 58 void ClientConnection::SendUpdateStreamPacketMessage( |
| 59 const ChromotingHostMessage& message) { |
| 59 DCHECK_EQ(loop_, MessageLoop::current()); | 60 DCHECK_EQ(loop_, MessageLoop::current()); |
| 60 | 61 |
| 61 // If we are disconnected then return. | 62 // If we are disconnected then return. |
| 62 if (!connection_) | 63 if (!connection_) |
| 63 return; | 64 return; |
| 64 | 65 |
| 65 ChromotingHostMessage* message = new ChromotingHostMessage(); | 66 video_writer_.SendMessage(message); |
| 66 // TODO(sergeyu): avoid memcopy here. | |
| 67 *message->mutable_video_packet() = packet; | |
| 68 | |
| 69 video_writer_.SendMessage(*message); | |
| 70 | |
| 71 delete message; | |
| 72 } | 67 } |
| 73 | 68 |
| 74 int ClientConnection::GetPendingUpdateStreamMessages() { | 69 int ClientConnection::GetPendingUpdateStreamMessages() { |
| 75 DCHECK_EQ(loop_, MessageLoop::current()); | 70 DCHECK_EQ(loop_, MessageLoop::current()); |
| 76 return video_writer_.GetPendingMessages(); | 71 return video_writer_.GetPendingMessages(); |
| 77 } | 72 } |
| 78 | 73 |
| 79 void ClientConnection::Disconnect() { | 74 void ClientConnection::Disconnect() { |
| 80 DCHECK_EQ(loop_, MessageLoop::current()); | 75 DCHECK_EQ(loop_, MessageLoop::current()); |
| 81 | 76 |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 DCHECK_EQ(loop_, MessageLoop::current()); | 129 DCHECK_EQ(loop_, MessageLoop::current()); |
| 135 DCHECK(handler_); | 130 DCHECK(handler_); |
| 136 handler_->HandleMessage(this, message); | 131 handler_->HandleMessage(this, message); |
| 137 } | 132 } |
| 138 | 133 |
| 139 // OnClosed() is used as a callback for ChromotocolConnection::Close(). | 134 // OnClosed() is used as a callback for ChromotocolConnection::Close(). |
| 140 void ClientConnection::OnClosed() { | 135 void ClientConnection::OnClosed() { |
| 141 } | 136 } |
| 142 | 137 |
| 143 } // namespace remoting | 138 } // namespace remoting |
| OLD | NEW |