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::SendUpdateStreamPacketMessage( | 58 void ClientConnection::SendVideoPacket(const VideoPacket& packet) { |
59 const ChromotingHostMessage& message) { | |
60 DCHECK_EQ(loop_, MessageLoop::current()); | 59 DCHECK_EQ(loop_, MessageLoop::current()); |
61 | 60 |
62 // If we are disconnected then return. | 61 // If we are disconnected then return. |
63 if (!connection_) | 62 if (!connection_) |
64 return; | 63 return; |
65 | 64 |
66 video_writer_.SendMessage(message); | 65 ChromotingHostMessage* message = new ChromotingHostMessage(); |
| 66 // TODO(sergeyu): avoid memcopy here. |
| 67 *message->mutable_video_packet() = packet; |
| 68 |
| 69 video_writer_.SendMessage(*message); |
| 70 |
| 71 delete message; |
67 } | 72 } |
68 | 73 |
69 int ClientConnection::GetPendingUpdateStreamMessages() { | 74 int ClientConnection::GetPendingUpdateStreamMessages() { |
70 DCHECK_EQ(loop_, MessageLoop::current()); | 75 DCHECK_EQ(loop_, MessageLoop::current()); |
71 return video_writer_.GetPendingMessages(); | 76 return video_writer_.GetPendingMessages(); |
72 } | 77 } |
73 | 78 |
74 void ClientConnection::Disconnect() { | 79 void ClientConnection::Disconnect() { |
75 DCHECK_EQ(loop_, MessageLoop::current()); | 80 DCHECK_EQ(loop_, MessageLoop::current()); |
76 | 81 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 DCHECK_EQ(loop_, MessageLoop::current()); | 134 DCHECK_EQ(loop_, MessageLoop::current()); |
130 DCHECK(handler_); | 135 DCHECK(handler_); |
131 handler_->HandleMessage(this, message); | 136 handler_->HandleMessage(this, message); |
132 } | 137 } |
133 | 138 |
134 // OnClosed() is used as a callback for ChromotocolConnection::Close(). | 139 // OnClosed() is used as a callback for ChromotocolConnection::Close(). |
135 void ClientConnection::OnClosed() { | 140 void ClientConnection::OnClosed() { |
136 } | 141 } |
137 | 142 |
138 } // namespace remoting | 143 } // namespace remoting |
OLD | NEW |