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

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

Issue 2043713004: Mojo: Add NotifyBadMessage API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: no bindings 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
« no previous file with comments | « mojo/public/c/system/thunks.cc ('k') | no next file » | 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 MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_H_ 5 #ifndef MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_H_
6 #define MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_H_ 6 #define MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_H_
7 7
8 #include <limits> 8 #include <limits>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/strings/string_piece.h"
11 #include "mojo/public/c/system/message_pipe.h" 12 #include "mojo/public/c/system/message_pipe.h"
12 #include "mojo/public/cpp/system/handle.h" 13 #include "mojo/public/cpp/system/handle.h"
13 14
14 namespace mojo { 15 namespace mojo {
15 16
16 const MojoMessageHandle kInvalidMessageHandleValue = 17 const MojoMessageHandle kInvalidMessageHandleValue =
17 MOJO_MESSAGE_HANDLE_INVALID; 18 MOJO_MESSAGE_HANDLE_INVALID;
18 19
19 // Handle wrapper base class for a |MojoMessageHandle|. 20 // Handle wrapper base class for a |MojoMessageHandle|.
20 class MessageHandle { 21 class MessageHandle {
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 65
65 handle->reset(MessageHandle(raw_handle)); 66 handle->reset(MessageHandle(raw_handle));
66 return MOJO_RESULT_OK; 67 return MOJO_RESULT_OK;
67 } 68 }
68 69
69 inline MojoResult GetMessageBuffer(MessageHandle message, void** buffer) { 70 inline MojoResult GetMessageBuffer(MessageHandle message, void** buffer) {
70 DCHECK(message.is_valid()); 71 DCHECK(message.is_valid());
71 return MojoGetMessageBuffer(message.value(), buffer); 72 return MojoGetMessageBuffer(message.value(), buffer);
72 } 73 }
73 74
75 inline MojoResult NotifyBadMessage(MessageHandle message,
76 const base::StringPiece& error) {
77 DCHECK(message.is_valid());
78 return MojoNotifyBadMessage(message.value(), error.data(), error.size());
79 }
80
74 } // namespace mojo 81 } // namespace mojo
75 82
76 #endif // MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_H_ 83 #endif // MOJO_PUBLIC_CPP_SYSTEM_MESSAGE_H_
OLDNEW
« no previous file with comments | « mojo/public/c/system/thunks.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698