Chromium Code Reviews| Index: content/renderer/p2p/empty_network_manager.h |
| diff --git a/content/renderer/p2p/empty_network_manager.h b/content/renderer/p2p/empty_network_manager.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..fcd3cf279311cb7bab41419108cdad9f48477791 |
| --- /dev/null |
| +++ b/content/renderer/p2p/empty_network_manager.h |
| @@ -0,0 +1,54 @@ |
| +// Copyright 2015 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +// A NetworkManager implementation which handles the case where local address |
|
Sergey Ulanov
2015/09/24 19:37:28
nit: It's better to put this comment just above th
guoweis_left_chromium
2015/09/24 23:06:00
Done.
|
| +// enumeration is not requested and just returns empty network lists. This class |
| +// is not thread safe and should only be used by WebRTC's worker thread. |
| + |
| +#ifndef CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ |
| +#define CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ |
| + |
| +#include "base/memory/weak_ptr.h" |
| +#include "base/threading/thread_checker.h" |
| +#include "base/time/time.h" |
|
Sergey Ulanov
2015/09/24 19:37:28
don't need this
guoweis_left_chromium
2015/09/24 23:06:00
Done.
|
| +#include "content/common/content_export.h" |
| +#include "third_party/webrtc/base/network.h" |
| +#include "third_party/webrtc/base/sigslot.h" |
|
Sergey Ulanov
2015/09/24 19:37:28
don't need this
guoweis_left_chromium
2015/09/24 23:06:00
Done.
|
| +#include "url/gurl.h" |
|
Sergey Ulanov
2015/09/24 19:37:28
don't need this
guoweis_left_chromium
2015/09/24 23:06:00
Done.
|
| + |
| +namespace rtc { |
| +class NetworkManager; |
|
Sergey Ulanov
2015/09/24 19:37:28
don't need this - network.h is included above.
guoweis_left_chromium
2015/09/24 23:06:00
Done.
|
| +} // namespace rtc |
| + |
| +namespace content { |
| + |
| +class CONTENT_EXPORT EmptyNetworkManager : public rtc::NetworkManagerBase { |
| + public: |
| + // This class is created by WebRTC's signaling thread but used by WebRTC's |
| + // worker thread |task_runner|. |
| + EmptyNetworkManager(); |
| + ~EmptyNetworkManager() override; |
| + |
| + // rtc::NetworkManager: |
| + void StartUpdating() override; |
| + void StopUpdating() override; |
| + void GetNetworks(NetworkList* networks) const override; |
| + |
| + private: |
| + void FireEvent(); |
| + void SendNetworksChangedSignal(); |
| + |
| + base::ThreadChecker thread_checker_; |
| + |
| + // Track whether StartUpdating() has been called before. |
| + bool updating_started_ = false; |
| + |
| + base::WeakPtrFactory<EmptyNetworkManager> weak_ptr_factory_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(EmptyNetworkManager); |
| +}; |
| + |
| +} // namespace content |
| + |
| +#endif // CONTENT_RENDERER_P2P_EMPTY_NETWORK_MANAGER_H_ |