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

Issue 2340293003: Add MemoryMonitorAndroid (Closed)

Created:
4 years, 3 months ago by bashi
Modified:
4 years, 2 months ago
Reviewers:
haraken, sky, chrisha, agrieve, boliu
CC:
chromium-reviews, jam, darin-cc_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Add MemoryMonitorAndroid Use ActivityManager.getMemoryInfo() to implement MemoryMonitor for android. Design doc: https://docs.google.com/document/d/1xHBD29Pi26cwXd7byJd7DhvdhJ8EzODP_uqUUI7J9e4/edit#heading=h.z8w4k8xdqow NO_DEPENDENCY_CHECKS=true BUG=617492 Committed: https://crrev.com/66264142bb289b0975682b0423685467cb2475f9 Cr-Commit-Position: refs/heads/master@{#421128}

Patch Set 1 #

Total comments: 4

Patch Set 2 : typo #

Total comments: 6

Patch Set 3 : DCHECK #

Total comments: 12

Patch Set 4 : Use native callback instead of returning MemoryInfo #

Total comments: 3

Patch Set 5 : rebase #

Unified diffs Side-by-side diffs Delta from patch set Stats (+190 lines, -0 lines) Patch
M content/browser/BUILD.gn View 1 2 4 1 chunk +2 lines, -0 lines 0 comments Download
M content/browser/android/browser_jni_registrar.cc View 1 2 3 2 chunks +2 lines, -0 lines 0 comments Download
A content/browser/memory/memory_monitor_android.h View 1 2 3 4 1 chunk +45 lines, -0 lines 0 comments Download
A content/browser/memory/memory_monitor_android.cc View 1 2 3 4 1 chunk +69 lines, -0 lines 0 comments Download
A content/browser/memory/memory_monitor_android_unittest.cc View 1 2 3 4 1 chunk +27 lines, -0 lines 0 comments Download
M content/public/android/BUILD.gn View 1 2 4 2 chunks +2 lines, -0 lines 0 comments Download
A content/public/android/java/src/org/chromium/content/browser/MemoryMonitorAndroid.java View 1 2 3 4 1 chunk +42 lines, -0 lines 0 comments Download
M content/test/BUILD.gn View 1 2 3 4 1 chunk +1 line, -0 lines 0 comments Download

Messages

