1 // Copyright 2018 The Chromium Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef IPC_MESSAGE_VIEW_H_
6 #define IPC_MESSAGE_VIEW_H_
10 #include "base/component_export.h"
11 #include "base/containers/span.h"
12 #include "ipc/ipc_message.h"
13 #include "mojo/public/interfaces/bindings/native_struct.mojom-forward.h"
14 #include "third_party/abseil-cpp/absl/types/optional.h"
18 class COMPONENT_EXPORT(IPC_MOJOM) MessageView {
22 base::span<const uint8_t> bytes,
23 absl::optional<std::vector<mojo::native::SerializedHandlePtr>> handles);
24 MessageView(MessageView&&);
26 MessageView(const MessageView&) = delete;
27 MessageView& operator=(const MessageView&) = delete;
31 MessageView& operator=(MessageView&&);
33 base::span<const uint8_t> bytes() const { return bytes_; }
34 absl::optional<std::vector<mojo::native::SerializedHandlePtr>> TakeHandles();
37 base::span<const uint8_t> bytes_;
38 absl::optional<std::vector<mojo::native::SerializedHandlePtr>> handles_;
43 #endif // IPC_MESSAGE_VIEW_H_