[M120 Migration][VD] Enable direct rendering for TVPlus
[platform/framework/web/chromium-efl.git] / ipc / message_view.h
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.
4
5 #ifndef IPC_MESSAGE_VIEW_H_
6 #define IPC_MESSAGE_VIEW_H_
7
8 #include <vector>
9
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"
15
16 namespace IPC {
17
18 class COMPONENT_EXPORT(IPC_MOJOM) MessageView {
19  public:
20   MessageView();
21   MessageView(
22       base::span<const uint8_t> bytes,
23       absl::optional<std::vector<mojo::native::SerializedHandlePtr>> handles);
24   MessageView(MessageView&&);
25
26   MessageView(const MessageView&) = delete;
27   MessageView& operator=(const MessageView&) = delete;
28
29   ~MessageView();
30
31   MessageView& operator=(MessageView&&);
32
33   base::span<const uint8_t> bytes() const { return bytes_; }
34   absl::optional<std::vector<mojo::native::SerializedHandlePtr>> TakeHandles();
35
36  private:
37   base::span<const uint8_t> bytes_;
38   absl::optional<std::vector<mojo::native::SerializedHandlePtr>> handles_;
39 };
40
41 }  // namespace IPC
42
43 #endif  // IPC_MESSAGE_VIEW_H_