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

Unified Diff: webrtc/base/fakenetwork.h

Issue 1358413003: Revert of TransportController refactoring. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Created 5 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « talk/session/media/channelmanager_unittest.cc ('k') | webrtc/p2p/base/dtlstransport.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/base/fakenetwork.h
diff --git a/webrtc/base/fakenetwork.h b/webrtc/base/fakenetwork.h
index 065d08d4c19c8f32f380a7ce8304fa6f599cff59..4b6bb68a96d9450bc82330534ae05cea0861d081 100644
--- a/webrtc/base/fakenetwork.h
+++ b/webrtc/base/fakenetwork.h
@@ -29,7 +29,12 @@
class FakeNetworkManager : public NetworkManagerBase,
public MessageHandler {
public:
- FakeNetworkManager() : thread_(Thread::Current()) {}
+ FakeNetworkManager()
+ : thread_(Thread::Current()),
+ next_index_(0),
+ started_(false),
+ sent_first_update_(false) {
+ }
typedef std::vector<SocketAddress> IfaceList;
@@ -53,18 +58,20 @@
}
virtual void StartUpdating() {
- ++start_count_;
- if (start_count_ == 1) {
- sent_first_update_ = false;
- thread_->Post(this);
- } else {
- if (sent_first_update_) {
+ if (started_) {
+ if (sent_first_update_)
SignalNetworksChanged();
- }
+ return;
}
+
+ started_ = true;
+ sent_first_update_ = false;
+ thread_->Post(this);
}
- virtual void StopUpdating() { --start_count_; }
+ virtual void StopUpdating() {
+ started_ = false;
+ }
// MessageHandler interface.
virtual void OnMessage(Message* msg) {
@@ -75,7 +82,7 @@
private:
void DoUpdateNetworks() {
- if (start_count_ == 0)
+ if (!started_)
return;
std::vector<Network*> networks;
for (IfaceList::iterator it = ifaces_.begin();
@@ -104,9 +111,9 @@
Thread* thread_;
IfaceList ifaces_;
- int next_index_ = 0;
- int start_count_ = 0;
- bool sent_first_update_ = false;
+ int next_index_;
+ bool started_;
+ bool sent_first_update_;
};
} // namespace rtc
« no previous file with comments | « talk/session/media/channelmanager_unittest.cc ('k') | webrtc/p2p/base/dtlstransport.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698