| 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 return *this; | 42 return *this; |
| 43 } | 43 } |
| 44 | 44 |
| 45 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) | 45 ChannelOwner::ChannelRef::ChannelRef(class Channel* channel) |
| 46 : channel(channel), ref_count(1) {} | 46 : channel(channel), ref_count(1) {} |
| 47 | 47 |
| 48 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) | 48 ChannelManager::ChannelManager(uint32_t instance_id, const Config& config) |
| 49 : instance_id_(instance_id), | 49 : instance_id_(instance_id), |
| 50 last_channel_id_(-1), | 50 last_channel_id_(-1), |
| 51 lock_(CriticalSectionWrapper::CreateCriticalSection()), | 51 lock_(CriticalSectionWrapper::CreateCriticalSection()), |
| 52 config_(config) {} | 52 config_(config), |
| 53 event_log_(RtcEventLog::Create()) { |
| 54 } |
| 53 | 55 |
| 54 ChannelOwner ChannelManager::CreateChannel() { | 56 ChannelOwner ChannelManager::CreateChannel() { |
| 55 return CreateChannelInternal(config_); | 57 return CreateChannelInternal(config_); |
| 56 } | 58 } |
| 57 | 59 |
| 58 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { | 60 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { |
| 59 return CreateChannelInternal(external_config); | 61 return CreateChannelInternal(external_config); |
| 60 } | 62 } |
| 61 | 63 |
| 62 ChannelOwner ChannelManager::CreateChannelInternal(const Config& config) { | 64 ChannelOwner ChannelManager::CreateChannelInternal(const Config& config) { |
| 63 Channel* channel; | 65 Channel* channel; |
| 64 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config); | 66 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, |
| 67 event_log_.get(), config); |
| 65 ChannelOwner channel_owner(channel); | 68 ChannelOwner channel_owner(channel); |
| 66 | 69 |
| 67 CriticalSectionScoped crit(lock_.get()); | 70 CriticalSectionScoped crit(lock_.get()); |
| 68 | 71 |
| 69 channels_.push_back(channel_owner); | 72 channels_.push_back(channel_owner); |
| 70 | 73 |
| 71 return channel_owner; | 74 return channel_owner; |
| 72 } | 75 } |
| 73 | 76 |
| 74 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { | 77 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 references = channels_; | 124 references = channels_; |
| 122 channels_.clear(); | 125 channels_.clear(); |
| 123 } | 126 } |
| 124 } | 127 } |
| 125 | 128 |
| 126 size_t ChannelManager::NumOfChannels() const { | 129 size_t ChannelManager::NumOfChannels() const { |
| 127 CriticalSectionScoped crit(lock_.get()); | 130 CriticalSectionScoped crit(lock_.get()); |
| 128 return channels_.size(); | 131 return channels_.size(); |
| 129 } | 132 } |
| 130 | 133 |
| 134 RtcEventLog* ChannelManager::GetEventLog() const { |
| 135 return event_log_.get(); |
| 136 } |
| 137 |
| 131 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) | 138 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) |
| 132 : iterator_pos_(0) { | 139 : iterator_pos_(0) { |
| 133 channel_manager->GetAllChannels(&channels_); | 140 channel_manager->GetAllChannels(&channels_); |
| 134 } | 141 } |
| 135 | 142 |
| 136 Channel* ChannelManager::Iterator::GetChannel() { | 143 Channel* ChannelManager::Iterator::GetChannel() { |
| 137 if (iterator_pos_ < channels_.size()) | 144 if (iterator_pos_ < channels_.size()) |
| 138 return channels_[iterator_pos_].channel(); | 145 return channels_[iterator_pos_].channel(); |
| 139 return NULL; | 146 return NULL; |
| 140 } | 147 } |
| 141 | 148 |
| 142 bool ChannelManager::Iterator::IsValid() { | 149 bool ChannelManager::Iterator::IsValid() { |
| 143 return iterator_pos_ < channels_.size(); | 150 return iterator_pos_ < channels_.size(); |
| 144 } | 151 } |
| 145 | 152 |
| 146 void ChannelManager::Iterator::Increment() { | 153 void ChannelManager::Iterator::Increment() { |
| 147 ++iterator_pos_; | 154 ++iterator_pos_; |
| 148 } | 155 } |
| 149 | 156 |
| 150 } // namespace voe | 157 } // namespace voe |
| 151 } // namespace webrtc | 158 } // namespace webrtc |
| OLD | NEW |