summaryrefslogtreecommitdiffstats
path: root/ipc/attachment_broker_privileged.cc
diff options
context:
space:
mode:
authorerikchen <erikchen@chromium.org>2016-02-16 14:00:54 -0800
committerCommit bot <commit-bot@chromium.org>2016-02-16 22:02:46 +0000
commit11fea2242b3a197993dbd5a1f977f9a31c6b98e4 (patch)
treea01c485ee5e08742566c48221cf9855940e72738 /ipc/attachment_broker_privileged.cc
parent11afb324fa322a3d651124f3ca244c9595f84768 (diff)
downloadchromium_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_privileged.cc')
-rw-r--r--ipc/attachment_broker_privileged.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/ipc/attachment_broker_privileged.cc b/ipc/attachment_broker_privileged.cc
index 85c1ac9..9006798 100644
--- a/ipc/attachment_broker_privileged.cc
+++ b/ipc/attachment_broker_privileged.cc
@@ -67,9 +67,7 @@ scoped_ptr<AttachmentBrokerPrivileged> CreateBroker() {
// the global broker.
class AttachmentBrokerMakeOnce {
public:
- AttachmentBrokerMakeOnce() {
- attachment_broker_.reset(CreateBroker().release());
- }
+ AttachmentBrokerMakeOnce() : attachment_broker_(CreateBroker()) {}
private:
scoped_ptr<IPC::AttachmentBrokerPrivileged> attachment_broker_;
@@ -128,6 +126,10 @@ void AttachmentBrokerPrivileged::DeregisterCommunicationChannel(
endpoints_.erase(it);
}
+bool AttachmentBrokerPrivileged::IsPrivilegedBroker() {
+ return true;
+}
+
Sender* AttachmentBrokerPrivileged::GetSenderWithProcessId(base::ProcessId id) {
get_lock()->AssertAcquired();
auto it = std::find_if(endpoints_.begin(), endpoints_.end(),