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

Issue 2866253002: Refactor NetworkChangeNotifierAndroid (Closed)

Created:
3 years, 7 months ago by pauljensen
Modified:
3 years, 7 months ago
Reviewers:
jkarlin, qinmin, xunjieli
CC:
chromium-reviews, David Trainor- moved to gerrit, jam, cbentzel+watch_chromium.org, net-reviews_chromium.org, darin-cc_chromium.org, agrieve+watch_chromium.org
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Refactor NetworkChangeNotifierAndroid Cleanup and simplify NCNAndroid in a few ways: 1. Move convertToConnectionType() and convertToConnectionSubtype() from NCNAutoDetect to NetworkState accessors as this is where they make the most sense. 2. Pass around connection type and subtype, instead of connection bandwidth which is just computed from the subtype. This reduces the number of JNI calls to convert between the subtype and bandwidth. 3. Instead of keeping four different state variables in NCNAutoDetect, just keep one, the NetworkState, which contains the different state characteristics. These cleanups have the convenient byproduct of avoiding all JNI calls from NCNAndroid until there are incoming JNI calls to register native observers; this ensures NCNAndroid initialization can be done without JNI, which facilitates crrev.com/2863093003. Review-Url: https://codereview.chromium.org/2866253002 Cr-Commit-Position: refs/heads/master@{#471599} Committed: https://chromium.googlesource.com/chromium/src/+/82afc22a4146e58caddfb33496c1ff3e15307854

Patch Set 1 #

Patch Set 2 : fix #

Patch Set 3 : fix #

Patch Set 4 : fix #

Patch Set 5 : fix #

Patch Set 6 : fix #

Patch Set 7 : fix #

Patch Set 8 : fix #

Patch Set 9 : fix #

Total comments: 7

Patch Set 10 : address comments #

Patch Set 11 : rename MaxBandwidth signals to ConnectionSubtype #

Patch Set 12 : Add test to make sure NCN doesn't call native functions during startup #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+191 lines, -219 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/BackgroundSyncNetworkObserver.java View 1 2 3 4 5 6 7 8 9 10 2 chunks +2 lines, -3 lines 0 comments Download
M net/android/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M net/android/java/src/org/chromium/net/NetworkChangeNotifier.java View 1 2 3 4 5 6 7 8 9 10 12 chunks +19 lines, -43 lines 0 comments Download
M net/android/java/src/org/chromium/net/NetworkChangeNotifierAutoDetect.java View 1 2 3 4 5 6 7 8 9 10 10 chunks +87 lines, -117 lines 0 comments Download
A net/android/javatests/src/org/chromium/net/NetworkChangeNotifierNoNativeTest.java View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +33 lines, -0 lines 1 comment Download
M net/android/javatests/src/org/chromium/net/NetworkChangeNotifierTest.java View 1 2 3 4 5 6 7 8 9 10 7 chunks +30 lines, -34 lines 0 comments Download
M net/android/network_change_notifier_android_unittest.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +6 lines, -5 lines 0 comments Download
M net/android/network_change_notifier_delegate_android.h View 1 2 3 4 5 6 7 8 9 10 3 chunks +3 lines, -2 lines 0 comments Download
M net/android/network_change_notifier_delegate_android.cc View 1 2 3 4 5 6 7 8 9 10 4 chunks +9 lines, -14 lines 0 comments Download

Messages

Total messages: 25 (10 generated)
pauljensen
Helen, can you review this CL please?
3 years, 7 months ago (2017-05-10 01:10:04 UTC) #7
xunjieli
nice clean. one question below. https://codereview.chromium.org/2866253002/diff/160001/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java File net/android/java/src/org/chromium/net/NetworkChangeNotifier.java (right): https://codereview.chromium.org/2866253002/diff/160001/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java#newcode43 net/android/java/src/org/chromium/net/NetworkChangeNotifier.java:43: private int mMaxBandwidthConnectionSubType = ...
3 years, 7 months ago (2017-05-10 14:20:10 UTC) #8
pauljensen
I also deleted some more code in the latest patch set. https://codereview.chromium.org/2866253002/diff/160001/net/android/java/src/org/chromium/net/NetworkChangeNotifier.java File net/android/java/src/org/chromium/net/NetworkChangeNotifier.java (right): ...
3 years, 7 months ago (2017-05-10 16:54:53 UTC) #9
xunjieli
If we have no user of onMaxBandwidthChanged() callback, can we remove it? This is a ...
3 years, 7 months ago (2017-05-10 18:12:15 UTC) #10
pauljensen
On 2017/05/10 18:12:15, xunjieli wrote: > If we have no user of onMaxBandwidthChanged() callback, can ...
3 years, 7 months ago (2017-05-10 18:46:43 UTC) #11
xunjieli
On 2017/05/10 18:46:43, pauljensen wrote: > On 2017/05/10 18:12:15, xunjieli wrote: > > If we ...
3 years, 7 months ago (2017-05-10 19:16:33 UTC) #12
pauljensen
On 2017/05/10 19:16:33, xunjieli wrote: > On 2017/05/10 18:46:43, pauljensen wrote: > > On 2017/05/10 ...
3 years, 7 months ago (2017-05-11 13:02:17 UTC) #13
xunjieli
On 2017/05/11 13:02:17, pauljensen wrote: > On 2017/05/10 19:16:33, xunjieli wrote: > > On 2017/05/10 ...
3 years, 7 months ago (2017-05-11 13:16:37 UTC) #14
pauljensen
On 2017/05/10 18:12:15, xunjieli wrote: > On 2017/05/10 16:54:53, pauljensen wrote: > > On 2017/05/10 ...
3 years, 7 months ago (2017-05-11 16:08:11 UTC) #15
xunjieli
https://codereview.chromium.org/2866253002/diff/220001/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierNoNativeTest.java File net/android/javatests/src/org/chromium/net/NetworkChangeNotifierNoNativeTest.java (right): https://codereview.chromium.org/2866253002/diff/220001/net/android/javatests/src/org/chromium/net/NetworkChangeNotifierNoNativeTest.java#newcode20 net/android/javatests/src/org/chromium/net/NetworkChangeNotifierNoNativeTest.java:20: @RunWith(BaseJUnit4ClassRunner.class) Nice! LGTM. Thanks for adding the test.
3 years, 7 months ago (2017-05-11 16:17:51 UTC) #16
pauljensen
Josh, PTAL @ content/public/android/java/src/org/chromium/content/browser/BackgroundSyncNetworkObserver.java Min, PTAL @ chrome/android/java/src/org/chromium/chrome/browser/download/DownloadManagerService.java
3 years, 7 months ago (2017-05-11 20:03:00 UTC) #18
qinmin
lgtm
3 years, 7 months ago (2017-05-11 21:54:41 UTC) #19
jkarlin
BackgroundSyncNetworkObserver.java lgtm
3 years, 7 months ago (2017-05-12 15:19:51 UTC) #20
commit-bot: I haz the power
CQ is trying da patch. Follow status at: https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2866253002/220001
3 years, 7 months ago (2017-05-13 17:26:03 UTC) #22
commit-bot: I haz the power
3 years, 7 months ago (2017-05-13 18:23:49 UTC) #25
Message was sent while issue was closed.
Committed patchset #12 (id:220001) as
https://chromium.googlesource.com/chromium/src/+/82afc22a4146e58caddfb33496c1...

Powered by Google App Engine
This is Rietveld 408576698