xref: /aosp_15_r20/external/cronet/ipc/message_view.cc (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
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 #include "ipc/message_view.h"
6 
7 #include "mojo/public/interfaces/bindings/native_struct.mojom.h"
8 
9 namespace IPC {
10 
11 MessageView::MessageView() = default;
12 
MessageView(base::span<const uint8_t> bytes,std::optional<std::vector<mojo::native::SerializedHandlePtr>> handles)13 MessageView::MessageView(
14     base::span<const uint8_t> bytes,
15     std::optional<std::vector<mojo::native::SerializedHandlePtr>> handles)
16     : bytes_(bytes), handles_(std::move(handles)) {}
17 
18 MessageView::MessageView(MessageView&&) = default;
19 
20 MessageView::~MessageView() = default;
21 
22 MessageView& MessageView::operator=(MessageView&&) = default;
23 
24 std::optional<std::vector<mojo::native::SerializedHandlePtr>>
TakeHandles()25 MessageView::TakeHandles() {
26   return std::move(handles_);
27 }
28 
29 }  // namespace IPC
30