OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 5 #ifndef NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 6 #define NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <SystemConfiguration/SCDynamicStore.h> | 9 #include <SystemConfiguration/SCDynamicStore.h> |
10 #include <SystemConfiguration/SCNetworkReachability.h> | 10 #include <SystemConfiguration/SCNetworkReachability.h> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/mac/scoped_cftyperef.h" | 13 #include "base/mac/scoped_cftyperef.h" |
| 14 #include "base/synchronization/lock.h" |
14 #include "net/base/network_change_notifier.h" | 15 #include "net/base/network_change_notifier.h" |
15 #include "net/base/network_config_watcher_mac.h" | 16 #include "net/base/network_config_watcher_mac.h" |
16 | 17 |
17 namespace net { | 18 namespace net { |
18 | 19 |
19 class NetworkChangeNotifierMac: public NetworkChangeNotifier { | 20 class NetworkChangeNotifierMac: public NetworkChangeNotifier { |
20 public: | 21 public: |
21 NetworkChangeNotifierMac(); | 22 NetworkChangeNotifierMac(); |
22 virtual ~NetworkChangeNotifierMac(); | 23 virtual ~NetworkChangeNotifierMac(); |
23 | 24 |
(...skipping 27 matching lines...) Expand all Loading... |
51 | 52 |
52 static void ReachabilityCallback(SCNetworkReachabilityRef target, | 53 static void ReachabilityCallback(SCNetworkReachabilityRef target, |
53 SCNetworkConnectionFlags flags, | 54 SCNetworkConnectionFlags flags, |
54 void* notifier); | 55 void* notifier); |
55 | 56 |
56 Forwarder forwarder_; | 57 Forwarder forwarder_; |
57 const NetworkConfigWatcherMac config_watcher_; | 58 const NetworkConfigWatcherMac config_watcher_; |
58 base::mac::ScopedCFTypeRef<CFRunLoopRef> run_loop_; | 59 base::mac::ScopedCFTypeRef<CFRunLoopRef> run_loop_; |
59 base::mac::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_; | 60 base::mac::ScopedCFTypeRef<SCNetworkReachabilityRef> reachability_; |
60 bool network_reachable_; | 61 bool network_reachable_; |
| 62 mutable base::Lock network_reachable_lock_; |
61 | 63 |
62 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac); | 64 DISALLOW_COPY_AND_ASSIGN(NetworkChangeNotifierMac); |
63 }; | 65 }; |
64 | 66 |
65 } // namespace net | 67 } // namespace net |
66 | 68 |
67 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ | 69 #endif // NET_BASE_NETWORK_CHANGE_NOTIFIER_MAC_H_ |
OLD | NEW |