Total messages: 38 (16 generated)
bashi
Chris, does this make sense to you? I checked how long does ActivityManager.getMemoryInfo() take, and ...
4 years, 3 months ago (2016-09-16 03:49:00 UTC) #4
haraken
(I'm clearly not eligible to review this CL though.) https://codereview.chromium.org/2340293003/diff/1/content/browser/memory/memory_monitor_android.cc File content/browser/memory/memory_monitor_android.cc (right): https://codereview.chromium.org/2340293003/diff/1/content/browser/memory/memory_monitor_android.cc#newcode67 content/browser/memory/memory_monitor_android.cc:67: ...
4 years, 3 months ago (2016-09-16 06:49:26 UTC) #7
bashi
https://codereview.chromium.org/2340293003/diff/1/content/browser/memory/memory_monitor_android.cc File content/browser/memory/memory_monitor_android.cc (right): https://codereview.chromium.org/2340293003/diff/1/content/browser/memory/memory_monitor_android.cc#newcode67 content/browser/memory/memory_monitor_android.cc:67: // Implementation of factory function defined in memory_monitor.h. On ...
4 years, 3 months ago (2016-09-20 02:57:01 UTC) #8
chrisha
Looks nice and simple to me. Would be great to have an appropriate Android person ...
4 years, 2 months ago (2016-09-26 17:56:48 UTC) #9
bashi
Chris, thank you for review! boliu@, agrieve@: Could you review android part? sky@: Could you ...
4 years, 2 months ago (2016-09-26 23:30:19 UTC) #11
sky
LGTM
4 years, 2 months ago (2016-09-27 00:17:25 UTC) #12
boliu
https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc File content/browser/memory/memory_monitor_android.cc (right): https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc#newcode58 content/browser/memory/memory_monitor_android.cc:58: avail_mem_id_ = env->GetFieldID(clazz.obj(), "availMem", "J"); we go to great ...
4 years, 2 months ago (2016-09-27 00:19:11 UTC) #13
boliu
https://codereview.chromium.org/2340293003/diff/40001/content/test/BUILD.gn File content/test/BUILD.gn (right): https://codereview.chromium.org/2340293003/diff/40001/content/test/BUILD.gn#newcode1114 content/test/BUILD.gn:1114: "../browser/memory/memory_monitor_linux_unittest.cc", different CL?
4 years, 2 months ago (2016-09-27 00:19:45 UTC) #14
agrieve
Androidy parts lgtm https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.h File content/browser/memory/memory_monitor_android.h (right): https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.h#newcode1 content/browser/memory/memory_monitor_android.h:1: // Copyright (c) 2016 The Chromium ...
4 years, 2 months ago (2016-09-27 00:32:25 UTC) #15
agrieve
https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc File content/browser/memory/memory_monitor_android.cc (right): https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc#newcode58 content/browser/memory/memory_monitor_android.cc:58: avail_mem_id_ = env->GetFieldID(clazz.obj(), "availMem", "J"); On 2016/09/27 00:19:11, boliu ...
4 years, 2 months ago (2016-09-27 00:35:05 UTC) #16
boliu
https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc File content/browser/memory/memory_monitor_android.cc (right): https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc#newcode58 content/browser/memory/memory_monitor_android.cc:58: avail_mem_id_ = env->GetFieldID(clazz.obj(), "availMem", "J"); On 2016/09/27 00:35:05, agrieve ...
4 years, 2 months ago (2016-09-27 03:00:23 UTC) #17
bashi
https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc File content/browser/memory/memory_monitor_android.cc (right): https://codereview.chromium.org/2340293003/diff/40001/content/browser/memory/memory_monitor_android.cc#newcode58 content/browser/memory/memory_monitor_android.cc:58: avail_mem_id_ = env->GetFieldID(clazz.obj(), "availMem", "J"); Thank you for suggestions. ...
4 years, 2 months ago (2016-09-27 03:51:36 UTC) #18
boliu
lgtm
4 years, 2 months ago (2016-09-27 03:55:37 UTC) #19
commit-bot: I haz the power
This CL has an open dependency (Issue 2340293003 Patch 40001). Please resolve the dependency and ...
4 years, 2 months ago (2016-09-27 04:30:07 UTC) #23
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/2340293003/60001
4 years, 2 months ago (2016-09-27 05:07:42 UTC) #26
boliu
https://codereview.chromium.org/2340293003/diff/60001/content/test/BUILD.gn File content/test/BUILD.gn (left): https://codereview.chromium.org/2340293003/diff/60001/content/test/BUILD.gn#oldcode1114 content/test/BUILD.gn:1114: "../browser/memory/memory_monitor_linux_unittest.cc", is this correct? now patch shows removing this ...
4 years, 2 months ago (2016-09-27 05:17:14 UTC) #27
bashi
https://codereview.chromium.org/2340293003/diff/60001/content/test/BUILD.gn File content/test/BUILD.gn (left): https://codereview.chromium.org/2340293003/diff/60001/content/test/BUILD.gn#oldcode1114 content/test/BUILD.gn:1114: "../browser/memory/memory_monitor_linux_unittest.cc", On 2016/09/27 05:17:14, boliu wrote: > is this ...
4 years, 2 months ago (2016-09-27 05:21:07 UTC) #28
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/2340293003/80001
4 years, 2 months ago (2016-09-27 05:27:03 UTC) #32
commit-bot: I haz the power
Committed patchset #5 (id:80001)
4 years, 2 months ago (2016-09-27 06:26:59 UTC) #34
commit-bot: I haz the power
Patchset 5 (id:??) landed as https://crrev.com/66264142bb289b0975682b0423685467cb2475f9 Cr-Commit-Position: refs/heads/master@{#421128}
4 years, 2 months ago (2016-09-27 06:28:38 UTC) #36
chrisha
Given agrieve's comments in the design doc, I'd prefer we move to using a single ...
4 years, 2 months ago (2016-09-27 15:47:16 UTC) #37
bashi
4 years, 2 months ago (2016-09-29 01:24:21 UTC) #38
Message was sent while issue was closed.
As commented on the design doc, I'd prefer to defer such kind of optimization
until it's really needed. And I'm not sure using base::GetSystemMemoryInfo helps
unifying the logic because on Android we will end up calculating different
numbers.

https://codereview.chromium.org/2340293003/diff/20001/content/browser/memory/...
File content/browser/memory/memory_monitor_android_unittest.cc (right):

https://codereview.chromium.org/2340293003/diff/20001/content/browser/memory/...
content/browser/memory/memory_monitor_android_unittest.cc:29: }
On 2016/09/27 15:47:16, chrisha (slow) wrote:
> On 2016/09/26 23:30:19, bashi1 wrote:
> > On 2016/09/26 17:56:48, chrisha (slow) wrote:
> > > A test of the actual GetFreeMemoryUntilCriticalMb logic as well?
> > 
> > In this test, GetFreeMemoryUntilCriticalMb() returns actual available memory
> on
> > the device on which this test is running and we can't specify an expected
> value
> > (it may be zero or even negative).
> > 
> > One option would be using a mock function (like other MemoryMonitor tests)
but
> > what we want to test here is that checking whether JNI bindings and Android
> APIs
> > are working, so I didn't add a test of GetFreeMemoryUntilCriticalMb.
> 
> I'd prefer we use a mock and test the actual logic as well, like the other
> monitors.

Working on this.
https://codereview.chromium.org/2382623002/

Powered by Google App Engine
This is Rietveld 408576698