Chromium Code Reviews| Index: chromecast/net/network_change_notifier_factory_cast.cc |
| diff --git a/chromecast/net/network_change_notifier_factory_cast.cc b/chromecast/net/network_change_notifier_factory_cast.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..4aa7566270349a3493654e3153a58b5317a6c866 |
| --- /dev/null |
| +++ b/chromecast/net/network_change_notifier_factory_cast.cc |
| @@ -0,0 +1,34 @@ |
| +// Copyright 2014 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. |
| + |
| +#include "chromecast/net/network_change_notifier_factory_cast.h" |
| + |
| +#include "chromecast/net/network_change_notifier_cast.h" |
| + |
| +namespace net { |
| + |
| +namespace { |
| + |
| +NetworkChangeNotifierCast* g_network_change_notifier_cast = NULL; |
| + |
| +} // namespace |
| + |
| +NetworkChangeNotifier* NetworkChangeNotifierFactoryCast::CreateInstance() { |
| + DCHECK(!g_network_change_notifier_cast); |
| + g_network_change_notifier_cast = new NetworkChangeNotifierCast(); |
| + return g_network_change_notifier_cast; |
| +} |
| + |
| +NetworkChangeNotifierFactoryCast::~NetworkChangeNotifierFactoryCast() { |
| + // CreateInstance() gives ownership, so assume its caller has deleted it. |
| + g_network_change_notifier_cast = NULL; |
| +} |
| + |
| +// static |
| +NetworkChangeNotifierCast* NetworkChangeNotifierFactoryCast::GetInstance() { |
| + DCHECK(g_network_change_notifier_cast); |
| + return g_network_change_notifier_cast; |
|
Ryan Sleevi
2014/07/01 21:13:55
Use a LazyInstance/LeakyLazyInstance here, not a g
lcwu1
2014/07/02 23:30:33
Done.
|
| +} |
| + |
| +} // namespace net |