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

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

Issue 1864213002: Convert //remoting to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Mac IWYU Created 4 years, 8 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 unified diff | Download patch
« no previous file with comments | « remoting/protocol/message_decoder_unittest.cc ('k') | remoting/protocol/message_reader.h » ('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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_MESSAGE_PIPE_H_ 5 #ifndef REMOTING_PROTOCOL_MESSAGE_PIPE_H_
6 #define REMOTING_PROTOCOL_MESSAGE_PIPE_H_ 6 #define REMOTING_PROTOCOL_MESSAGE_PIPE_H_
7 7
8 #include <memory>
9
8 #include "base/callback_forward.h" 10 #include "base/callback_forward.h"
9 #include "base/memory/scoped_ptr.h"
10 11
11 namespace google { 12 namespace google {
12 namespace protobuf { 13 namespace protobuf {
13 class MessageLite; 14 class MessageLite;
14 } // namespace protobuf 15 } // namespace protobuf
15 } // namespace google 16 } // namespace google
16 17
17 namespace remoting { 18 namespace remoting {
18 19
19 class CompoundBuffer; 20 class CompoundBuffer;
20 21
21 namespace protocol { 22 namespace protocol {
22 23
23 // Represents a bi-directional pipe that allows to send and receive messages. 24 // Represents a bi-directional pipe that allows to send and receive messages.
24 class MessagePipe { 25 class MessagePipe {
25 public: 26 public:
26 typedef base::Callback<void(scoped_ptr<CompoundBuffer> message)> 27 typedef base::Callback<void(std::unique_ptr<CompoundBuffer> message)>
27 MessageReceivedCallback; 28 MessageReceivedCallback;
28 29
29 virtual ~MessagePipe() {} 30 virtual ~MessagePipe() {}
30 31
31 // Starts receiving incoming messages and calls |callback| for each message. 32 // Starts receiving incoming messages and calls |callback| for each message.
32 virtual void StartReceiving(const MessageReceivedCallback& callback) = 0; 33 virtual void StartReceiving(const MessageReceivedCallback& callback) = 0;
33 34
34 // Sends a message. |done| is called when the message has been sent to the 35 // Sends a message. |done| is called when the message has been sent to the
35 // client, but it doesn't mean that the client has received it. |done| is 36 // client, but it doesn't mean that the client has received it. |done| is
36 // never called if the message is never sent (e.g. if the pipe is destroyed 37 // never called if the message is never sent (e.g. if the pipe is destroyed
37 // before the message is sent). 38 // before the message is sent).
38 virtual void Send(google::protobuf::MessageLite* message, 39 virtual void Send(google::protobuf::MessageLite* message,
39 const base::Closure& done) = 0; 40 const base::Closure& done) = 0;
40 }; 41 };
41 42
42 } // namespace protocol 43 } // namespace protocol
43 } // namespace remoting 44 } // namespace remoting
44 45
45 #endif // REMOTING_PROTOCOL_MESSAGE_PIPE_H_ 46 #endif // REMOTING_PROTOCOL_MESSAGE_PIPE_H_
OLDNEW
« no previous file with comments | « remoting/protocol/message_decoder_unittest.cc ('k') | remoting/protocol/message_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698