Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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 #include "chromecast/net/network_change_notifier_factory_cast.h" | |
| 6 | |
| 7 #include "chromecast/net/network_change_notifier_cast.h" | |
| 8 | |
| 9 namespace net { | |
| 10 | |
| 11 namespace { | |
| 12 | |
| 13 NetworkChangeNotifierCast* g_network_change_notifier_cast = NULL; | |
| 14 | |
| 15 } // namespace | |
| 16 | |
| 17 NetworkChangeNotifier* NetworkChangeNotifierFactoryCast::CreateInstance() { | |
| 18 DCHECK(!g_network_change_notifier_cast); | |
| 19 g_network_change_notifier_cast = new NetworkChangeNotifierCast(); | |
| 20 return g_network_change_notifier_cast; | |
| 21 } | |
| 22 | |
| 23 NetworkChangeNotifierFactoryCast::~NetworkChangeNotifierFactoryCast() { | |
| 24 // CreateInstance() gives ownership, so assume its caller has deleted it. | |
| 25 g_network_change_notifier_cast = NULL; | |
| 26 } | |
| 27 | |
| 28 // static | |
| 29 NetworkChangeNotifierCast* NetworkChangeNotifierFactoryCast::GetInstance() { | |
| 30 DCHECK(g_network_change_notifier_cast); | |
| 31 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.
| |
| 32 } | |
| 33 | |
| 34 } // namespace net | |
| OLD | NEW |