OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2015 The WebRTC project authors. All Rights Reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 return rtc::NETWORK_BIND_SUCCESS; | 261 return rtc::NETWORK_BIND_SUCCESS; |
262 } | 262 } |
263 if (rv == ENONET) { | 263 if (rv == ENONET) { |
264 return rtc::NETWORK_BIND_NETWORK_CHANGED; | 264 return rtc::NETWORK_BIND_NETWORK_CHANGED; |
265 } | 265 } |
266 return rtc::NETWORK_BIND_FAILURE; | 266 return rtc::NETWORK_BIND_FAILURE; |
267 } | 267 } |
268 | 268 |
269 void AndroidNetworkMonitor::OnNetworkConnected( | 269 void AndroidNetworkMonitor::OnNetworkConnected( |
270 const NetworkInformation& network_info) { | 270 const NetworkInformation& network_info) { |
271 worker_thread()->Invoke<void>(rtc::Bind( | 271 worker_thread()->Invoke<void>( |
272 &AndroidNetworkMonitor::OnNetworkConnected_w, this, network_info)); | 272 RTC_FROM_HERE, rtc::Bind(&AndroidNetworkMonitor::OnNetworkConnected_w, |
| 273 this, network_info)); |
273 // Fire SignalNetworksChanged to update the list of networks. | 274 // Fire SignalNetworksChanged to update the list of networks. |
274 OnNetworksChanged(); | 275 OnNetworksChanged(); |
275 } | 276 } |
276 | 277 |
277 void AndroidNetworkMonitor::OnNetworkConnected_w( | 278 void AndroidNetworkMonitor::OnNetworkConnected_w( |
278 const NetworkInformation& network_info) { | 279 const NetworkInformation& network_info) { |
279 LOG(LS_INFO) << "Network connected: " << network_info.ToString(); | 280 LOG(LS_INFO) << "Network connected: " << network_info.ToString(); |
280 adapter_type_by_name_[network_info.interface_name] = | 281 adapter_type_by_name_[network_info.interface_name] = |
281 AdapterTypeFromNetworkType(network_info.type); | 282 AdapterTypeFromNetworkType(network_info.type); |
282 network_info_by_handle_[network_info.handle] = network_info; | 283 network_info_by_handle_[network_info.handle] = network_info; |
283 for (const rtc::IPAddress& address : network_info.ip_addresses) { | 284 for (const rtc::IPAddress& address : network_info.ip_addresses) { |
284 network_handle_by_address_[address] = network_info.handle; | 285 network_handle_by_address_[address] = network_info.handle; |
285 } | 286 } |
286 } | 287 } |
287 | 288 |
288 void AndroidNetworkMonitor::OnNetworkDisconnected(NetworkHandle handle) { | 289 void AndroidNetworkMonitor::OnNetworkDisconnected(NetworkHandle handle) { |
289 LOG(LS_INFO) << "Network disconnected for handle " << handle; | 290 LOG(LS_INFO) << "Network disconnected for handle " << handle; |
290 worker_thread()->Invoke<void>( | 291 worker_thread()->Invoke<void>( |
| 292 RTC_FROM_HERE, |
291 rtc::Bind(&AndroidNetworkMonitor::OnNetworkDisconnected_w, this, handle)); | 293 rtc::Bind(&AndroidNetworkMonitor::OnNetworkDisconnected_w, this, handle)); |
292 } | 294 } |
293 | 295 |
294 void AndroidNetworkMonitor::OnNetworkDisconnected_w(NetworkHandle handle) { | 296 void AndroidNetworkMonitor::OnNetworkDisconnected_w(NetworkHandle handle) { |
295 auto iter = network_info_by_handle_.find(handle); | 297 auto iter = network_info_by_handle_.find(handle); |
296 if (iter != network_info_by_handle_.end()) { | 298 if (iter != network_info_by_handle_.end()) { |
297 for (const rtc::IPAddress& address : iter->second.ip_addresses) { | 299 for (const rtc::IPAddress& address : iter->second.ip_addresses) { |
298 network_handle_by_address_.erase(address); | 300 network_handle_by_address_.erase(address); |
299 } | 301 } |
300 network_info_by_handle_.erase(iter); | 302 network_info_by_handle_.erase(iter); |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
365 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)( | 367 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)( |
366 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor, | 368 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor, |
367 jint network_handle) { | 369 jint network_handle) { |
368 AndroidNetworkMonitor* network_monitor = | 370 AndroidNetworkMonitor* network_monitor = |
369 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor); | 371 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor); |
370 network_monitor->OnNetworkDisconnected( | 372 network_monitor->OnNetworkDisconnected( |
371 static_cast<NetworkHandle>(network_handle)); | 373 static_cast<NetworkHandle>(network_handle)); |
372 } | 374 } |
373 | 375 |
374 } // namespace webrtc_jni | 376 } // namespace webrtc_jni |
OLD | NEW |