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

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

Issue 2043713004: Mojo: Add NotifyBadMessage API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 std::vector<Handle>* mutable_handles() { return &handles_; } 92 std::vector<Handle>* mutable_handles() { return &handles_; }
93 93
94 // Access the underlying Buffer interface. 94 // Access the underlying Buffer interface.
95 internal::Buffer* buffer() { return buffer_.get(); } 95 internal::Buffer* buffer() { return buffer_.get(); }
96 96
97 // Takes a scoped MessageHandle which may be passed to |WriteMessageNew()| for 97 // Takes a scoped MessageHandle which may be passed to |WriteMessageNew()| for
98 // transmission. Note that this invalidates this Message object, taking 98 // transmission. Note that this invalidates this Message object, taking
99 // ownership of its internal storage and any attached handles. 99 // ownership of its internal storage and any attached handles.
100 ScopedMessageHandle TakeMojoMessage(); 100 ScopedMessageHandle TakeMojoMessage();
101 101
102 // Notifies the system that this message is "bad," in this case meaning it was
103 // rejected by bindings validation code.
104 void NotifyBadMessage();
105
102 private: 106 private:
103 void CloseHandles(); 107 void CloseHandles();
104 108
105 std::unique_ptr<internal::MessageBuffer> buffer_; 109 std::unique_ptr<internal::MessageBuffer> buffer_;
106 std::vector<Handle> handles_; 110 std::vector<Handle> handles_;
107 111
108 DISALLOW_COPY_AND_ASSIGN(Message); 112 DISALLOW_COPY_AND_ASSIGN(Message);
109 }; 113 };
110 114
111 class MessageReceiver { 115 class MessageReceiver {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 // the caller should wait on the handle to become readable. Returns 186 // the caller should wait on the handle to become readable. Returns
183 // MOJO_RESULT_OK if the message was read successfully and should be 187 // MOJO_RESULT_OK if the message was read successfully and should be
184 // dispatched, otherwise returns an error code if something went wrong. 188 // dispatched, otherwise returns an error code if something went wrong.
185 // 189 //
186 // NOTE: The message hasn't been validated and may be malformed! 190 // NOTE: The message hasn't been validated and may be malformed!
187 MojoResult ReadMessage(MessagePipeHandle handle, Message* message); 191 MojoResult ReadMessage(MessagePipeHandle handle, Message* message);
188 192
189 } // namespace mojo 193 } // namespace mojo
190 194
191 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_ 195 #endif // MOJO_PUBLIC_CPP_BINDINGS_MESSAGE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698