diff options
author | erikchen <erikchen@chromium.org> | 2016-02-16 14:00:54 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-02-16 22:02:46 +0000 |
commit | 11fea2242b3a197993dbd5a1f977f9a31c6b98e4 (patch) | |
tree | a01c485ee5e08742566c48221cf9855940e72738 /ipc/attachment_broker_unprivileged.h | |
parent | 11afb324fa322a3d651124f3ca244c9595f84768 (diff) | |
download | chromium_src-11fea2242b3a197993dbd5a1f977f9a31c6b98e4.zip chromium_src-11fea2242b3a197993dbd5a1f977f9a31c6b98e4.tar.gz chromium_src-11fea2242b3a197993dbd5a1f977f9a31c6b98e4.tar.bz2 |
Clean up public interface of AttachmentBrokerUnprivileged.
In the old interface, a static factory method returns a scoped_ptr, and the
caller had to manage the lifetime. Since this is a global object with minimal
memory footprint, and is required to outlive every IPC::Channel, it's much
easier for the global to never be destroyed. This also matches the interface for
AttachmentBrokerPrivileged.
BUG=584297
Review URL: https://codereview.chromium.org/1679763002
Cr-Commit-Position: refs/heads/master@{#375674}
Diffstat (limited to 'ipc/attachment_broker_unprivileged.h')
-rw-r--r-- | ipc/attachment_broker_unprivileged.h | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/ipc/attachment_broker_unprivileged.h b/ipc/attachment_broker_unprivileged.h index b572ff8..f6d520d 100644 --- a/ipc/attachment_broker_unprivileged.h +++ b/ipc/attachment_broker_unprivileged.h @@ -22,17 +22,15 @@ class IPC_EXPORT AttachmentBrokerUnprivileged : public IPC::AttachmentBroker { AttachmentBrokerUnprivileged(); ~AttachmentBrokerUnprivileged() override; - // On platforms that support attachment brokering, returns a new instance of - // a platform-specific attachment broker. Otherwise returns |nullptr|. - // The caller takes ownership of the newly created instance, and is - // responsible for ensuring that the attachment broker lives longer than - // every IPC::Channel. The new instance automatically registers itself as the - // global attachment broker. - static scoped_ptr<AttachmentBrokerUnprivileged> CreateBroker(); + // If there is no global attachment broker, makes a new + // AttachmentBrokerUnprivileged and sets it as the global attachment broker. + // This method is thread safe. + static void CreateBrokerIfNeeded(); - // In each unprivileged process, exactly one channel should be used to - // communicate brokerable attachments with the broker process. - void DesignateBrokerCommunicationChannel(Endpoint* endpoint); + // AttachmentBroker: + void RegisterBrokerCommunicationChannel(Endpoint* endpoint) override; + void DeregisterBrokerCommunicationChannel(Endpoint* endpoint) override; + bool IsPrivilegedBroker() override; protected: IPC::Sender* get_sender() { return sender_; } |