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

Side by Side Diff: third_party/WebKit/Source/platform/mediastream/MediaStreamSource.cpp

Issue 2657443005: Migrate WTF::HashSet::add() to ::insert() [part 1 of N] (Closed)
Patch Set: Created 3 years, 10 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 /* 1 /*
2 * Copyright (C) 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2012 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * 7 *
8 * 1. Redistributions of source code must retain the above copyright 8 * 1. Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright 10 * 2. Redistributions in binary form must reproduce the above copyright
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 // Observers may dispatch events which create and add new Observers; 62 // Observers may dispatch events which create and add new Observers;
63 // take a snapshot so as to safely iterate. 63 // take a snapshot so as to safely iterate.
64 HeapVector<Member<Observer>> observers; 64 HeapVector<Member<Observer>> observers;
65 copyToVector(m_observers, observers); 65 copyToVector(m_observers, observers);
66 for (auto observer : observers) 66 for (auto observer : observers)
67 observer->sourceChangedState(); 67 observer->sourceChangedState();
68 } 68 }
69 } 69 }
70 70
71 void MediaStreamSource::addObserver(MediaStreamSource::Observer* observer) { 71 void MediaStreamSource::addObserver(MediaStreamSource::Observer* observer) {
72 m_observers.add(observer); 72 m_observers.insert(observer);
73 } 73 }
74 74
75 void MediaStreamSource::addAudioConsumer(AudioDestinationConsumer* consumer) { 75 void MediaStreamSource::addAudioConsumer(AudioDestinationConsumer* consumer) {
76 ASSERT(m_requiresConsumer); 76 ASSERT(m_requiresConsumer);
77 MutexLocker locker(m_audioConsumersLock); 77 MutexLocker locker(m_audioConsumersLock);
78 m_audioConsumers.add(consumer); 78 m_audioConsumers.insert(consumer);
79 } 79 }
80 80
81 bool MediaStreamSource::removeAudioConsumer( 81 bool MediaStreamSource::removeAudioConsumer(
82 AudioDestinationConsumer* consumer) { 82 AudioDestinationConsumer* consumer) {
83 ASSERT(m_requiresConsumer); 83 ASSERT(m_requiresConsumer);
84 MutexLocker locker(m_audioConsumersLock); 84 MutexLocker locker(m_audioConsumersLock);
85 HeapHashSet<Member<AudioDestinationConsumer>>::iterator it = 85 HeapHashSet<Member<AudioDestinationConsumer>>::iterator it =
86 m_audioConsumers.find(consumer); 86 m_audioConsumers.find(consumer);
87 if (it == m_audioConsumers.end()) 87 if (it == m_audioConsumers.end())
88 return false; 88 return false;
(...skipping 19 matching lines...) Expand all
108 it != m_audioConsumers.end(); ++it) 108 it != m_audioConsumers.end(); ++it)
109 (*it)->consumeAudio(bus, numberOfFrames); 109 (*it)->consumeAudio(bus, numberOfFrames);
110 } 110 }
111 111
112 DEFINE_TRACE(MediaStreamSource) { 112 DEFINE_TRACE(MediaStreamSource) {
113 visitor->trace(m_observers); 113 visitor->trace(m_observers);
114 visitor->trace(m_audioConsumers); 114 visitor->trace(m_audioConsumers);
115 } 115 }
116 116
117 } // namespace blink 117 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698