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

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

Issue 1585493002: [mojo] Ports EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef MOJO_EDK_SYSTEM_PORTS_MESSAGE_H__
6 #define MOJO_EDK_SYSTEM_PORTS_MESSAGE_H__
7
8 #include <utility>
9
10 #include "base/memory/scoped_ptr.h"
11 #include "mojo/edk/embedder/platform_handle_vector.h"
12 #include "mojo/edk/system/channel.h"
13 #include "mojo/edk/system/ports/message.h"
14
15 namespace mojo {
16 namespace edk {
17
18 class NodeController;
19
20 class PortsMessage : public ports::Message {
21 public:
22 static scoped_ptr<PortsMessage> NewUserMessage(size_t num_payload_bytes,
23 size_t num_ports,
24 size_t num_handles);
25
26 ~PortsMessage() override;
27
28 PlatformHandle* handles() { return channel_message_->handles(); }
29 size_t num_handles() const { return channel_message_->num_handles(); }
30 bool has_handles() const { return channel_message_->has_handles(); }
31
32 void SetHandles(ScopedPlatformHandleVectorPtr handles) {
33 channel_message_->SetHandles(std::move(handles));
34 }
35
36 Channel::MessagePtr TakeChannelMessage() {
37 return std::move(channel_message_);
38 }
39
40 private:
41 friend class NodeController;
42
43 // Construct a new user PortsMessage backed by a new Channel::Message.
44 PortsMessage(size_t num_payload_bytes, size_t num_ports, size_t num_handles);
45
46 // Construct a new PortsMessage backed by a Channel::Message. If
47 // |channel_message| is null, a new one is allocated internally.
48 PortsMessage(size_t num_header_bytes,
49 size_t num_payload_bytes,
50 size_t num_ports_bytes,
51 Channel::MessagePtr channel_message);
52
53 Channel::MessagePtr channel_message_;
54 };
55
56 } // namespace edk
57 } // namespace mojo
58
59 #endif // MOJO_EDK_SYSTEM_PORTS_MESSAGE_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698