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

Side by Side Diff: mojo/public/cpp/bindings/lib/control_message_handler.h

Issue 2766523002: mojo: MessageReceiver*::AcceptWithResponder() now take a unique_ptr to the responder (Closed)
Patch Set: comments Created 3 years, 9 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_LIB_CONTROL_MESSAGE_HANDLER_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/compiler_specific.h" 10 #include "base/compiler_specific.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "mojo/public/cpp/bindings/bindings_export.h" 12 #include "mojo/public/cpp/bindings/bindings_export.h"
13 #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" 14 #include "mojo/public/cpp/bindings/message.h"
15 15
16 namespace mojo { 16 namespace mojo {
17 namespace internal { 17 namespace internal {
18 18
19 // Handlers for request messages defined in interface_control_messages.mojom. 19 // Handlers for request messages defined in interface_control_messages.mojom.
20 class MOJO_CPP_BINDINGS_EXPORT ControlMessageHandler 20 class MOJO_CPP_BINDINGS_EXPORT ControlMessageHandler
21 : NON_EXPORTED_BASE(public MessageReceiverWithResponderStatus) { 21 : NON_EXPORTED_BASE(public MessageReceiverWithResponderStatus) {
22 public: 22 public:
23 static bool IsControlMessage(const Message* message); 23 static bool IsControlMessage(const Message* message);
24 24
25 explicit ControlMessageHandler(uint32_t interface_version); 25 explicit ControlMessageHandler(uint32_t interface_version);
26 ~ControlMessageHandler() override; 26 ~ControlMessageHandler() override;
27 27
28 // Call the following methods only if IsControlMessage() returned true. 28 // Call the following methods only if IsControlMessage() returned true.
29 bool Accept(Message* message) override; 29 bool Accept(Message* message) override;
30 // Takes ownership of |responder|. 30 bool AcceptWithResponder(
31 bool AcceptWithResponder(Message* message, 31 Message* message,
32 MessageReceiverWithStatus* responder) override; 32 std::unique_ptr<MessageReceiverWithStatus> responder) override;
33 33
34 private: 34 private:
35 bool Run(Message* message, MessageReceiverWithStatus* responder); 35 bool Run(Message* message,
36 std::unique_ptr<MessageReceiverWithStatus> responder);
36 bool RunOrClosePipe(Message* message); 37 bool RunOrClosePipe(Message* message);
37 38
38 uint32_t interface_version_; 39 uint32_t interface_version_;
39 SerializationContext context_; 40 SerializationContext context_;
40 41
41 DISALLOW_COPY_AND_ASSIGN(ControlMessageHandler); 42 DISALLOW_COPY_AND_ASSIGN(ControlMessageHandler);
42 }; 43 };
43 44
44 } // namespace internal 45 } // namespace internal
45 } // namespace mojo 46 } // namespace mojo
46 47
47 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_ 48 #endif // MOJO_PUBLIC_CPP_BINDINGS_LIB_CONTROL_MESSAGE_HANDLER_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/associated_interface_ptr_state.h ('k') | mojo/public/cpp/bindings/lib/control_message_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698