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

Issue 11038015: Android: lazy initialization for method id. (Closed)

Created:
8 years, 2 months ago by bulach
Modified:
8 years, 2 months ago
CC:
chromium-reviews, erikwright+watch_chromium.org
Visibility:
Public.

Description

Android: lazy initialization for method id. Rather than requiring early registration for all method id, we can initialize them lazily as required. This solves the problem of building against SDK X but running against X - 1. Also adds a microbenchmark to ensure there are no considerable regressions. Results are a bit variable, but it hovers over: [ERROR:jni_android_unittest.cc(125)] JNI LazyMethodIDCall (us) 1983 [ERROR:jni_android_unittest.cc(127)] JNI MethodIDCall (us) 1862 BUG=152987 TEST=JNIAndroidMicrobenchmark.MethodId TBR=akalin Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=162186

Patch Set 1 #

Total comments: 4

Patch Set 2 : Math.abs #

Patch Set 3 : Tidy up + tests #

Total comments: 36

Patch Set 4 : Split files #

Total comments: 10

Patch Set 5 : Moves to MethodID #

Total comments: 19

Patch Set 6 : Joth's nits and comments #

Patch Set 7 : Removes EXCEPTIONCHECK. #

Total comments: 2

Patch Set 8 : METHODTYPE => TYPE #

Patch Set 9 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+588 lines, -598 lines) Patch
M base/android/jni_android.h View 1 2 3 4 5 6 7 2 chunks +28 lines, -47 lines 0 comments Download
M base/android/jni_android.cc View 1 2 3 4 5 6 7 8 6 chunks +56 lines, -92 lines 0 comments Download
M base/android/jni_android_unittest.cc View 1 2 3 4 5 6 7 2 chunks +47 lines, -0 lines 0 comments Download
M base/android/jni_generator/golden_sample_for_tests_jni.h View 1 2 3 4 5 6 7 2 chunks +82 lines, -82 lines 0 comments Download
M base/android/jni_generator/jni_generator.py View 1 2 3 4 5 6 7 8 8 chunks +14 lines, -24 lines 0 comments Download
M base/android/jni_generator/jni_generator_tests.py View 1 2 3 4 5 6 7 8 11 chunks +261 lines, -270 lines 0 comments Download
M base/android/locale_utils.cc View 1 2 3 4 5 6 7 1 chunk +5 lines, -4 lines 0 comments Download
M chrome/browser/android/chrome_web_contents_delegate_android.cc View 1 2 3 4 5 6 7 8 5 chunks +9 lines, -7 lines 0 comments Download
M chrome/browser/android/provider/chrome_browser_provider.cc View 1 2 3 4 5 6 7 3 chunks +7 lines, -5 lines 0 comments Download
M chrome/browser/history/android/sqlite_cursor.cc View 1 2 3 4 5 6 7 2 chunks +3 lines, -7 lines 0 comments Download
M content/browser/android/content_view_core_impl.cc View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -2 lines 0 comments Download
M content/browser/android/download_controller_android_impl.cc View 1 2 3 4 5 6 7 8 2 chunks +3 lines, -1 line 0 comments Download
M content/browser/android/surface_texture_peer_browser_impl.cc View 1 2 3 4 5 6 7 8 2 chunks +8 lines, -5 lines 0 comments Download
M content/browser/device_orientation/data_fetcher_impl_android.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/geolocation/location_api_adapter_android.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/renderer_host/java/java_method.cc View 1 2 3 4 5 6 7 3 chunks +8 lines, -8 lines 0 comments Download
M content/common/android/surface_callback.cc View 1 2 3 4 5 6 7 2 chunks +5 lines, -8 lines 0 comments Download
M content/common/android/surface_texture_bridge.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M media/base/android/media_player_bridge.cc View 1 2 3 4 5 6 7 8 3 chunks +5 lines, -5 lines 0 comments Download
M net/proxy/proxy_config_service_android.cc View 1 2 3 4 1 chunk +0 lines, -1 line 0 comments Download
M sync/util/session_utils_android.cc View 1 2 3 4 5 6 7 3 chunks +8 lines, -4 lines 0 comments Download
M ui/base/clipboard/clipboard_android.cc View 1 2 3 4 5 6 7 3 chunks +12 lines, -11 lines 0 comments Download
M ui/base/clipboard/clipboard_unittest.cc View 1 2 3 4 5 6 7 3 chunks +6 lines, -4 lines 0 comments Download
M webkit/glue/fling_animator_impl_android.cc View 1 2 3 4 5 6 7 2 chunks +18 lines, -8 lines 0 comments Download

Messages

