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 is a small utility that watches for and logs network changes. | 5 // This is a small utility that watches for and logs network changes. |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/at_exit.h" | 9 #include "base/at_exit.h" |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 129 | 129 |
| 130 int main(int argc, char* argv[]) { | 130 int main(int argc, char* argv[]) { |
| 131 #if defined(OS_MACOSX) | 131 #if defined(OS_MACOSX) |
| 132 base::mac::ScopedNSAutoreleasePool pool; | 132 base::mac::ScopedNSAutoreleasePool pool; |
| 133 #endif | 133 #endif |
| 134 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | 134 #if (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) |
| 135 // Needed so ProxyConfigServiceLinux can use gconf. | 135 // Needed so ProxyConfigServiceLinux can use gconf. |
| 136 // Normally handled by BrowserMainLoop::InitializeToolkit(). | 136 // Normally handled by BrowserMainLoop::InitializeToolkit(). |
| 137 // From glib version 2.36 onwards, g_type_init is implicitly called and it is | 137 // From glib version 2.36 onwards, g_type_init is implicitly called and it is |
| 138 // deprecated. | 138 // deprecated. |
| 139 // TODO(yael) Simplify this once Ubuntu 10.04 is no longer supported. | 139 #if (GLIB_MAJOR_VERSION <= 2 && GLIB_MINOR_VERSION < 36) |
|
akalin
2013/10/04 17:24:49
Shouldn't this be something like:
(GLIB_MAJOR_VER
| |
| 140 #if defined(G_GNUC_BEGIN_IGNORE_DEPRECATIONS) && \ | 140 g_type_init(); |
| 141 defined(G_GNUC_END_IGNORE_DEPRECATIONS) | |
| 142 #define USE_GLIB_DEPRECATIONS_MACROS | |
| 143 #endif | 141 #endif |
| 144 | |
| 145 #if defined(USE_GLIB_DEPRECATIONS_MACROS) | |
| 146 G_GNUC_BEGIN_IGNORE_DEPRECATIONS | |
| 147 #endif | |
| 148 g_type_init(); | |
| 149 #if defined(USE_GLIB_DEPRECATIONS_MACROS) | |
| 150 G_GNUC_END_IGNORE_DEPRECATIONS | |
| 151 #endif | |
| 152 #undef USE_GLIB_DEPRECATIONS_MACROS | |
| 153 #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) | 142 #endif // (defined(OS_LINUX) || defined(OS_OPENBSD)) && !defined(OS_CHROMEOS) |
| 154 base::AtExitManager exit_manager; | 143 base::AtExitManager exit_manager; |
| 155 CommandLine::Init(argc, argv); | 144 CommandLine::Init(argc, argv); |
| 156 logging::LoggingSettings settings; | 145 logging::LoggingSettings settings; |
| 157 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; | 146 settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG; |
| 158 logging::InitLogging(settings); | 147 logging::InitLogging(settings); |
| 159 | 148 |
| 160 // Just make the main message loop the network loop. | 149 // Just make the main message loop the network loop. |
| 161 base::MessageLoopForIO network_loop; | 150 base::MessageLoopForIO network_loop; |
| 162 | 151 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 199 proxy_config_service->RemoveObserver(&net_watcher); | 188 proxy_config_service->RemoveObserver(&net_watcher); |
| 200 | 189 |
| 201 // Uses |network_change_notifier|. | 190 // Uses |network_change_notifier|. |
| 202 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); | 191 net::NetworkChangeNotifier::RemoveDNSObserver(&net_watcher); |
| 203 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); | 192 net::NetworkChangeNotifier::RemoveConnectionTypeObserver(&net_watcher); |
| 204 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); | 193 net::NetworkChangeNotifier::RemoveIPAddressObserver(&net_watcher); |
| 205 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); | 194 net::NetworkChangeNotifier::RemoveNetworkChangeObserver(&net_watcher); |
| 206 | 195 |
| 207 return 0; | 196 return 0; |
| 208 } | 197 } |
| OLD | NEW |