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

Side by Side Diff: webrtc/voice_engine/channel_manager.cc

Issue 1748403002: Move RtcEventLog object from inside VoiceEngine to Call. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Processed review comments and rebased. Created 4 years, 9 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) 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 28 matching lines...) Expand all
39 channel_ref_ = other.channel_ref_; 39 channel_ref_ = other.channel_ref_;
40 ++channel_ref_->ref_count; 40 ++channel_ref_->ref_count;
41 41
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), last_channel_id_(-1), config_(config) {}
50 last_channel_id_(-1),
51 config_(config),
52 event_log_(RtcEventLog::Create()) {}
53 50
54 ChannelOwner ChannelManager::CreateChannel() { 51 ChannelOwner ChannelManager::CreateChannel() {
55 return CreateChannelInternal(config_); 52 return CreateChannelInternal(config_);
56 } 53 }
57 54
58 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { 55 ChannelOwner ChannelManager::CreateChannel(const Config& external_config) {
59 return CreateChannelInternal(external_config); 56 return CreateChannelInternal(external_config);
60 } 57 }
61 58
62 ChannelOwner ChannelManager::CreateChannelInternal(const Config& config) { 59 ChannelOwner ChannelManager::CreateChannelInternal(const Config& config) {
63 Channel* channel; 60 Channel* channel;
64 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, 61 Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, config);
65 event_log_.get(), config);
66 ChannelOwner channel_owner(channel); 62 ChannelOwner channel_owner(channel);
67 63
68 rtc::CritScope crit(&lock_); 64 rtc::CritScope crit(&lock_);
69 65
70 channels_.push_back(channel_owner); 66 channels_.push_back(channel_owner);
71 67
72 return channel_owner; 68 return channel_owner;
73 } 69 }
74 70
75 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) { 71 ChannelOwner ChannelManager::GetChannel(int32_t channel_id) {
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
122 references = channels_; 118 references = channels_;
123 channels_.clear(); 119 channels_.clear();
124 } 120 }
125 } 121 }
126 122
127 size_t ChannelManager::NumOfChannels() const { 123 size_t ChannelManager::NumOfChannels() const {
128 rtc::CritScope crit(&lock_); 124 rtc::CritScope crit(&lock_);
129 return channels_.size(); 125 return channels_.size();
130 } 126 }
131 127
132 RtcEventLog* ChannelManager::GetEventLog() const {
133 return event_log_.get();
134 }
135
136 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager) 128 ChannelManager::Iterator::Iterator(ChannelManager* channel_manager)
137 : iterator_pos_(0) { 129 : iterator_pos_(0) {
138 channel_manager->GetAllChannels(&channels_); 130 channel_manager->GetAllChannels(&channels_);
139 } 131 }
140 132
141 Channel* ChannelManager::Iterator::GetChannel() { 133 Channel* ChannelManager::Iterator::GetChannel() {
142 if (iterator_pos_ < channels_.size()) 134 if (iterator_pos_ < channels_.size())
143 return channels_[iterator_pos_].channel(); 135 return channels_[iterator_pos_].channel();
144 return NULL; 136 return NULL;
145 } 137 }
146 138
147 bool ChannelManager::Iterator::IsValid() { 139 bool ChannelManager::Iterator::IsValid() {
148 return iterator_pos_ < channels_.size(); 140 return iterator_pos_ < channels_.size();
149 } 141 }
150 142
151 void ChannelManager::Iterator::Increment() { 143 void ChannelManager::Iterator::Increment() {
152 ++iterator_pos_; 144 ++iterator_pos_;
153 } 145 }
154 146
155 } // namespace voe 147 } // namespace voe
156 } // namespace webrtc 148 } // namespace webrtc
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698