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