OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/base/network_config_watcher_mac.h" | 5 #include "net/base/network_config_watcher_mac.h" |
6 | 6 |
7 #include <SystemConfiguration/SCDynamicStoreKey.h> | 7 #include <SystemConfiguration/SCDynamicStoreKey.h> |
8 #include <SystemConfiguration/SCSchemaDefinitions.h> | 8 #include <SystemConfiguration/SCSchemaDefinitions.h> |
9 #include <algorithm> | 9 #include <algorithm> |
10 | 10 |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // initialize this, rather than just delaying it by a fixed time. | 71 // initialize this, rather than just delaying it by a fixed time. |
72 const int kInitializationDelayMS = 1000; | 72 const int kInitializationDelayMS = 1000; |
73 message_loop()->PostDelayedTask( | 73 message_loop()->PostDelayedTask( |
74 FROM_HERE, | 74 FROM_HERE, |
75 method_factory_.NewRunnableMethod( | 75 method_factory_.NewRunnableMethod( |
76 &NetworkConfigWatcherMacThread::InitNotifications), | 76 &NetworkConfigWatcherMacThread::InitNotifications), |
77 kInitializationDelayMS); | 77 kInitializationDelayMS); |
78 } | 78 } |
79 | 79 |
80 void NetworkConfigWatcherMacThread::CleanUp() { | 80 void NetworkConfigWatcherMacThread::CleanUp() { |
| 81 delegate_->CleanUp(); |
81 if (!run_loop_source_.get()) | 82 if (!run_loop_source_.get()) |
82 return; | 83 return; |
83 | 84 |
84 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), run_loop_source_.get(), | 85 CFRunLoopRemoveSource(CFRunLoopGetCurrent(), run_loop_source_.get(), |
85 kCFRunLoopCommonModes); | 86 kCFRunLoopCommonModes); |
86 run_loop_source_.reset(); | 87 run_loop_source_.reset(); |
87 } | 88 } |
88 | 89 |
89 void NetworkConfigWatcherMacThread::InitNotifications() { | 90 void NetworkConfigWatcherMacThread::InitNotifications() { |
90 // Add a run loop source for a dynamic store to the current run loop. | 91 // Add a run loop source for a dynamic store to the current run loop. |
(...skipping 22 matching lines...) Expand all Loading... |
113 // We create this notifier thread because the notification implementation | 114 // We create this notifier thread because the notification implementation |
114 // needs a thread with a CFRunLoop, and there's no guarantee that | 115 // needs a thread with a CFRunLoop, and there's no guarantee that |
115 // MessageLoop::current() meets that criterion. | 116 // MessageLoop::current() meets that criterion. |
116 base::Thread::Options thread_options(MessageLoop::TYPE_UI, 0); | 117 base::Thread::Options thread_options(MessageLoop::TYPE_UI, 0); |
117 notifier_thread_->StartWithOptions(thread_options); | 118 notifier_thread_->StartWithOptions(thread_options); |
118 } | 119 } |
119 | 120 |
120 NetworkConfigWatcherMac::~NetworkConfigWatcherMac() {} | 121 NetworkConfigWatcherMac::~NetworkConfigWatcherMac() {} |
121 | 122 |
122 } // namespace net | 123 } // namespace net |
OLD | NEW |