Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ipc/attachment_broker.cc

Issue 1206093002: Update ChannelReader to use AttachmentBroker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@attachment_broker3_listener
Patch Set: Comments from tsepez. Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ipc/attachment_broker.h ('k') | ipc/attachment_broker_win.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "ipc/attachment_broker.h"
6
7 #include <algorithm>
8
9 namespace IPC {
10
11 AttachmentBroker::AttachmentBroker() {
12 }
13 AttachmentBroker::~AttachmentBroker() {
14 }
15
16 void AttachmentBroker::AddObserver(AttachmentBroker::Observer* observer) {
17 auto it = std::find(observers_.begin(), observers_.end(), observer);
18 if (it == observers_.end())
19 observers_.push_back(observer);
20 }
21
22 void AttachmentBroker::RemoveObserver(AttachmentBroker::Observer* observer) {
23 auto it = std::find(observers_.begin(), observers_.end(), observer);
24 if (it != observers_.end())
25 observers_.erase(it);
26 }
27
28 void AttachmentBroker::NotifyObservers(
29 const BrokerableAttachment::AttachmentId& id) {
30 // Make a copy of observers_ to avoid mutations during iteration.
31 std::vector<Observer*> observers = observers_;
32 for (Observer* observer : observers) {
33 observer->ReceivedBrokerableAttachmentWithId(id);
34 }
35 }
36
37 } // namespace IPC
OLDNEW
« no previous file with comments | « ipc/attachment_broker.h ('k') | ipc/attachment_broker_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698