| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 package org.chromium.net; | 5 package org.chromium.net; |
| 6 | 6 |
| 7 import android.content.Context; | 7 import android.content.Context; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.os.Looper; | 9 import android.os.Looper; |
| 10 | 10 |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // Registers to always receive network notifications. Note | 55 // Registers to always receive network notifications. Note |
| 56 // that this call is fine for Cronet because Cronet | 56 // that this call is fine for Cronet because Cronet |
| 57 // embedders do not have API access to create network change | 57 // embedders do not have API access to create network change |
| 58 // observers. Existing observers in the net stack do not | 58 // observers. Existing observers in the net stack do not |
| 59 // perform expensive work. | 59 // perform expensive work. |
| 60 NetworkChangeNotifier.registerToReceiveNotificationsAlways(); | 60 NetworkChangeNotifier.registerToReceiveNotificationsAlways(); |
| 61 // registerToReceiveNotificationsAlways() is called before the native | 61 // registerToReceiveNotificationsAlways() is called before the native |
| 62 // NetworkChangeNotifierAndroid is created, so as to avoid receiving | 62 // NetworkChangeNotifierAndroid is created, so as to avoid receiving |
| 63 // the undesired initial network change observer notification, which | 63 // the undesired initial network change observer notification, which |
| 64 // will cause active requests to fail with ERR_NETWORK_CHANGED. | 64 // will cause active requests to fail with ERR_NETWORK_CHANGED. |
| 65 nativeCronetInitOnMainThread(context); | 65 nativeCronetInitOnMainThread(context.getApplicationContext()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 // Native methods are implemented in cronet_loader.cc. | 68 // Native methods are implemented in cronet_loader.cc. |
| 69 private static native void nativeCronetInitOnMainThread(Context context); | 69 private static native void nativeCronetInitOnMainThread(Context appContext); |
| 70 } | 70 } |
| OLD | NEW |