OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/attachment_broker.h" | 5 #include "ipc/attachment_broker.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/location.h" | 10 #include "base/location.h" |
11 #include "base/sequenced_task_runner.h" | 11 #include "base/sequenced_task_runner.h" |
12 | 12 |
13 namespace { | 13 namespace { |
14 IPC::AttachmentBroker* g_attachment_broker = nullptr; | 14 IPC::AttachmentBroker* g_attachment_broker = nullptr; |
15 } | 15 } |
16 | 16 |
17 namespace IPC { | 17 namespace IPC { |
18 | 18 |
19 // static | 19 // static |
20 void AttachmentBroker::SetGlobal(AttachmentBroker* broker) { | 20 void AttachmentBroker::SetGlobal(AttachmentBroker* broker) { |
21 CHECK(!g_attachment_broker || !broker) | |
22 << "Global attachment broker address: " << broker | |
23 << ". New attachment broker address: " << broker; | |
24 g_attachment_broker = broker; | 21 g_attachment_broker = broker; |
25 } | 22 } |
26 | 23 |
27 // static | 24 // static |
28 AttachmentBroker* AttachmentBroker::GetGlobal() { | 25 AttachmentBroker* AttachmentBroker::GetGlobal() { |
29 return g_attachment_broker; | 26 return g_attachment_broker; |
30 } | 27 } |
31 | 28 |
32 AttachmentBroker::AttachmentBroker() : last_unique_id_(0) {} | 29 AttachmentBroker::AttachmentBroker() : last_unique_id_(0) {} |
33 AttachmentBroker::~AttachmentBroker() {} | 30 AttachmentBroker::~AttachmentBroker() {} |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 } | 72 } |
76 | 73 |
77 void AttachmentBroker::RegisterCommunicationChannel(Endpoint* endpoint) { | 74 void AttachmentBroker::RegisterCommunicationChannel(Endpoint* endpoint) { |
78 NOTREACHED(); | 75 NOTREACHED(); |
79 } | 76 } |
80 | 77 |
81 void AttachmentBroker::DeregisterCommunicationChannel(Endpoint* endpoint) { | 78 void AttachmentBroker::DeregisterCommunicationChannel(Endpoint* endpoint) { |
82 NOTREACHED(); | 79 NOTREACHED(); |
83 } | 80 } |
84 | 81 |
| 82 void AttachmentBroker::RegisterBrokerCommunicationChannel(Endpoint* endpoint) { |
| 83 NOTREACHED(); |
| 84 } |
| 85 |
| 86 void AttachmentBroker::DeregisterBrokerCommunicationChannel( |
| 87 Endpoint* endpoint) { |
| 88 NOTREACHED(); |
| 89 } |
| 90 |
| 91 bool AttachmentBroker::IsPrivilegedBroker() { |
| 92 NOTREACHED(); |
| 93 return false; |
| 94 } |
| 95 |
85 void AttachmentBroker::HandleReceivedAttachment( | 96 void AttachmentBroker::HandleReceivedAttachment( |
86 const scoped_refptr<BrokerableAttachment>& attachment) { | 97 const scoped_refptr<BrokerableAttachment>& attachment) { |
87 { | 98 { |
88 base::AutoLock auto_lock(*get_lock()); | 99 base::AutoLock auto_lock(*get_lock()); |
89 attachments_.push_back(attachment); | 100 attachments_.push_back(attachment); |
90 } | 101 } |
91 NotifyObservers(attachment->GetIdentifier()); | 102 NotifyObservers(attachment->GetIdentifier()); |
92 } | 103 } |
93 | 104 |
94 void AttachmentBroker::NotifyObservers( | 105 void AttachmentBroker::NotifyObservers( |
(...skipping 28 matching lines...) Expand all Loading... |
123 observer = it->observer; | 134 observer = it->observer; |
124 } | 135 } |
125 | 136 |
126 observer->ReceivedBrokerableAttachmentWithId(id); | 137 observer->ReceivedBrokerableAttachmentWithId(id); |
127 } | 138 } |
128 | 139 |
129 AttachmentBroker::ObserverInfo::ObserverInfo() {} | 140 AttachmentBroker::ObserverInfo::ObserverInfo() {} |
130 AttachmentBroker::ObserverInfo::~ObserverInfo() {} | 141 AttachmentBroker::ObserverInfo::~ObserverInfo() {} |
131 | 142 |
132 } // namespace IPC | 143 } // namespace IPC |
OLD | NEW |