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

Side by Side Diff: ipc/attachment_broker.cc

Issue 1367013003: ipc: Change the timing of the construction of the attachment broker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
OLDNEW
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 namespace { 9 namespace {
10 IPC::AttachmentBroker* g_attachment_broker = nullptr; 10 IPC::AttachmentBroker* g_attachment_broker = nullptr;
11 } 11 }
12 12
13 namespace IPC { 13 namespace IPC {
14 14
15 // static 15 // static
16 void AttachmentBroker::SetGlobal(AttachmentBroker* broker) { 16 void AttachmentBroker::SetGlobal(AttachmentBroker* broker) {
17 // TODO(erikchen): There should be a CHECK here to make sure that 17 CHECK(!g_attachment_broker);
Tom Sepez 2015/09/25 15:37:34 check vs. DCHECK? your call. I'd expect a DCHECK.
erikchen 2015/09/25 19:27:04 I think this is important to check, even in offici
18 // |g_attachment_broker| is nullptr. Right now, this causes problems with
19 // --single_process and similar testing conditions. I'm temporarily removing
20 // this CHECK. http://crbug.com/534539.
21 g_attachment_broker = broker; 18 g_attachment_broker = broker;
22 } 19 }
23 20
24 // static 21 // static
25 AttachmentBroker* AttachmentBroker::GetGlobal() { 22 AttachmentBroker* AttachmentBroker::GetGlobal() {
26 return g_attachment_broker; 23 return g_attachment_broker;
27 } 24 }
28 25
29 AttachmentBroker::AttachmentBroker() {} 26 AttachmentBroker::AttachmentBroker() {}
30 AttachmentBroker::~AttachmentBroker() {} 27 AttachmentBroker::~AttachmentBroker() {}
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 void AttachmentBroker::NotifyObservers( 61 void AttachmentBroker::NotifyObservers(
65 const BrokerableAttachment::AttachmentId& id) { 62 const BrokerableAttachment::AttachmentId& id) {
66 // Make a copy of observers_ to avoid mutations during iteration. 63 // Make a copy of observers_ to avoid mutations during iteration.
67 std::vector<Observer*> observers = observers_; 64 std::vector<Observer*> observers = observers_;
68 for (Observer* observer : observers) { 65 for (Observer* observer : observers) {
69 observer->ReceivedBrokerableAttachmentWithId(id); 66 observer->ReceivedBrokerableAttachmentWithId(id);
70 } 67 }
71 } 68 }
72 69
73 } // namespace IPC 70 } // namespace IPC
OLDNEW
« content/common/child_process_host_impl.cc ('K') | « content/common/child_process_host_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698