Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // This implementation of NetworkChangeNotifier's offline state detection | 5 // This implementation of NetworkChangeNotifier's offline state detection |
| 6 // depends on D-Bus and NetworkManager, and is known to work on at least | 6 // depends on D-Bus and NetworkManager, and is known to work on at least |
| 7 // GNOME version 2.30. If D-Bus or NetworkManager are unavailable, this | 7 // GNOME version 2.30. If D-Bus or NetworkManager are unavailable, this |
| 8 // implementation will always behave as if it is online. | 8 // implementation will always behave as if it is online. |
| 9 | 9 |
| 10 #include "net/base/network_change_notifier_linux.h" | 10 #include "net/base/network_change_notifier_linux.h" |
| (...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 299 NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::Create() { | 299 NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::Create() { |
| 300 return new NetworkChangeNotifierLinux(NULL); | 300 return new NetworkChangeNotifierLinux(NULL); |
| 301 } | 301 } |
| 302 | 302 |
| 303 NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::CreateForTest( | 303 NetworkChangeNotifierLinux* NetworkChangeNotifierLinux::CreateForTest( |
| 304 dbus::Bus* bus) { | 304 dbus::Bus* bus) { |
| 305 return new NetworkChangeNotifierLinux(bus); | 305 return new NetworkChangeNotifierLinux(bus); |
| 306 } | 306 } |
| 307 | 307 |
| 308 NetworkChangeNotifierLinux::NetworkChangeNotifierLinux(dbus::Bus* bus) | 308 NetworkChangeNotifierLinux::NetworkChangeNotifierLinux(dbus::Bus* bus) |
| 309 : notifier_thread_(new Thread(bus)) { | 309 : NetworkChangeNotifier(1500, 500, 1500, 500), |
|
szym
2012/11/26 22:17:04
Just to be clear. I suggest this would be:
namesp
| |
| 310 notifier_thread_(new Thread(bus)) { | |
| 310 // We create this notifier thread because the notification implementation | 311 // We create this notifier thread because the notification implementation |
| 311 // needs a MessageLoopForIO, and there's no guarantee that | 312 // needs a MessageLoopForIO, and there's no guarantee that |
| 312 // MessageLoop::current() meets that criterion. | 313 // MessageLoop::current() meets that criterion. |
| 313 base::Thread::Options thread_options(MessageLoop::TYPE_IO, 0); | 314 base::Thread::Options thread_options(MessageLoop::TYPE_IO, 0); |
| 314 notifier_thread_->StartWithOptions(thread_options); | 315 notifier_thread_->StartWithOptions(thread_options); |
| 315 } | 316 } |
| 316 | 317 |
| 317 NetworkChangeNotifierLinux::~NetworkChangeNotifierLinux() { | 318 NetworkChangeNotifierLinux::~NetworkChangeNotifierLinux() { |
| 318 // Stopping from here allows us to sanity- check that the notifier | 319 // Stopping from here allows us to sanity- check that the notifier |
| 319 // thread shut down properly. | 320 // thread shut down properly. |
| 320 notifier_thread_->Stop(); | 321 notifier_thread_->Stop(); |
| 321 } | 322 } |
| 322 | 323 |
| 323 NetworkChangeNotifier::ConnectionType | 324 NetworkChangeNotifier::ConnectionType |
| 324 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { | 325 NetworkChangeNotifierLinux::GetCurrentConnectionType() const { |
| 325 return notifier_thread_->GetCurrentConnectionType(); | 326 return notifier_thread_->GetCurrentConnectionType(); |
| 326 } | 327 } |
| 327 | 328 |
| 328 const internal::AddressTrackerLinux* | 329 const internal::AddressTrackerLinux* |
| 329 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { | 330 NetworkChangeNotifierLinux::GetAddressTrackerInternal() const { |
| 330 return notifier_thread_->address_tracker(); | 331 return notifier_thread_->address_tracker(); |
| 331 } | 332 } |
| 332 | 333 |
| 333 } // namespace net | 334 } // namespace net |
| OLD | NEW |