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

Issue 2659813006: Always get device conditions from Java for every attempt. (Closed)

Created:
3 years, 10 months ago by Pete Williamson
Modified:
3 years, 10 months ago
Reviewers:
dougarnett, dewittj
CC:
romax, chromium-reviews, dewittj+watch_chromium.org, fgorski+watch_chromium.org, romax+watch_chromium.org, petewil+watch_chromium.org, chili+watch_chromium.org, agrieve+watch_chromium.org, dimich+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Always get device conditions from Java for every attempt. Previously we used the NetworkChangeNotifier, but it does not get network change notifications when Chrome runs in the background, which is our primary use case. So, before starting each request, get the latest device conditions from Android directly via the Java API. BUG=682790 Review-Url: https://codereview.chromium.org/2659813006 Cr-Commit-Position: refs/heads/master@{#447201} Committed: https://chromium.googlesource.com/chromium/src/+/a2c4dd1ab5ba1423bdb46bd4b0111b942ad5f3fb

Patch Set 1 #

Total comments: 19

Patch Set 2 : Change JNI interface to use 3 small methods instead of an object. #

Total comments: 22

Patch Set 3 : fixes per DewittJ #

Unified diffs Side-by-side diffs Delta from patch set Stats (+218 lines, -89 lines) Patch
M chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundScheduler.java View 1 1 chunk +21 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/offlinepages/BackgroundSchedulerBridge.java View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java View 1 2 1 chunk +26 lines, -0 lines 0 comments Download
M chrome/browser/android/offline_pages/background_scheduler_bridge.h View 1 2 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/android/offline_pages/background_scheduler_bridge.cc View 1 2 2 chunks +25 lines, -0 lines 0 comments Download
M chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.h View 1 chunk +5 lines, -0 lines 0 comments Download
M chrome/browser/android/offline_pages/evaluation/evaluation_test_scheduler.cc View 4 chunks +17 lines, -5 lines 0 comments Download
M chrome/browser/android/offline_pages/evaluation/offline_page_evaluation_bridge.cc View 1 chunk +1 line, -4 lines 0 comments Download
M components/offline_pages/core/background/request_coordinator.h View 6 chunks +8 lines, -16 lines 0 comments Download
M components/offline_pages/core/background/request_coordinator.cc View 1 2 8 chunks +36 lines, -33 lines 0 comments Download
M components/offline_pages/core/background/request_coordinator_unittest.cc View 13 chunks +28 lines, -26 lines 0 comments Download
M components/offline_pages/core/background/scheduler.h View 1 2 2 chunks +5 lines, -0 lines 0 comments Download
M components/offline_pages/core/background/scheduler_stub.h View 1 2 1 chunk +9 lines, -2 lines 0 comments Download
M components/offline_pages/core/background/scheduler_stub.cc View 1 2 1 chunk +17 lines, -3 lines 0 comments Download

Messages

