blob: 9ff1de8c32f53b6b8ce709ab3891ae2e2398b69e [file] [log] [blame]
morrita6308f322015-01-27 07:42:54 +09001// Copyright (c) 2015 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 IPC_IPC_MESSAGE_ATTACHMENT_H_
6#define IPC_IPC_MESSAGE_ATTACHMENT_H_
7
morrita7d1bfcc2015-01-31 14:45:42 +09008#include "base/files/file.h"
9#include "base/macros.h"
morrita6308f322015-01-27 07:42:54 +090010#include "base/memory/ref_counted.h"
rockot6dbfea52016-02-04 05:20:16 +090011#include "base/pickle.h"
avi42ebda42015-12-22 11:39:04 +090012#include "build/build_config.h"
sammc14583362016-11-23 12:17:35 +090013#include "ipc/ipc.mojom.h"
morrita6308f322015-01-27 07:42:54 +090014#include "ipc/ipc_export.h"
15
16namespace IPC {
17
18// Auxiliary data sent with |Message|. This can be a platform file descriptor
19// or a mojo |MessagePipe|. |GetType()| returns the type of the subclass.
rockot6dbfea52016-02-04 05:20:16 +090020class IPC_EXPORT MessageAttachment : public base::Pickle::Attachment {
morrita6308f322015-01-27 07:42:54 +090021 public:
sammc14583362016-11-23 12:17:35 +090022 using Type = mojom::SerializedHandle::Type;
morrita6308f322015-01-27 07:42:54 +090023
24 virtual Type GetType() const = 0;
morrita1b52e4c2015-02-06 09:58:30 +090025
morrita6308f322015-01-27 07:42:54 +090026 protected:
erikchene7e30922015-10-31 08:16:29 +090027 friend class base::RefCountedThreadSafe<MessageAttachment>;
morrita7d1bfcc2015-01-31 14:45:42 +090028 MessageAttachment();
rockot6dbfea52016-02-04 05:20:16 +090029 ~MessageAttachment() override;
morrita7d1bfcc2015-01-31 14:45:42 +090030
31 DISALLOW_COPY_AND_ASSIGN(MessageAttachment);
morrita6308f322015-01-27 07:42:54 +090032};
33
34} // namespace IPC
35
36#endif // IPC_IPC_MESSAGE_ATTACHMENT_H_