| Index: ipc/attachment_broker.h
|
| diff --git a/ipc/attachment_broker.h b/ipc/attachment_broker.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..de9d13dba2165c5754fda9a321b744065a468d0e
|
| --- /dev/null
|
| +++ b/ipc/attachment_broker.h
|
| @@ -0,0 +1,54 @@
|
| +// Copyright 2015 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#ifndef IPC_ATTACHMENT_BROKER_H_
|
| +#define IPC_ATTACHMENT_BROKER_H_
|
| +
|
| +#include "base/macros.h"
|
| +#include "base/process/process_handle.h"
|
| +#include "ipc/brokerable_attachment.h"
|
| +#include "ipc/ipc_export.h"
|
| +
|
| +namespace IPC {
|
| +
|
| +class AttachmentBroker;
|
| +// Classes that inherit from this abstract base class are capable of
|
| +// communicating with a broker to send and receive attachments to Chrome IPC
|
| +// messages.
|
| +class IPC_EXPORT SupportsAttachmentBrokering {
|
| + public:
|
| + // Returns an AttachmentBroker used to broker attachments of IPC messages to
|
| + // other processes. There must be exactly one AttachmentBroker per process.
|
| + virtual AttachmentBroker* GetAttachmentBroker() = 0;
|
| +};
|
| +
|
| +// Responsible for brokering attachments to Chrome IPC messages. On platforms
|
| +// that support attachment brokering, every IPC channel should have an
|
| +// AttachmentBroker.
|
| +class IPC_EXPORT AttachmentBroker {
|
| + public:
|
| + AttachmentBroker() {}
|
| + virtual ~AttachmentBroker() {}
|
| +
|
| + // Sends |attachment| to |destination_process|. The implementation uses an
|
| + // IPC::Channel to communicate with the broker process. This may be the same
|
| + // IPC::Channel that is requesting the brokerage of an attachment.
|
| + virtual void SendAttachmentToProcess(
|
| + internal::BrokerableAttachment* attachment,
|
| + base::ProcessId destination_process) = 0;
|
| +
|
| + // Returns whether the attachment was available. If the attachment was
|
| + // available, populates the output parameter |attachment|. The caller then
|
| + // becomes the owner of |attachment|.
|
| + virtual bool GetAttachmentWithId(
|
| + BrokerableAttachmentId,
|
| + internal::BrokerableAttachment* attachment) = 0;
|
| +
|
| + private:
|
| + DISALLOW_COPY_AND_ASSIGN(AttachmentBroker);
|
| +};
|
| +
|
| +} // namespace IPC
|
| +
|
| +#endif // IPC_ATTACHMENT_BROKER_H_
|
|
|