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

Side by Side Diff: mojo/edk/system/broker_messages.h

Issue 2098273002: [mojo-edk] Initialise padding in mojo::edk::BrokerMessageHeader. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « no previous file | 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_EDK_SYSTEM_BROKER_MESSAGES_H_ 5 #ifndef MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_
6 #define MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ 6 #define MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_
7 7
8 #include "mojo/edk/system/channel.h" 8 #include "mojo/edk/system/channel.h"
9 9
10 namespace mojo { 10 namespace mojo {
(...skipping 23 matching lines...) Expand all
34 34
35 template <typename T> 35 template <typename T>
36 inline Channel::MessagePtr CreateBrokerMessage(BrokerMessageType type, 36 inline Channel::MessagePtr CreateBrokerMessage(BrokerMessageType type,
37 size_t num_handles, 37 size_t num_handles,
38 T** out_message_data) { 38 T** out_message_data) {
39 const size_t message_size = sizeof(BrokerMessageHeader) + sizeof(T); 39 const size_t message_size = sizeof(BrokerMessageHeader) + sizeof(T);
40 Channel::MessagePtr message(new Channel::Message(message_size, num_handles)); 40 Channel::MessagePtr message(new Channel::Message(message_size, num_handles));
41 BrokerMessageHeader* header = 41 BrokerMessageHeader* header =
42 reinterpret_cast<BrokerMessageHeader*>(message->mutable_payload()); 42 reinterpret_cast<BrokerMessageHeader*>(message->mutable_payload());
43 header->type = type; 43 header->type = type;
44 header->padding = 0;
44 *out_message_data = reinterpret_cast<T*>(header + 1); 45 *out_message_data = reinterpret_cast<T*>(header + 1);
45 return message; 46 return message;
46 } 47 }
47 48
48 inline Channel::MessagePtr CreateBrokerMessage( 49 inline Channel::MessagePtr CreateBrokerMessage(
49 BrokerMessageType type, 50 BrokerMessageType type,
50 size_t num_handles, 51 size_t num_handles,
51 std::nullptr_t** dummy_out_data) { 52 std::nullptr_t** dummy_out_data) {
52 Channel::MessagePtr message( 53 Channel::MessagePtr message(
53 new Channel::Message(sizeof(BrokerMessageHeader), num_handles)); 54 new Channel::Message(sizeof(BrokerMessageHeader), num_handles));
54 BrokerMessageHeader* header = 55 BrokerMessageHeader* header =
55 reinterpret_cast<BrokerMessageHeader*>(message->mutable_payload()); 56 reinterpret_cast<BrokerMessageHeader*>(message->mutable_payload());
56 header->type = type; 57 header->type = type;
58 header->padding = 0;
57 return message; 59 return message;
58 } 60 }
59 61
60 } // namespace edk 62 } // namespace edk
61 } // namespace mojo 63 } // namespace mojo
62 64
63 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_ 65 #endif // MOJO_EDK_SYSTEM_BROKER_MESSAGES_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698