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 #include "remoting/protocol/util.h" | 5 #include "remoting/protocol/util.h" |
6 | 6 |
7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
8 #include "base/hash_tables.h" | 8 #include "base/hash_tables.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/task.h" | 10 #include "base/task.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 // int32 of the serialized message size for framing. | 28 // int32 of the serialized message size for framing. |
29 const int kExtraBytes = sizeof(int32); | 29 const int kExtraBytes = sizeof(int32); |
30 int size = msg.ByteSize() + kExtraBytes; | 30 int size = msg.ByteSize() + kExtraBytes; |
31 scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(size)); | 31 scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(size)); |
32 talk_base::SetBE32(buffer->data(), msg.GetCachedSize()); | 32 talk_base::SetBE32(buffer->data(), msg.GetCachedSize()); |
33 msg.SerializeWithCachedSizesToArray( | 33 msg.SerializeWithCachedSizesToArray( |
34 reinterpret_cast<uint8*>(buffer->data()) + kExtraBytes); | 34 reinterpret_cast<uint8*>(buffer->data()) + kExtraBytes); |
35 return buffer; | 35 return buffer; |
36 } | 36 } |
37 | 37 |
38 Task* NewDeleteMessageTask(google::protobuf::MessageLite* message) { | |
39 return NewRunnableFunction(&DeleteMessage, message); | |
40 } | |
41 | |
42 } // namespace protocol | 38 } // namespace protocol |
43 } // namespace remoting | 39 } // namespace remoting |
OLD | NEW |