1 // Copyright 2018 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 #include "ipc/message_view.h"
6 
7 namespace IPC {
8 
9 MessageView::MessageView() = default;
10 
MessageView(const Message & message,base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles)11 MessageView::MessageView(
12     const Message& message,
13     base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles)
14     : buffer_view_(base::make_span<const uint8_t>(
15           static_cast<const uint8_t*>(message.data()),
16           message.size())),
17       handles_(std::move(handles)) {}
18 
MessageView(mojo_base::BigBufferView buffer_view,base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles)19 MessageView::MessageView(
20     mojo_base::BigBufferView buffer_view,
21     base::Optional<std::vector<mojo::native::SerializedHandlePtr>> handles)
22     : buffer_view_(std::move(buffer_view)), handles_(std::move(handles)) {}
23 
24 MessageView::MessageView(MessageView&&) = default;
25 
26 MessageView::~MessageView() = default;
27 
28 MessageView& MessageView::operator=(MessageView&&) = default;
29 
30 }  // namespace IPC
31