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

Side by Side Diff: mojo/public/cpp/bindings/pipe_control_message_proxy.h

Issue 2649573004: Mojo bindings: merge the control messages of sending disconnect reason and notifying endpoint close… (Closed)
Patch Set: Created 3 years, 11 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 MOJO_PUBLIC_CPP_BINDINGS_PIPE_CONTROL_MESSAGE_PROXY_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_PIPE_CONTROL_MESSAGE_PROXY_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_PIPE_CONTROL_MESSAGE_PROXY_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_PIPE_CONTROL_MESSAGE_PROXY_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/optional.h"
9 #include "mojo/public/cpp/bindings/bindings_export.h" 10 #include "mojo/public/cpp/bindings/bindings_export.h"
11 #include "mojo/public/cpp/bindings/disconnect_reason.h"
10 #include "mojo/public/cpp/bindings/interface_id.h" 12 #include "mojo/public/cpp/bindings/interface_id.h"
11 #include "mojo/public/cpp/bindings/lib/serialization_context.h" 13 #include "mojo/public/cpp/bindings/lib/serialization_context.h"
14 #include "mojo/public/cpp/bindings/message.h"
12 15
13 namespace mojo { 16 namespace mojo {
14 17
15 class MessageReceiver; 18 class MessageReceiver;
16 19
17 // Proxy for request messages defined in pipe_control_messages.mojom. 20 // Proxy for request messages defined in pipe_control_messages.mojom.
18 // 21 //
19 // NOTE: This object may be used from multiple threads. 22 // NOTE: This object may be used from multiple threads.
20 class MOJO_CPP_BINDINGS_EXPORT PipeControlMessageProxy { 23 class MOJO_CPP_BINDINGS_EXPORT PipeControlMessageProxy {
21 public: 24 public:
22 // Doesn't take ownership of |receiver|. If This PipeControlMessageProxy will 25 // Doesn't take ownership of |receiver|. If This PipeControlMessageProxy will
23 // be used from multiple threads, |receiver| must be thread-safe. 26 // be used from multiple threads, |receiver| must be thread-safe.
24 explicit PipeControlMessageProxy(MessageReceiver* receiver); 27 explicit PipeControlMessageProxy(MessageReceiver* receiver);
25 28
26 void NotifyPeerEndpointClosed(InterfaceId id); 29 void NotifyPeerEndpointClosed(InterfaceId id,
30 const base::Optional<DisconnectReason>& reason);
27 void NotifyEndpointClosedBeforeSent(InterfaceId id); 31 void NotifyEndpointClosedBeforeSent(InterfaceId id);
28 32
33 static Message ConstructPeerEndpointClosedMessage(
34 InterfaceId id,
35 const base::Optional<DisconnectReason>& reason);
36
29 private: 37 private:
30 // Not owned. 38 // Not owned.
31 MessageReceiver* receiver_; 39 MessageReceiver* receiver_;
32 40
33 DISALLOW_COPY_AND_ASSIGN(PipeControlMessageProxy); 41 DISALLOW_COPY_AND_ASSIGN(PipeControlMessageProxy);
34 }; 42 };
35 43
36 } // namespace mojo 44 } // namespace mojo
37 45
38 #endif // MOJO_PUBLIC_CPP_BINDINGS_PIPE_CONTROL_MESSAGE_PROXY_H_ 46 #endif // MOJO_PUBLIC_CPP_BINDINGS_PIPE_CONTROL_MESSAGE_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698