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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 LOG(LS_INFO) << "Network connected: " << network_info.ToString(); | 271 LOG(LS_INFO) << "Network connected: " << network_info.ToString(); |
272 worker_thread()->Invoke<void>(rtc::Bind( | 272 worker_thread()->Invoke<void>( |
273 &AndroidNetworkMonitor::OnNetworkConnected_w, this, network_info)); | 273 FROM_HERE, rtc::Bind(&AndroidNetworkMonitor::OnNetworkConnected_w, this, |
| 274 network_info)); |
274 } | 275 } |
275 | 276 |
276 void AndroidNetworkMonitor::OnNetworkConnected_w( | 277 void AndroidNetworkMonitor::OnNetworkConnected_w( |
277 const NetworkInformation& network_info) { | 278 const NetworkInformation& network_info) { |
278 adapter_type_by_name_[network_info.interface_name] = | 279 adapter_type_by_name_[network_info.interface_name] = |
279 AdapterTypeFromNetworkType(network_info.type); | 280 AdapterTypeFromNetworkType(network_info.type); |
280 network_info_by_handle_[network_info.handle] = network_info; | 281 network_info_by_handle_[network_info.handle] = network_info; |
281 for (const rtc::IPAddress& address : network_info.ip_addresses) { | 282 for (const rtc::IPAddress& address : network_info.ip_addresses) { |
282 network_handle_by_address_[address] = network_info.handle; | 283 network_handle_by_address_[address] = network_info.handle; |
283 } | 284 } |
284 } | 285 } |
285 | 286 |
286 void AndroidNetworkMonitor::OnNetworkDisconnected(NetworkHandle handle) { | 287 void AndroidNetworkMonitor::OnNetworkDisconnected(NetworkHandle handle) { |
287 LOG(LS_INFO) << "Network disconnected for handle " << handle; | 288 LOG(LS_INFO) << "Network disconnected for handle " << handle; |
288 worker_thread()->Invoke<void>( | 289 worker_thread()->Invoke<void>( |
| 290 FROM_HERE, |
289 rtc::Bind(&AndroidNetworkMonitor::OnNetworkDisconnected_w, this, handle)); | 291 rtc::Bind(&AndroidNetworkMonitor::OnNetworkDisconnected_w, this, handle)); |
290 } | 292 } |
291 | 293 |
292 void AndroidNetworkMonitor::OnNetworkDisconnected_w(NetworkHandle handle) { | 294 void AndroidNetworkMonitor::OnNetworkDisconnected_w(NetworkHandle handle) { |
293 auto iter = network_info_by_handle_.find(handle); | 295 auto iter = network_info_by_handle_.find(handle); |
294 if (iter != network_info_by_handle_.end()) { | 296 if (iter != network_info_by_handle_.end()) { |
295 for (const rtc::IPAddress& address : iter->second.ip_addresses) { | 297 for (const rtc::IPAddress& address : iter->second.ip_addresses) { |
296 network_handle_by_address_.erase(address); | 298 network_handle_by_address_.erase(address); |
297 } | 299 } |
298 network_info_by_handle_.erase(iter); | 300 network_info_by_handle_.erase(iter); |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)( | 361 JOW(void, NetworkMonitor_nativeNotifyOfNetworkDisconnect)( |
360 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor, | 362 JNIEnv* jni, jobject j_monitor, jlong j_native_monitor, |
361 jint network_handle) { | 363 jint network_handle) { |
362 AndroidNetworkMonitor* network_monitor = | 364 AndroidNetworkMonitor* network_monitor = |
363 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor); | 365 reinterpret_cast<AndroidNetworkMonitor*>(j_native_monitor); |
364 network_monitor->OnNetworkDisconnected( | 366 network_monitor->OnNetworkDisconnected( |
365 static_cast<NetworkHandle>(network_handle)); | 367 static_cast<NetworkHandle>(network_handle)); |
366 } | 368 } |
367 | 369 |
368 } // namespace webrtc_jni | 370 } // namespace webrtc_jni |
OLD | NEW |