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

Side by Side Diff: remoting/protocol/protobuf_message_parser.h

Issue 1534193004: Use std::move() instead of scoped_ptr<>::Pass(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #ifndef REMOTING_PROTOCOL_PROTOBUF_MESSAGE_PARSER_H_ 5 #ifndef REMOTING_PROTOCOL_PROTOBUF_MESSAGE_PARSER_H_
6 #define REMOTING_PROTOCOL_PROTOBUF_MESSAGE_PARSER_H_ 6 #define REMOTING_PROTOCOL_PROTOBUF_MESSAGE_PARSER_H_
7 7
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/callback.h" 9 #include "base/callback.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 30 matching lines...) Expand all
41 private: 41 private:
42 void OnNewData(scoped_ptr<CompoundBuffer> buffer, 42 void OnNewData(scoped_ptr<CompoundBuffer> buffer,
43 const base::Closure& done_task) { 43 const base::Closure& done_task) {
44 scoped_ptr<T> message(new T()); 44 scoped_ptr<T> message(new T());
45 CompoundBufferInputStream stream(buffer.get()); 45 CompoundBufferInputStream stream(buffer.get());
46 bool ret = message->ParseFromZeroCopyStream(&stream); 46 bool ret = message->ParseFromZeroCopyStream(&stream);
47 if (!ret) { 47 if (!ret) {
48 LOG(WARNING) << "Received message that is not a valid protocol buffer."; 48 LOG(WARNING) << "Received message that is not a valid protocol buffer.";
49 } else { 49 } else {
50 DCHECK_EQ(stream.position(), buffer->total_bytes()); 50 DCHECK_EQ(stream.position(), buffer->total_bytes());
51 message_received_callback_.Run(message.Pass(), done_task); 51 message_received_callback_.Run(std::move(message), done_task);
52 } 52 }
53 } 53 }
54 54
55 MessageReader* message_reader_; 55 MessageReader* message_reader_;
56 MessageReceivedCallback message_received_callback_; 56 MessageReceivedCallback message_received_callback_;
57 }; 57 };
58 58
59 } // namespace protocol 59 } // namespace protocol
60 } // namespace remoting 60 } // namespace remoting
61 61
62 #endif // REMOTING_PROTOCOL_PROTOBUF_MESSAGE_PARSER_H_ 62 #endif // REMOTING_PROTOCOL_PROTOBUF_MESSAGE_PARSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698