Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(123)

Issue 11628008: Provide NetworkChangeNotifierAndroid with the actual initial connection type. (Closed)

Created:
8 years ago by Philippe
Modified:
7 years, 11 months ago
Reviewers:
gone, Ryan Sleevi, digit1
CC:
chromium-reviews, cbentzel+watch_chromium.org, darin-cc_chromium.org, ppi
Visibility:
Public.

Description

Provide NetworkChangeNotifierAndroid with the actual initial connection type. The Android NetworkChangeNotifier is initialized with connection_type = CONNECTION_UNKNOWN. This means that the result returned by NetworkChangeNotifier::IsOffline() is inaccurate until the first network change happens. This can happen for the whole initialization path if the user starts Chrome after he explicitly disabled WiFi and 3G. This CL updates NetworkChangeNotifier.java to support multiple native observers. This can happen in case NetworkChangeNotifierDelegateAndroid is instantiated multiple times (e.g. when multiple factories are instantiated). Still on the Java side, NetworkChangeNotifier.java was also changed to fetch the actual connection type as soon as the auto-detector (interacting with the Android platform) is enabled. On the native side, NetworkChangeNotifierDelegateAndroid now fetches at construction time the current connection type from the Java side singleton through a direct JNI function call (possible since the delegate is constructed on the JNI thread). NetworkChangeNotifierAndroid::GetCurrentConnectionType() is now a simple wrapper around the delegate's GetCurrentConnectionType() method (which is thread-safe). BUG=166883 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=175138

Patch Set 1 #

Patch Set 2 : Make NCNA fetch the connection type through NCNDA #

Total comments: 1

Patch Set 3 : Try another approach #

Total comments: 3

Patch Set 4 : Final approach based on patch set #2 #

Total comments: 15

Patch Set 5 : Address Dan's comments #

Total comments: 8

Patch Set 6 : Address Ryan's comments #

Total comments: 8

Patch Set 7 : Address Ryan's comments + fix Java comment #

Unified diffs Side-by-side diffs Delta from patch set Stats (+233 lines, -179 lines) Patch
M build/android/findbugs_filter/findbugs_known_bugs.txt View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M net/android/java/src/org/chromium/net/NetworkChangeNotifier.java View 1 2 3 4 5 6 7 chunks +59 lines, -48 lines 0 comments Download
M net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java View 1 2 3 4 4 chunks +20 lines, -16 lines 0 comments Download
M net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java View 1 2 3 4 3 chunks +6 lines, -6 lines 0 comments Download
M net/android/network_change_notifier_android.h View 1 2 3 4 5 3 chunks +1 line, -7 lines 0 comments Download
M net/android/network_change_notifier_android.cc View 1 2 3 4 5 3 chunks +2 lines, -12 lines 0 comments Download
M net/android/network_change_notifier_android_unittest.cc View 1 2 3 4 5 6 7 chunks +87 lines, -58 lines 0 comments Download
M net/android/network_change_notifier_delegate_android.h View 1 2 3 4 5 6 4 chunks +12 lines, -10 lines 0 comments Download
M net/android/network_change_notifier_delegate_android.cc View 1 2 3 4 5 4 chunks +45 lines, -21 lines 0 comments Download

Messages