Total messages: 35 (0 generated)
bulach
hi! Following the discussions on: http://code.google.com/p/chromium/issues/detail?id=152987 this patch adds the "lazy initialization" for the jmethodid, ...
8 years, 2 months ago (2012-10-02 14:37:20 UTC) #1
Sami
Some comments inline. Mind posting your micro benchmark scores? I remember some part of the ...
8 years, 2 months ago (2012-10-02 15:14:04 UTC) #2
bulach
thanks sami! the results I had are in the patch description: [ERROR:jni_android_unittest.cc(124)] JNI MT-21424 [ERROR:jni_android_unittest.cc(126)] ...
8 years, 2 months ago (2012-10-02 15:28:29 UTC) #3
Sami
On 2012/10/02 15:28:29, bulach wrote: > thanks sami! > the results I had are in ...
8 years, 2 months ago (2012-10-02 15:54:48 UTC) #4
bulach
a-ha! indeed, using Math.abs and avoiding all the ScopedLocalRef (and possibly GC) gets a much ...
8 years, 2 months ago (2012-10-02 16:41:25 UTC) #5
bulach
ok, I cleaned up the code and added all the tests, this is ready for ...
8 years, 2 months ago (2012-10-02 17:19:39 UTC) #6
joth
http://codereview.chromium.org/11038015/diff/7001/base/android/jni_android.h File base/android/jni_android.h (right): http://codereview.chromium.org/11038015/diff/7001/base/android/jni_android.h#newcode14 base/android/jni_android.h:14: #include "base/logging.h" rather than pull this spew into the ...
8 years, 2 months ago (2012-10-02 17:47:42 UTC) #7
bulach
thanks joth! I have to leave now, but a few questions to avoid another around ...
8 years, 2 months ago (2012-10-02 18:20:42 UTC) #8
joth
Hmmm Note you *could* have LazyMethodID hold the AtmoicWord as a member, but you'd need ...
8 years, 2 months ago (2012-10-02 18:30:38 UTC) #9
bulach
thanks joth! latest changes include: 1. using an AtomicWord and returning the jmethodID as per ...
8 years, 2 months ago (2012-10-03 13:09:00 UTC) #10
joth
> 2. split the class into its own file, with its own test... > I ...
8 years, 2 months ago (2012-10-03 17:31:52 UTC) #11
bulach
sorry, I should clarify: I *will* delete all method id related functions from jni_android and ...
8 years, 2 months ago (2012-10-03 17:37:31 UTC) #12
joth
On 3 October 2012 10:37, <bulach@chromium.org> wrote: > sorry, I should clarify: I *will* delete ...
8 years, 2 months ago (2012-10-03 17:51:00 UTC) #13
bulach
we could potentially split those too, but yes, probably way too much churn for now... ...
8 years, 2 months ago (2012-10-03 17:54:11 UTC) #14
joth
To be clear: if you feel strongly on leaving templating in the API, I'm fine ...
8 years, 2 months ago (2012-10-03 17:59:05 UTC) #15
bulach
joth: apologies for the biggie.. :( Summary: 1. Followed your suggestion to move the impl ...
8 years, 2 months ago (2012-10-04 16:19:00 UTC) #16
joth
The Lazy getter all LGTM - thanks much for this improvement! I have some questions ...
8 years, 2 months ago (2012-10-04 17:59:59 UTC) #17
bulach
many thanks joth! comments addressed and some other clarified.. I'm not in a particular rush, ...
8 years, 2 months ago (2012-10-04 18:58:17 UTC) #18
nyquist
http://codereview.chromium.org/11038015/diff/9004/chrome/browser/history/android/sqlite_cursor.cc File chrome/browser/history/android/sqlite_cursor.cc (right): http://codereview.chromium.org/11038015/diff/9004/chrome/browser/history/android/sqlite_cursor.cc#newcode65 chrome/browser/history/android/sqlite_cursor.cc:65: MethodID::METHODTYPE_NORMAL, MethodID::EXCEPTIONCHECK_NO>( On 2012/10/04 18:58:17, bulach wrote: > On ...
8 years, 2 months ago (2012-10-04 19:05:48 UTC) #19
joth
On 4 October 2012 11:58, <bulach@chromium.org> wrote: > many thanks joth! comments addressed and some ...
8 years, 2 months ago (2012-10-04 19:21:52 UTC) #20
joth
On 4 October 2012 12:21, Jonathan Dixon <joth@chromium.org> wrote: > > > > On 4 ...
8 years, 2 months ago (2012-10-05 05:46:47 UTC) #21
bulach
double duh! :) thanks both: indeed, we can always check exceptions, there's no need for ...
8 years, 2 months ago (2012-10-05 10:41:40 UTC) #22
joth
lgtm - no problem with the wholesale change now API details are sorted (was just ...
8 years, 2 months ago (2012-10-05 15:24:57 UTC) #23
bulach
used your idea, thanks joth! tommy: would you like to take a final look into ...
8 years, 2 months ago (2012-10-05 15:58:15 UTC) #24
joth
lgtm
8 years, 2 months ago (2012-10-05 16:03:18 UTC) #25
bulach
hey guys, sorry about the wide distribution.. We're changing a base/ API for android, and ...
8 years, 2 months ago (2012-10-08 08:49:19 UTC) #26
Jói
LGTM for c/b/component
8 years, 2 months ago (2012-10-08 10:06:39 UTC) #27
sky
c/b/h LGTM
8 years, 2 months ago (2012-10-08 15:28:53 UTC) #28
jar (doing other things)
for /net patch set 8 LGTM
8 years, 2 months ago (2012-10-08 16:09:02 UTC) #29
tony
rs LGTM
8 years, 2 months ago (2012-10-08 17:39:14 UTC) #30
joth
+tim for sync/
8 years, 2 months ago (2012-10-08 22:21:55 UTC) #31
bulach
+atwilson for sync/ OWNERS approval..
8 years, 2 months ago (2012-10-11 18:06:07 UTC) #32
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bulach@chromium.org/11038015/47001
8 years, 2 months ago (2012-10-16 11:22:03 UTC) #33
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bulach@chromium.org/11038015/47001
8 years, 2 months ago (2012-10-16 18:30:57 UTC) #34
commit-bot: I haz the power
8 years, 2 months ago (2012-10-16 18:35:15 UTC) #35
Change committed as 162186

Powered by Google App Engine
This is Rietveld 408576698