| OLD | NEW | 
|---|
| 1 /* | 1 /* | 
| 2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 2  *  Copyright (c) 2011 The WebRTC project authors. All Rights Reserved. | 
| 3  * | 3  * | 
| 4  *  Use of this source code is governed by a BSD-style license | 4  *  Use of this source code is governed by a BSD-style license | 
| 5  *  that can be found in the LICENSE file in the root of the source | 5  *  that can be found in the LICENSE file in the root of the source | 
| 6  *  tree. An additional intellectual property rights grant can be found | 6  *  tree. An additional intellectual property rights grant can be found | 
| 7  *  in the file PATENTS.  All contributing project authors may | 7  *  in the file PATENTS.  All contributing project authors may | 
| 8  *  be found in the AUTHORS file in the root of the source tree. | 8  *  be found in the AUTHORS file in the root of the source tree. | 
| 9  */ | 9  */ | 
| 10 | 10 | 
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 60   return channel_owner; | 60   return channel_owner; | 
| 61 } | 61 } | 
| 62 | 62 | 
| 63 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 63 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 
| 64   rtc::CritScope crit(&lock_); | 64   rtc::CritScope crit(&lock_); | 
| 65 | 65 | 
| 66   for (size_t i = 0; i < channels_.size(); ++i) { | 66   for (size_t i = 0; i < channels_.size(); ++i) { | 
| 67     if (channels_[i].channel()->ChannelId() == channel_id) | 67     if (channels_[i].channel()->ChannelId() == channel_id) | 
| 68       return channels_[i]; | 68       return channels_[i]; | 
| 69   } | 69   } | 
| 70   return ChannelOwner(NULL); | 70   return ChannelOwner(nullptr); | 
| 71 } | 71 } | 
| 72 | 72 | 
| 73 void ChannelManager::GetAllChannels(std::vector<ChannelOwner>* channels) { | 73 void ChannelManager::GetAllChannels(std::vector<ChannelOwner>* channels) { | 
| 74   rtc::CritScope crit(&lock_); | 74   rtc::CritScope crit(&lock_); | 
| 75 | 75 | 
| 76   *channels = channels_; | 76   *channels = channels_; | 
| 77 } | 77 } | 
| 78 | 78 | 
| 79 void ChannelManager::DestroyChannel(int32_t channel_id) { | 79 void ChannelManager::DestroyChannel(int32_t channel_id) { | 
| 80   assert(channel_id >= 0); | 80   assert(channel_id >= 0); | 
| 81   // Holds a reference to a channel, this is used so that we never delete | 81   // Holds a reference to a channel, this is used so that we never delete | 
| 82   // Channels while holding a lock, but rather when the method returns. | 82   // Channels while holding a lock, but rather when the method returns. | 
| 83   ChannelOwner reference(NULL); | 83   ChannelOwner reference(nullptr); | 
| 84   { | 84   { | 
| 85     rtc::CritScope crit(&lock_); | 85     rtc::CritScope crit(&lock_); | 
| 86     std::vector<ChannelOwner>::iterator to_delete = channels_.end(); | 86     std::vector<ChannelOwner>::iterator to_delete = channels_.end(); | 
| 87     for (auto it = channels_.begin(); it != channels_.end(); ++it) { | 87     for (auto it = channels_.begin(); it != channels_.end(); ++it) { | 
| 88       Channel* channel = it->channel(); | 88       Channel* channel = it->channel(); | 
| 89       // For channels associated with the channel to be deleted, disassociate | 89       // For channels associated with the channel to be deleted, disassociate | 
| 90       // with that channel. | 90       // with that channel. | 
| 91       channel->DisassociateSendChannel(channel_id); | 91       channel->DisassociateSendChannel(channel_id); | 
| 92 | 92 | 
| 93       if (channel->ChannelId() == channel_id) { | 93       if (channel->ChannelId() == channel_id) { | 
| (...skipping 24 matching lines...) Expand all  Loading... | 
| 118 } | 118 } | 
| 119 | 119 | 
| 120 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) | 120 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) | 
| 121     : iterator_pos_(0) { | 121     : iterator_pos_(0) { | 
| 122   channel_manager->GetAllChannels(&channels_); | 122   channel_manager->GetAllChannels(&channels_); | 
| 123 } | 123 } | 
| 124 | 124 | 
| 125 Channel* ChannelManager::Iterator::GetChannel() { | 125 Channel* ChannelManager::Iterator::GetChannel() { | 
| 126   if (iterator_pos_ < channels_.size()) | 126   if (iterator_pos_ < channels_.size()) | 
| 127     return channels_[iterator_pos_].channel(); | 127     return channels_[iterator_pos_].channel(); | 
| 128   return NULL; | 128   return nullptr; | 
| 129 } | 129 } | 
| 130 | 130 | 
| 131 bool ChannelManager::Iterator::IsValid() { | 131 bool ChannelManager::Iterator::IsValid() { | 
| 132   return iterator_pos_ < channels_.size(); | 132   return iterator_pos_ < channels_.size(); | 
| 133 } | 133 } | 
| 134 | 134 | 
| 135 void ChannelManager::Iterator::Increment() { | 135 void ChannelManager::Iterator::Increment() { | 
| 136   ++iterator_pos_; | 136   ++iterator_pos_; | 
| 137 } | 137 } | 
| 138 | 138 | 
| 139 }  // namespace voe | 139 }  // namespace voe | 
| 140 }  // namespace webrtc | 140 }  // namespace webrtc | 
| OLD | NEW | 
|---|