Total messages: 22 (0 generated)
Philippe
8 years ago (2012-12-18 14:41:24 UTC) #1
Philippe
On 2012/12/18 14:41:24, Philippe wrote: Please ignore this CL for now. I will upload a ...
8 years ago (2012-12-18 14:57:56 UTC) #2
Philippe
+ Ryan I have uploaded a new patch set which should be ready for review. ...
8 years ago (2012-12-18 15:38:18 UTC) #3
Ryan Sleevi
You have significantly altered the threading lifetime and guarantees here, and I will need time ...
8 years ago (2012-12-18 18:48:48 UTC) #4
Philippe
On 2012/12/18 18:48:48, Ryan Sleevi wrote: > You have significantly altered the threading lifetime and ...
8 years ago (2012-12-19 10:00:48 UTC) #5
Philippe
On 2012/12/19 10:00:48, Philippe wrote: > On 2012/12/18 18:48:48, Ryan Sleevi wrote: > > You ...
8 years ago (2012-12-19 16:48:45 UTC) #6
Ryan Sleevi
So, my biggest concern with your first approach is that by plumbing things through, you ...
8 years ago (2012-12-19 17:38:15 UTC) #7
Philippe
What do you think? https://codereview.chromium.org/11628008/diff/11001/net/android/network_change_notifier_delegate_android.h File net/android/network_change_notifier_delegate_android.h (right): https://codereview.chromium.org/11628008/diff/11001/net/android/network_change_notifier_delegate_android.h#newcode58 net/android/network_change_notifier_delegate_android.h:58: void AddObserver(Observer* observer); On 2012/12/19 ...
8 years ago (2012-12-19 17:52:23 UTC) #8
Ryan Sleevi
In comparing Patchset 2 with Patchset 3, I think even with my concerns, it (PS#2) ...
8 years ago (2012-12-19 18:07:57 UTC) #9
Philippe
On 2012/12/19 18:07:57, Ryan Sleevi wrote: > In comparing Patchset 2 with Patchset 3, I ...
8 years ago (2012-12-19 18:14:36 UTC) #10
Philippe
On 2012/12/19 18:14:36, Philippe wrote: > On 2012/12/19 18:07:57, Ryan Sleevi wrote: > > In ...
8 years ago (2012-12-20 15:37:32 UTC) #11
gone
Just some random comments, for now. I think rsleevi has a better handle on any ...
8 years ago (2012-12-20 19:37:31 UTC) #12
Ryan Sleevi
So the C++ changes mostly LGTM, but I'm having trouble understanding the test & Java ...
8 years ago (2012-12-20 19:43:08 UTC) #13
gone
I'm confused about the need for multiple native observers, too. Aren't these classes meant to ...
8 years ago (2012-12-20 21:52:20 UTC) #14
Philippe
Thanks! To be clear, having multiple factories is not the general use case. The "problem" ...
8 years ago (2012-12-21 09:51:55 UTC) #15
Ryan Sleevi
https://chromiumcodereview.appspot.com/11628008/diff/23001/net/android/network_change_notifier_android_unittest.cc File net/android/network_change_notifier_android_unittest.cc (right): https://chromiumcodereview.appspot.com/11628008/diff/23001/net/android/network_change_notifier_android_unittest.cc#newcode79 net/android/network_change_notifier_android_unittest.cc:79: SetGlobalConnectivityStateAsOnline(true); nit: I actually found the original code cleaner, ...
8 years ago (2012-12-21 19:26:07 UTC) #16
Philippe
https://chromiumcodereview.appspot.com/11628008/diff/23001/net/android/network_change_notifier_android_unittest.cc File net/android/network_change_notifier_android_unittest.cc (right): https://chromiumcodereview.appspot.com/11628008/diff/23001/net/android/network_change_notifier_android_unittest.cc#newcode79 net/android/network_change_notifier_android_unittest.cc:79: SetGlobalConnectivityStateAsOnline(true); On 2012/12/21 19:26:07, Ryan Sleevi wrote: > nit: ...
7 years, 12 months ago (2012-12-26 10:33:25 UTC) #17
Philippe
Ping :)
7 years, 11 months ago (2013-01-03 12:04:49 UTC) #18
Ryan Sleevi
Some comment nits, but C++ LGTM, no need for re-review. https://chromiumcodereview.appspot.com/11628008/diff/28002/net/android/network_change_notifier_android_unittest.cc File net/android/network_change_notifier_android_unittest.cc (right): https://chromiumcodereview.appspot.com/11628008/diff/28002/net/android/network_change_notifier_android_unittest.cc#newcode73 ...
7 years, 11 months ago (2013-01-03 18:28:25 UTC) #19
gone
lgtm https://chromiumcodereview.appspot.com/11628008/diff/20001/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java File net/android/java/src/org/chromium/net/NetworkChangeNotifier.java (right): https://chromiumcodereview.appspot.com/11628008/diff/20001/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java#newcode24 net/android/java/src/org/chromium/net/NetworkChangeNotifier.java:24: * WARNING: This class is not thread-safe. On ...
7 years, 11 months ago (2013-01-03 18:47:12 UTC) #20
Philippe
Thanks guys! https://codereview.chromium.org/11628008/diff/28002/net/android/network_change_notifier_android_unittest.cc File net/android/network_change_notifier_android_unittest.cc (right): https://codereview.chromium.org/11628008/diff/28002/net/android/network_change_notifier_android_unittest.cc#newcode73 net/android/network_change_notifier_android_unittest.cc:73: SetOffline(); On 2013/01/03 18:28:25, Ryan Sleevi wrote: ...
7 years, 11 months ago (2013-01-04 10:13:01 UTC) #21
commit-bot: I haz the power
7 years, 11 months ago (2013-01-04 12:02:25 UTC) #22

Powered by Google App Engine
This is Rietveld 408576698