OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 // A NetworkManager implementation which handles the case where local address | |
6 // enumeration is not requested and just returns empty network lists. This class | |
7 // is not thread safe and should only be used by WebRTC's worker thread. | |
8 | |
9 #ifndef CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ | |
10 #define CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ | |
11 | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "base/single_thread_task_runner.h" | |
14 #include "base/time/time.h" | |
15 #include "content/common/content_export.h" | |
16 #include "third_party/webrtc/base/network.h" | |
17 #include "third_party/webrtc/base/sigslot.h" | |
18 #include "url/gurl.h" | |
19 | |
20 namespace rtc { | |
21 class NetworkManager; | |
22 } // namespace rtc | |
23 | |
24 namespace content { | |
25 | |
26 class EmptyNetworkManager : public rtc::NetworkManagerBase, | |
27 public base::SupportsWeakPtr<EmptyNetworkManager>, | |
Sergey Ulanov
2015/09/21 22:12:58
It's preferrable to use WeakPtrFactory instead of
guoweis_left_chromium
2015/09/22 17:56:56
Done.
| |
28 public sigslot::has_slots<> { | |
Sergey Ulanov
2015/09/21 22:12:58
Don't need has_slots<>
guoweis_left_chromium
2015/09/22 17:56:56
Done.
| |
29 public: | |
30 // This class is created by WebRTC's signaling thread but used by WebRTC's | |
31 // worker thread |task_runner|. | |
32 CONTENT_EXPORT EmptyNetworkManager( | |
Sergey Ulanov
2015/09/21 22:12:58
Mark the whole class as CONTENT_EXPORT?
guoweis_left_chromium
2015/09/22 17:56:56
Done.
| |
33 const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); | |
34 | |
35 CONTENT_EXPORT ~EmptyNetworkManager() override; | |
36 | |
37 // rtc::NetworkManager: | |
38 void StartUpdating() override; | |
39 void StopUpdating() override; | |
40 void GetNetworks(NetworkList* networks) const override; | |
41 | |
42 private: | |
43 void FireEvent(bool first_time); | |
44 void SendNetworksChangedSignal(); | |
45 | |
46 const scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | |
47 | |
48 // Track how long it takes for client to receive SignalNetworksChanged. | |
49 base::TimeTicks start_updating_time_; | |
50 | |
51 DISALLOW_COPY_AND_ASSIGN(EmptyNetworkManager); | |
52 }; | |
53 | |
54 } // namespace content | |
55 | |
56 #endif // CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ | |
OLD | NEW |