|
|
Created:
5 years, 6 months ago by michaelbai Modified:
5 years, 5 months ago CC:
chromium-reviews, android-webview-reviews_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Target Ref:
refs/pending/heads/master Project:
chromium Visibility:
Public. |
DescriptionRefactoring WebView permission request
- Used java_cpp_enum to sync the resources definition.
BUG=504037
Committed: https://crrev.com/1be24f4be6a39728e8f1222f3d6ce474f18705ba
Cr-Commit-Position: refs/heads/master@{#340202}
Patch Set 1 #
Total comments: 11
Patch Set 2 : address comments #Patch Set 3 : fix unittest #
Total comments: 2
Patch Set 4 : moved to constructor #Patch Set 5 : #Patch Set 6 : fix findbugs #Patch Set 7 : only sync resource definition #
Messages
Total messages: 40 (14 generated)
[email protected] changed reviewers: + [email protected]
I'm guessing I was supposed to review this? :p https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... File android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java (left): https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java:736: if (TRACE) Log.d(TAG, "onPermissionRequestCanceled"); this line got droppped https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... File android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java (right): https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java:7: import android.R; is this needed? https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... File android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java (right): https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:28: private String[] mResourcesStrings; recommend not caching mResourcesStrings. Too easy to accidentally get them out of sync imo. Do you expect this will be called many times? https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:115: synchronized (this) { why does this need to be synchronized? https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:123: private void grant() { merge this into the grant method below?
PTAL https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... File android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java (left): https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java:736: if (TRACE) Log.d(TAG, "onPermissionRequestCanceled"); On 2015/07/06 17:50:56, boliu wrote: > this line got droppped Done. https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... File android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java (right): https://codereview.chromium.org/1203163002/diff/1/android_webview/glue/java/s... android_webview/glue/java/src/com/android/webview/chromium/WebViewContentsClientAdapter.java:7: import android.R; On 2015/07/06 17:50:56, boliu wrote: > is this needed? Removed, no idea how it added https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... File android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java (right): https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:28: private String[] mResourcesStrings; On 2015/07/06 17:50:56, boliu wrote: > recommend not caching mResourcesStrings. Too easy to accidentally get them out > of sync imo. Do you expect this will be called many times? It is hard to guess how it be used as it called by apps, because it currently is only used in getResources(), I'd prefer to keep it. https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:115: synchronized (this) { On 2015/07/06 17:50:56, boliu wrote: > why does this need to be synchronized? ditto, it could be called in multiple thread. https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:123: private void grant() { On 2015/07/06 17:50:56, boliu wrote: > merge this into the grant method below? Done.
lgtm reminder this breaks api between glue and rest of chromium, which means it will temporarily break downstream build before you manually roll it in and merge the glue change https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... File android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java (right): https://codereview.chromium.org/1203163002/diff/1/android_webview/java/src/or... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:115: synchronized (this) { On 2015/07/15 22:33:43, michaelbai wrote: > On 2015/07/06 17:50:56, boliu wrote: > > why does this need to be synchronized? > > ditto, it could be called in multiple thread. Wait. Then what's the thread safety promise of this class then? As implemented, grant/deny certainly are not thread safe and have to be called on UI thread. Is this one special just because "looks" const, but is not actually const? It was already there before though..
[email protected] changed reviewers: + [email protected]
https://codereview.chromium.org/1203163002/diff/40001/android_webview/java/sr... File android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java (right): https://codereview.chromium.org/1203163002/diff/40001/android_webview/java/sr... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:115: synchronized (this) { What is this synchronized *against*? I don't see what race is possible here. This is just converting mResources to string lazily when it's needed, right? mResources can't actually change in the lifetime of an object, as far as I can see (it's only initialised in the constructor and then never changed again), so even if two threads end up running this code concurrently somehow and both hit the null check at the same time, they will just construct two identical string arrays and it doesn't matter which one wins.
https://codereview.chromium.org/1203163002/diff/40001/android_webview/java/sr... File android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java (right): https://codereview.chromium.org/1203163002/diff/40001/android_webview/java/sr... android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:115: synchronized (this) { On 2015/07/16 16:06:33, Torne wrote: > What is this synchronized *against*? I don't see what race is possible here. > This is just converting mResources to string lazily when it's needed, right? > mResources can't actually change in the lifetime of an object, as far as I can > see (it's only initialised in the constructor and then never changed again), so > even if two threads end up running this code concurrently somehow and both hit > the null check at the same time, they will just construct two identical string > arrays and it doesn't matter which one wins. Moved the constructor and removed the synchronized.
On 2015/07/16 18:03:58, michaelbai wrote: > https://codereview.chromium.org/1203163002/diff/40001/android_webview/java/sr... > File > android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java > (right): > > https://codereview.chromium.org/1203163002/diff/40001/android_webview/java/sr... > android_webview/java/src/org/chromium/android_webview/permission/AwPermissionRequest.java:115: > synchronized (this) { > On 2015/07/16 16:06:33, Torne wrote: > > What is this synchronized *against*? I don't see what race is possible here. > > This is just converting mResources to string lazily when it's needed, right? > > mResources can't actually change in the lifetime of an object, as far as I can > > see (it's only initialised in the constructor and then never changed again), > so > > even if two threads end up running this code concurrently somehow and both hit > > the null check at the same time, they will just construct two identical string > > arrays and it doesn't matter which one wins. > > Moved the constructor and removed the synchronized. That wasn't what I was proposing, I was proposing you leave it how it is and just remove synchronized, because it's fine to let threads race here, but this is also safe and marking everything final makes it clear, so it's fine. LGTM
The CQ bit was checked by [email protected]
The patchset sent to the CQ was uploaded after l-g-t-m from [email protected] Link to the patchset: https://codereview.chromium.org/1203163002/#ps80001 (title: " ")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1203163002/80001
The CQ bit was unchecked by [email protected]
Try jobs failed on following builders: android_clang_dbg_recipe on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/android_clang_d...)
The CQ bit was checked by [email protected]
The patchset sent to the CQ was uploaded after l-g-t-m from [email protected], [email protected] Link to the patchset: https://codereview.chromium.org/1203163002/#ps100001 (title: "fix findbugs")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1203163002/100001
The CQ bit was unchecked by [email protected]
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...)
The CQ bit was checked by [email protected]
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1203163002/100001
The CQ bit was unchecked by [email protected]
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...)
[FATAL:jni_android.cc(138)] Check failed: !ClearException(env) && clazz. Failed to find class org/chromium/android_webview/permission/AwPermissionRequest o_O proguard related? This is a release bot.. Or maybe just some gyp mistake I didn't catch.
On 2015/07/18 00:58:45, boliu wrote: > [FATAL:jni_android.cc(138)] Check failed: !ClearException(env) && clazz. Failed > to find class org/chromium/android_webview/permission/AwPermissionRequest > > o_O > > proguard related? This is a release bot.. > > Or maybe just some gyp mistake I didn't catch. I built release version, and didn't see the error locally, suspect APK wasn't installed correctly or something else.
On 2015/07/18 01:21:05, michaelbai wrote: > On 2015/07/18 00:58:45, boliu wrote: > > [FATAL:jni_android.cc(138)] Check failed: !ClearException(env) && clazz. > Failed > > to find class org/chromium/android_webview/permission/AwPermissionRequest > > > > o_O > > > > proguard related? This is a release bot.. > > > > Or maybe just some gyp mistake I didn't catch. > > I built release version, and didn't see the error locally, suspect APK wasn't > installed correctly or something else. Unlikely since it's not a flake and all other instrumentation passed as well.
The CQ bit was checked by [email protected]
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1203163002/100001
The CQ bit was unchecked by [email protected]
Try jobs failed on following builders: linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...)
On 2015/07/20 19:30:38, commit-bot: I haz the power wrote: > Try jobs failed on following builders: > linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, > http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...) The device of linux_android_rel_ng is running on K which doesn't have PermissionRequest API.
On 2015/07/20 19:37:03, michaelbai wrote: > On 2015/07/20 19:30:38, commit-bot: I haz the power wrote: > > Try jobs failed on following builders: > > linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, > > > http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...) > > The device of linux_android_rel_ng is running on K which doesn't have > PermissionRequest API. Err, then this change shouldn't be done until we have instrumentation coverage on L :(
On 2015/07/20 19:45:12, boliu wrote: > On 2015/07/20 19:37:03, michaelbai wrote: > > On 2015/07/20 19:30:38, commit-bot: I haz the power wrote: > > > Try jobs failed on following builders: > > > linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, > > > > > > http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...) > > > > The device of linux_android_rel_ng is running on K which doesn't have > > PermissionRequest API. > > Err, then this change shouldn't be done until we have instrumentation coverage > on L :( Is WebView going to release on L?
On 2015/07/20 19:48:37, michaelbai wrote: > On 2015/07/20 19:45:12, boliu wrote: > > On 2015/07/20 19:37:03, michaelbai wrote: > > > On 2015/07/20 19:30:38, commit-bot: I haz the power wrote: > > > > Try jobs failed on following builders: > > > > linux_android_rel_ng on tryserver.chromium.linux (JOB_FAILED, > > > > > > > > > > http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_android_r...) > > > > > > The device of linux_android_rel_ng is running on K which doesn't have > > > PermissionRequest API. > > > > Err, then this change shouldn't be done until we have instrumentation coverage > > on L :( > > Is WebView going to release on L? You mean K? no. But we don't have instrumentation coverage on L yet, so if we make these tests require L+, it's pretty much the same as no running them at all. I assume you don't want that.
Changed to make definition synchronous only, PTAL
lgtm
The CQ bit was checked by [email protected]
The patchset sent to the CQ was uploaded after l-g-t-m from [email protected] Link to the patchset: https://codereview.chromium.org/1203163002/#ps120001 (title: "only sync resource definition")
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1203163002/120001 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1203163002/120001
Message was sent while issue was closed.
Committed patchset #7 (id:120001)
Message was sent while issue was closed.
Patchset 7 (id:??) landed as https://crrev.com/1be24f4be6a39728e8f1222f3d6ce474f18705ba Cr-Commit-Position: refs/heads/master@{#340202} |