Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(773)

Unified Diff: remoting/host/client_connection.cc

Issue 2963003: Changing UpdateStreamPacket protobuf definition for chromoting (Closed)
Patch Set: fixed comments Created 10 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/client_connection.h ('k') | remoting/host/client_connection_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/client_connection.cc
diff --git a/remoting/host/client_connection.cc b/remoting/host/client_connection.cc
index d69a326efde08d41c105ff7426ad4c1aff496bb1..6c8516a1dac01891d264037eb64d33cb0f40e49a 100644
--- a/remoting/host/client_connection.cc
+++ b/remoting/host/client_connection.cc
@@ -35,6 +35,16 @@ ClientConnection::~ClientConnection() {
// jingle channel.
}
+// static
+scoped_refptr<media::DataBuffer>
+ ClientConnection::CreateWireFormatDataBuffer(
+ const HostMessage* msg) {
+ // TODO(hclam): Instead of serializing |msg| create an DataBuffer
+ // object that wraps around it.
+ scoped_ptr<const HostMessage> message_deleter(msg);
+ return SerializeAndFrameMessage(*msg);
+}
+
void ClientConnection::SendInitClientMessage(int width, int height) {
DCHECK_EQ(loop_, MessageLoop::current());
DCHECK(!update_stream_size_);
@@ -68,7 +78,6 @@ void ClientConnection::SendBeginUpdateStreamMessage() {
}
void ClientConnection::SendUpdateStreamPacketMessage(
- const UpdateStreamPacketHeader* header,
scoped_refptr<DataBuffer> data) {
DCHECK_EQ(loop_, MessageLoop::current());
@@ -76,16 +85,8 @@ void ClientConnection::SendUpdateStreamPacketMessage(
if (!channel_)
return;
- HostMessage msg;
- msg.mutable_update_stream_packet()->mutable_header()->CopyFrom(*header);
- // TODO(hclam): This introduce one memory copy. Eliminate it.
- msg.mutable_update_stream_packet()->set_data(
- data->GetData(), data->GetDataSize());
- DCHECK(msg.IsInitialized());
-
- scoped_refptr<DataBuffer> encoded_data = SerializeAndFrameMessage(msg);
update_stream_size_ += data->GetDataSize();
- channel_->Write(encoded_data);
+ channel_->Write(data);
}
void ClientConnection::SendEndUpdateStreamMessage() {
« no previous file with comments | « remoting/host/client_connection.h ('k') | remoting/host/client_connection_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698