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

Side by Side Diff: remoting/protocol/util.cc

Issue 4192012: Convert implicit scoped_refptr constructor calls to explicit ones, part 1 (Closed) Base URL: http://git.chromium.org/git/chromium.git
Patch Set: fix presubmit Created 10 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/protocol/protocol_test_client.cc ('k') | webkit/appcache/appcache_group_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "third_party/libjingle/source/talk/base/byteorder.h" 11 #include "third_party/libjingle/source/talk/base/byteorder.h"
12 12
13 namespace remoting { 13 namespace remoting {
14 14
15 scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( 15 scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage(
16 const google::protobuf::MessageLite& msg) { 16 const google::protobuf::MessageLite& msg) {
17 // Create a buffer with 4 extra bytes. This is used as prefix to write an 17 // Create a buffer with 4 extra bytes. This is used as prefix to write an
18 // int32 of the serialized message size for framing. 18 // int32 of the serialized message size for framing.
19 const int kExtraBytes = sizeof(int32); 19 const int kExtraBytes = sizeof(int32);
20 int size = msg.ByteSize() + kExtraBytes; 20 int size = msg.ByteSize() + kExtraBytes;
21 scoped_refptr<net::IOBufferWithSize> buffer = new net::IOBufferWithSize(size); 21 scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(size));
22 talk_base::SetBE32(buffer->data(), msg.GetCachedSize()); 22 talk_base::SetBE32(buffer->data(), msg.GetCachedSize());
23 msg.SerializeWithCachedSizesToArray( 23 msg.SerializeWithCachedSizesToArray(
24 reinterpret_cast<uint8*>(buffer->data()) + kExtraBytes); 24 reinterpret_cast<uint8*>(buffer->data()) + kExtraBytes);
25 return buffer; 25 return buffer;
26 } 26 }
27 27
28 } // namespace remoting 28 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/protocol_test_client.cc ('k') | webkit/appcache/appcache_group_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698