Total messages: 26 (13 generated)
Pete Williamson
DewittJ: Please check the JNI code for correctness, approach, and style. DougArnett: Please check everything ...
3 years, 10 months ago (2017-01-27 22:50:09 UTC) #2
Pete Williamson
https://codereview.chromium.org/2659813006/diff/1/components/offline_pages/core/background/request_coordinator.cc File components/offline_pages/core/background/request_coordinator.cc (right): https://codereview.chromium.org/2659813006/diff/1/components/offline_pages/core/background/request_coordinator.cc#newcode621 components/offline_pages/core/background/request_coordinator.cc:621: // TODO(petewil): Now that we can get conditions any ...
3 years, 10 months ago (2017-01-27 22:53:28 UTC) #3
dewittj
https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc File chrome/browser/android/offline_pages/background_scheduler_bridge.cc (right): https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc#newcode105 chrome/browser/android/offline_pages/background_scheduler_bridge.cc:105: if (java_conditions_object.is_null()) { nit: no braces https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc#newcode110 chrome/browser/android/offline_pages/background_scheduler_bridge.cc:110: reinterpret_cast<jobject>(java_conditions_object.obj()); ...
3 years, 10 months ago (2017-01-27 23:03:43 UTC) #4
dougarnett
lgtm - with deferral of JNI review to dewittj https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc File chrome/browser/android/offline_pages/background_scheduler_bridge.cc (right): https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc#newcode101 chrome/browser/android/offline_pages/background_scheduler_bridge.cc:101: ...
3 years, 10 months ago (2017-01-27 23:15:56 UTC) #5
Pete Williamson
https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc File chrome/browser/android/offline_pages/background_scheduler_bridge.cc (right): https://codereview.chromium.org/2659813006/diff/1/chrome/browser/android/offline_pages/background_scheduler_bridge.cc#newcode105 chrome/browser/android/offline_pages/background_scheduler_bridge.cc:105: if (java_conditions_object.is_null()) { On 2017/01/27 23:03:43, dewittj wrote: > ...
3 years, 10 months ago (2017-01-28 00:24:46 UTC) #8
dewittj
lgtm % nits https://codereview.chromium.org/2659813006/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java (right): https://codereview.chromium.org/2659813006/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java#newcode242 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java:242: public static boolean getPowerConditions(Context context) { ...
3 years, 10 months ago (2017-01-30 19:18:03 UTC) #13
Pete Williamson
https://codereview.chromium.org/2659813006/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java File chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java (right): https://codereview.chromium.org/2659813006/diff/20001/chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java#newcode242 chrome/android/java/src/org/chromium/chrome/browser/offlinepages/OfflinePageUtils.java:242: public static boolean getPowerConditions(Context context) { On 2017/01/30 19:18:02, ...
3 years, 10 months ago (2017-01-30 21:35:24 UTC) #14
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/2659813006/40001
3 years, 10 months ago (2017-01-30 21:50:51 UTC) #17
commit-bot: I haz the power
Try jobs failed on following builders: android_n5x_swarming_rel on master.tryserver.chromium.android (JOB_FAILED, https://build.chromium.org/p/tryserver.chromium.android/builders/android_n5x_swarming_rel/builds/109596)
3 years, 10 months ago (2017-01-30 23:42:57 UTC) #19
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/2659813006/40001
3 years, 10 months ago (2017-01-31 06:14:29 UTC) #21
commit-bot: I haz the power
Committed patchset #3 (id:40001) as https://chromium.googlesource.com/chromium/src/+/a2c4dd1ab5ba1423bdb46bd4b0111b942ad5f3fb
3 years, 10 months ago (2017-01-31 06:51:52 UTC) #24
RE66
On 2017/01/31 06:51:52, commit-bot: I haz the power wrote: > Committed patchset #3 (id:40001) as ...
3 years, 10 months ago (2017-01-31 13:08:55 UTC) #25
Pete Williamson
3 years, 10 months ago (2017-01-31 17:53:06 UTC) #26
Message was sent while issue was closed.
On 2017/01/31 13:08:55, RE66 wrote:
> On 2017/01/31 06:51:52, commit-bot: I haz the power wrote:
> > Committed patchset #3 (id:40001) as
> >
>
https://chromium.googlesource.com/chromium/src/+/a2c4dd1ab5ba1423bdb46bd4b011...
> 
> Its seems a bad solution ( performance wise ) 
> You should understand when and why NetworkChangeNotifier does not work and
only
> then 
> get the latest device conditions

We do understand when NetworkChangeNotifier does not work for us, it does not
work anytime chrome is in the background.  Our feature normally activates when
chrome is in the background.

We are not too concerned about performance since the call happens only about
once a minute or so when our feature is active, which is a very small percentage
of the time.  Also, we anticipate removing two of the three JNI calls in the
near future depending on how the design of another component progresses.

Powered by Google App Engine
This is Rietveld 408576698