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

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

Issue 1819463002: Make mojo::Callback safe to copy across threads. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: review comments Created 4 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 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 MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 6 #define MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 // A MessageReceiver that is also able to provide status about the state 130 // A MessageReceiver that is also able to provide status about the state
131 // of the underlying MessagePipe to which it will be forwarding messages 131 // of the underlying MessagePipe to which it will be forwarding messages
132 // received via the |Accept()| call. 132 // received via the |Accept()| call.
133 class MessageReceiverWithStatus : public MessageReceiver { 133 class MessageReceiverWithStatus : public MessageReceiver {
134 public: 134 public:
135 ~MessageReceiverWithStatus() override {} 135 ~MessageReceiverWithStatus() override {}
136 136
137 // Returns |true| if this MessageReceiver is currently bound to a MessagePipe, 137 // Returns |true| if this MessageReceiver is currently bound to a MessagePipe,
138 // the pipe has not been closed, and the pipe has not encountered an error. 138 // the pipe has not been closed, and the pipe has not encountered an error.
139 virtual bool IsValid() = 0; 139 virtual bool IsValid() = 0;
140
141 // DCHECKs if this MessageReceiver is currently bound to a MessagePipe, the
142 // pipe has not been closed, and the pipe has not encountered an error.
143 // This function may be called on any thread.
144 virtual void DCheckInvalid(const std::string& message) = 0;
140 }; 145 };
141 146
142 // An alternative to MessageReceiverWithResponder for cases in which it 147 // An alternative to MessageReceiverWithResponder for cases in which it
143 // is necessary for the implementor of this interface to know about the status 148 // is necessary for the implementor of this interface to know about the status
144 // of the MessagePipe which will carry the responses. 149 // of the MessagePipe which will carry the responses.
145 class MessageReceiverWithResponderStatus : public MessageReceiver { 150 class MessageReceiverWithResponderStatus : public MessageReceiver {
146 public: 151 public:
147 ~MessageReceiverWithResponderStatus() override {} 152 ~MessageReceiverWithResponderStatus() override {}
148 153
149 // A variant on Accept that registers a MessageReceiverWithStatus (known as 154 // A variant on Accept that registers a MessageReceiverWithStatus (known as
(...skipping 16 matching lines...) Expand all
166 // the caller should wait on the handle to become readable. Returns 171 // the caller should wait on the handle to become readable. Returns
167 // MOJO_RESULT_OK if the message was read successfully and should be 172 // MOJO_RESULT_OK if the message was read successfully and should be
168 // dispatched, otherwise returns an error code if something went wrong. 173 // dispatched, otherwise returns an error code if something went wrong.
169 // 174 //
170 // NOTE: The message hasn't been validated and may be malformed! 175 // NOTE: The message hasn't been validated and may be malformed!
171 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); 176 MojoResult ReadMessage(MessagePipeHandle handle, Message* message);
172 177
173 } // namespace mojo 178 } // namespace mojo
174 179
175 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 180 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/lib/router.cc ('k') | mojo/public/cpp/bindings/tests/binding_callback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698