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

Side by Side Diff: mojo/edk/system/message_for_transit.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/edk/system/core.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | 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_EDK_SYSTEM_MESSAGE_FOR_TRANSIT_H_ 5 #ifndef MOJO_EDK_SYSTEM_MESSAGE_FOR_TRANSIT_H_
6 #define MOJO_EDK_SYSTEM_MESSAGE_FOR_TRANSIT_H_ 6 #define MOJO_EDK_SYSTEM_MESSAGE_FOR_TRANSIT_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 } 82 }
83 83
84 size_t num_bytes() const { 84 size_t num_bytes() const {
85 size_t header_size = header()->header_size; 85 size_t header_size = header()->header_size;
86 DCHECK_GE(message_->num_payload_bytes(), header_size); 86 DCHECK_GE(message_->num_payload_bytes(), header_size);
87 return message_->num_payload_bytes() - header_size; 87 return message_->num_payload_bytes() - header_size;
88 } 88 }
89 89
90 size_t num_handles() const { return header()->num_dispatchers; } 90 size_t num_handles() const { return header()->num_dispatchers; }
91 91
92 const PortsMessage& ports_message() const { return *message_; }
93
92 std::unique_ptr<PortsMessage> TakePortsMessage() { 94 std::unique_ptr<PortsMessage> TakePortsMessage() {
93 return std::move(message_); 95 return std::move(message_);
94 } 96 }
95 97
96 private: 98 private:
97 explicit MessageForTransit(std::unique_ptr<PortsMessage> message); 99 explicit MessageForTransit(std::unique_ptr<PortsMessage> message);
98 100
99 const MessageForTransit::MessageHeader* header() const { 101 const MessageForTransit::MessageHeader* header() const {
100 DCHECK(message_); 102 DCHECK(message_);
101 return static_cast<const MessageForTransit::MessageHeader*>( 103 return static_cast<const MessageForTransit::MessageHeader*>(
102 message_->payload_bytes()); 104 message_->payload_bytes());
103 } 105 }
104 106
105 std::unique_ptr<PortsMessage> message_; 107 std::unique_ptr<PortsMessage> message_;
106 108
107 DISALLOW_COPY_AND_ASSIGN(MessageForTransit); 109 DISALLOW_COPY_AND_ASSIGN(MessageForTransit);
108 }; 110 };
109 111
110 } // namespace edk 112 } // namespace edk
111 } // namespace mojo 113 } // namespace mojo
112 114
113 #endif // MOJO_EDK_SYSTEM_MESSAGE_FOR_TRANSIT_H_ 115 #endif // MOJO_EDK_SYSTEM_MESSAGE_FOR_TRANSIT_H_
OLDNEW
« no previous file with comments | « mojo/edk/system/core.cc ('k') | mojo/edk/system/multiprocess_message_pipe_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698