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

Issue 2502763003: Introduce ViewRoot to forward input/view events to native (Closed)

Created:
4 years, 1 month ago by Jinsuk Kim
Modified:
3 years, 11 months ago
CC:
chromium-reviews, anandc+watch-blimp_chromium.org, maniscalco+watch-blimp_chromium.org, sriramsr+watch-blimp_chromium.org, bgoldman+watch-blimp_chromium.org, steimel+watch-blimp_chromium.org, mdjones+watch_chromium.org, donnd+watch_chromium.org, shaktisahu+watch-blimp_chromium.org, gcasto+watch-blimp_chromium.org, jam, scf+watch-blimp_chromium.org, nyquist+watch-blimp_chromium.org, perumaal+watch-blimp_chromium.org, marcinjb+watch-blimp_chromium.org, kmarshall+watch-blimp_chromium.org, lethalantidote+watch-blimp_chromium.org, agrieve+watch_chromium.org, darin-cc_chromium.org, dtrainor+watch-blimp_chromium.org, android-webview-reviews_chromium.org, khushalsagar+watch-blimp_chromium.org, wychen, David Trainor- moved to gerrit
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Introduce ViewRoot forwarding input/view events to native This CL introduces a new interface ViewRoot to forward Java view/input events down to native, replacing the flow through ContentViewCore. ViewRoot, ViewAndroid, and ViewClient are put together to adopt the pattern "chain of responsibility" dispatching the events to the classes implementing |ViewClient| along the view hierarchy, and conditionally stopping the processing when required. Embedders can obtain the interface from WindowAndroid whose native part is the root of the ViewAndroid hierarchy. WebView is an exception where all activities share the WA instance, hence cannot tell which path in the hierarchy to dispatch the event to. For this reason WebView gets ViewRoot from the top ViewAndroid (the one right below WA) instead. |OnPhysicalBackingSizedChanged| is used for an example. BUG=671401 Committed: https://crrev.com/603de249d822522b152b29184be793550695f2c8 Cr-Commit-Position: refs/heads/master@{#439636}

Patch Set 1 #

Total comments: 4

Patch Set 2 : ViewClient #

Patch Set 3 : event handler #

Patch Set 4 : lazy creation #

Total comments: 22

Patch Set 5 : addressed comments #

Total comments: 25

Patch Set 6 : WindowAndroid.GetEventHandler #

Total comments: 28

Patch Set 7 : addressed comments #

Total comments: 27

Patch Set 8 : event_handler.h/cc merged to view_android #

Patch Set 9 : call EventHandler.create directly #

Total comments: 6

Patch Set 10 : tidy up #

Total comments: 4

Patch Set 11 : no overloaded GetEventHandler #

Total comments: 6

Patch Set 12 : ViewRoot #

Total comments: 2

Patch Set 13 : rebased/fixed tests #

Total comments: 7

Patch Set 14 : prevent view_root_ gc'ed #

Unified diffs Side-by-side diffs Delta from patch set Stats (+323 lines, -82 lines) Patch
M android_webview/java/src/org/chromium/android_webview/AwContents.java View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +13 lines, -1 line 0 comments Download
M android_webview/native/aw_contents.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +3 lines, -0 lines 0 comments Download
M android_webview/native/aw_contents.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download
M blimp/client/core/contents/blimp_contents_view_impl_android.cc View 1 chunk +2 lines, -2 lines 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/compositor/CompositorViewHolder.java View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +7 lines, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/compositor/bottombar/OverlayPanel.java View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/tab/Tab.java View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -1 line 0 comments Download
M chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +7 lines, -2 lines 0 comments Download
M content/browser/android/content_view_core_impl.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +0 lines, -1 line 0 comments Download
M content/browser/android/content_view_core_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +1 line, -21 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_android.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +5 lines, -0 lines 0 comments Download
M content/browser/renderer_host/render_widget_host_view_android.cc View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +7 lines, -1 line 0 comments Download
M content/browser/web_contents/web_contents_view_android.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M content/browser/web_contents/web_contents_view_android.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +7 lines, -0 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentViewCore.java View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +3 lines, -33 lines 0 comments Download
M content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +7 lines, -3 lines 0 comments Download
M ui/android/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +4 lines, -0 lines 0 comments Download
A ui/android/java/src/org/chromium/ui/base/ViewRoot.java View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +50 lines, -0 lines 0 comments Download
M ui/android/java/src/org/chromium/ui/base/WindowAndroid.java View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +13 lines, -1 line 0 comments Download
M ui/android/ui_android_jni_registrar.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +1 line, -0 lines 0 comments Download
M ui/android/view_android.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 4 chunks +32 lines, -3 lines 0 comments Download
M ui/android/view_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 6 chunks +103 lines, -10 lines 0 comments Download
A ui/android/view_client.h View 1 2 3 4 5 1 chunk +24 lines, -0 lines 0 comments Download
A ui/android/view_client.cc View 1 2 3 4 5 6 1 chunk +11 lines, -0 lines 0 comments Download
M ui/android/window_android.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +2 lines, -0 lines 0 comments Download
M ui/android/window_android.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 93 (42 generated)
Jinsuk Kim
Note that the patch is not fully functional (i.e. migration of handling onPhysicalBackingSizeChanged from CVC ...
4 years, 1 month ago (2016-11-14 21:45:55 UTC) #2
boliu
so physical size just controls the cc layer size, which is now owned by ViewAndroid, ...
4 years, 1 month ago (2016-11-15 04:51:03 UTC) #3
Jinsuk Kim
Thanks for the feedback. Will look into forwarding through WebContents. https://codereview.chromium.org/2502763003/diff/1/ui/android/view_android.cc File ui/android/view_android.cc (right): https://codereview.chromium.org/2502763003/diff/1/ui/android/view_android.cc#newcode89 ...
4 years, 1 month ago (2016-11-15 16:47:45 UTC) #4
Changwan Ryu
https://codereview.chromium.org/2502763003/diff/1/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java File ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java (right): https://codereview.chromium.org/2502763003/diff/1/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java#newcode23 ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java:23: public abstract class ViewAndroidDelegate { How about separating this ...
4 years, 1 month ago (2016-11-17 01:23:50 UTC) #7
boliu
https://codereview.chromium.org/2502763003/diff/1/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java File ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java (right): https://codereview.chromium.org/2502763003/diff/1/ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java#newcode23 ui/android/java/src/org/chromium/ui/base/ViewAndroidDelegate.java:23: public abstract class ViewAndroidDelegate { On 2016/11/17 01:23:50, Changwan ...
4 years, 1 month ago (2016-11-17 03:10:10 UTC) #8
Jinsuk Kim
> How about separating this class into ViewAndroid and ViewAndroid.Delegate? > > Then container View ...
4 years, 1 month ago (2016-11-17 16:26:55 UTC) #9
boliu
just adding a comment here so it goes into my review queue
4 years ago (2016-11-30 22:56:48 UTC) #11
boliu
EventHandler implementation should be in ui/ I don't think there needs to be a native ...
4 years ago (2016-12-01 00:14:23 UTC) #12
Jinsuk Kim
PTAL. > EventHandler implementation should be in ui/ > > I don't think there needs ...
4 years ago (2016-12-02 10:48:15 UTC) #13
Jinsuk Kim
mdjones@: Please review the changes made in OverlayPanel. Tested it on N7 where the panel ...
4 years ago (2016-12-02 10:50:07 UTC) #14
mdjones
OverlayPanel lgtm
4 years ago (2016-12-02 17:01:51 UTC) #16
boliu
This is not a pure refactor. We are going to change how this size is ...
4 years ago (2016-12-02 23:53:22 UTC) #17
Jinsuk Kim
On 2016/12/02 17:01:51, mdjones wrote: > OverlayPanel lgtm Oops sorry - I meant to ask ...
4 years ago (2016-12-05 02:00:18 UTC) #18
Jinsuk Kim
> We need to maintain the property that there is at most one EventHandler for ...
4 years ago (2016-12-05 11:07:45 UTC) #19
boliu
Just replying to previous comments. On 2016/12/05 11:07:45, Jinsuk Kim wrote: > I think the ...
4 years ago (2016-12-06 00:10:17 UTC) #20
boliu
only looked at content and ui https://codereview.chromium.org/2502763003/diff/80001/content/browser/web_contents/web_contents_view_android.cc File content/browser/web_contents/web_contents_view_android.cc (right): https://codereview.chromium.org/2502763003/diff/80001/content/browser/web_contents/web_contents_view_android.cc#newcode245 content/browser/web_contents/web_contents_view_android.cc:245: RenderWidgetHostView* rwhv = ...
4 years ago (2016-12-06 00:34:15 UTC) #21
Jinsuk Kim
Removed Java WebContents.getEventHandler() and moved it to WindowAndroid so that embedders can use WA to ...
4 years ago (2016-12-06 07:35:08 UTC) #22
boliu
replying to a few comments https://codereview.chromium.org/2502763003/diff/60001/ui/android/event_handler.h File ui/android/event_handler.h (right): https://codereview.chromium.org/2502763003/diff/60001/ui/android/event_handler.h#newcode33 ui/android/event_handler.h:33: int physical_width_pix_; On 2016/12/06 ...
4 years ago (2016-12-06 19:13:59 UTC) #23
boliu
view_android looks much better :) https://codereview.chromium.org/2502763003/diff/100001/content/browser/android/content_view_core_impl.cc File content/browser/android/content_view_core_impl.cc (right): https://codereview.chromium.org/2502763003/diff/100001/content/browser/android/content_view_core_impl.cc#newcode1237 content/browser/android/content_view_core_impl.cc:1237: GetViewAndroid()->UpdateLayerBounds(); hmm, why is ...
4 years ago (2016-12-06 23:15:46 UTC) #24
Jinsuk Kim
Couldn't test the binary after a few changes at the final step but all the ...
4 years ago (2016-12-07 12:36:28 UTC) #26
boliu
https://codereview.chromium.org/2502763003/diff/140001/content/browser/android/content_view_core_impl.cc File content/browser/android/content_view_core_impl.cc (right): https://codereview.chromium.org/2502763003/diff/140001/content/browser/android/content_view_core_impl.cc#newcode1572 content/browser/android/content_view_core_impl.cc:1572: view_android->SetLayer(cc::Layer::Create()); if this ViewAndroid didn't have a layer, then ...
4 years ago (2016-12-08 05:01:07 UTC) #27
Jinsuk Kim
https://codereview.chromium.org/2502763003/diff/140001/content/browser/android/content_view_core_impl.cc File content/browser/android/content_view_core_impl.cc (right): https://codereview.chromium.org/2502763003/diff/140001/content/browser/android/content_view_core_impl.cc#newcode1572 content/browser/android/content_view_core_impl.cc:1572: view_android->SetLayer(cc::Layer::Create()); On 2016/12/08 05:01:06, boliu wrote: > if this ...
4 years ago (2016-12-13 23:20:38 UTC) #29
boliu
https://codereview.chromium.org/2502763003/diff/140001/content/browser/android/content_view_core_impl.cc File content/browser/android/content_view_core_impl.cc (right): https://codereview.chromium.org/2502763003/diff/140001/content/browser/android/content_view_core_impl.cc#newcode1572 content/browser/android/content_view_core_impl.cc:1572: view_android->SetLayer(cc::Layer::Create()); On 2016/12/13 23:20:38, Jinsuk Kim wrote: > On ...
4 years ago (2016-12-13 23:50:41 UTC) #30
Jinsuk Kim
https://codereview.chromium.org/2502763003/diff/140001/ui/android/view_android.cc File ui/android/view_android.cc (right): https://codereview.chromium.org/2502763003/diff/140001/ui/android/view_android.cc#newcode170 ui/android/view_android.cc:170: return parent_ ? parent_->CreateEventHandler(native_view) > No, I'm suggesting that ...
4 years ago (2016-12-14 00:34:08 UTC) #31
boliu
https://codereview.chromium.org/2502763003/diff/180001/ui/android/view_android.cc File ui/android/view_android.cc (right): https://codereview.chromium.org/2502763003/diff/180001/ui/android/view_android.cc#newcode273 ui/android/view_android.cc:273: Java_EventHandler_onDestroyNativeView(env, event_handler); this is a single line function with ...
4 years ago (2016-12-14 00:58:12 UTC) #32
Jinsuk Kim
https://codereview.chromium.org/2502763003/diff/180001/ui/android/view_android.cc File ui/android/view_android.cc (right): https://codereview.chromium.org/2502763003/diff/180001/ui/android/view_android.cc#newcode273 ui/android/view_android.cc:273: Java_EventHandler_onDestroyNativeView(env, event_handler); On 2016/12/14 00:58:11, boliu wrote: > this ...
4 years ago (2016-12-14 01:14:15 UTC) #33
boliu
https://codereview.chromium.org/2502763003/diff/200001/ui/android/window_android.h File ui/android/window_android.h (right): https://codereview.chromium.org/2502763003/diff/200001/ui/android/window_android.h#newcode77 ui/android/window_android.h:77: base::android::ScopedJavaLocalRef<jobject> GetEventHandler(JNIEnv* env, nit: this is function overloading, which ...
4 years ago (2016-12-14 01:26:42 UTC) #34
Jinsuk Kim
https://codereview.chromium.org/2502763003/diff/200001/ui/android/window_android.h File ui/android/window_android.h (right): https://codereview.chromium.org/2502763003/diff/200001/ui/android/window_android.h#newcode77 ui/android/window_android.h:77: base::android::ScopedJavaLocalRef<jobject> GetEventHandler(JNIEnv* env, On 2016/12/14 01:26:42, boliu wrote: > ...
4 years ago (2016-12-14 01:35:56 UTC) #35
boliu
lgtm
4 years ago (2016-12-14 01:38:01 UTC) #36
Jinsuk Kim
khushalsagar@chromium.org: Please review changes in blimp/ tedchoc@chromium.org: Please review changes in chrome/, ui/ Please note ...
4 years ago (2016-12-14 01:42:44 UTC) #39
Jinsuk Kim
bshe@chromium.org: Please review changes in vr_shell
4 years ago (2016-12-14 01:44:08 UTC) #41
Jinsuk Kim
https://codereview.chromium.org/2502763003/diff/80001/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java File content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java (right): https://codereview.chromium.org/2502763003/diff/80001/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java#newcode75 content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java:75: getEventHandler().onPhysicalBackingSizeChanged(width, height); On 2016/12/06 07:35:07, Jinsuk Kim wrote: > ...
4 years ago (2016-12-14 02:06:40 UTC) #42
bshe
On 2016/12/14 02:06:40, Jinsuk Kim wrote: > https://codereview.chromium.org/2502763003/diff/80001/content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java > File > content/public/android/java/src/org/chromium/content/browser/ContentViewRenderView.java > (right): > ...
4 years ago (2016-12-14 02:29:11 UTC) #43
boliu
ted, dtrainor and I talked today about how to structure this. We arrived at a ...
4 years ago (2016-12-15 22:27:25 UTC) #45
Ted C
lgtm based on boliu@'s previous comment https://codereview.chromium.org/2502763003/diff/220001/ui/android/java/src/org/chromium/ui/base/EventHandler.java File ui/android/java/src/org/chromium/ui/base/EventHandler.java (right): https://codereview.chromium.org/2502763003/diff/220001/ui/android/java/src/org/chromium/ui/base/EventHandler.java#newcode14 ui/android/java/src/org/chromium/ui/base/EventHandler.java:14: public class EventHandler ...
4 years ago (2016-12-15 23:36:44 UTC) #46
Jinsuk Kim
dtrainor@ please review changes in blimp/ https://codereview.chromium.org/2502763003/diff/220001/ui/android/java/src/org/chromium/ui/base/EventHandler.java File ui/android/java/src/org/chromium/ui/base/EventHandler.java (right): https://codereview.chromium.org/2502763003/diff/220001/ui/android/java/src/org/chromium/ui/base/EventHandler.java#newcode14 ui/android/java/src/org/chromium/ui/base/EventHandler.java:14: public class EventHandler ...
4 years ago (2016-12-16 02:04:17 UTC) #48
mthiesse
https://codereview.chromium.org/2502763003/diff/240001/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java File chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java (left): https://codereview.chromium.org/2502763003/diff/240001/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java#oldcode233 chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java:233: nativeContentBoundsChanged(mNativeVrShell, surfaceWidth, surfaceHeight, dpr); did you intend to remove ...
4 years ago (2016-12-16 17:54:23 UTC) #51
mthiesse
4 years ago (2016-12-16 17:54:27 UTC) #52
David Trainor- moved to gerrit
blimp/ lgtm. Based on Bo's comment to just rename and fix later, this is fine, ...
4 years ago (2016-12-16 19:55:26 UTC) #53
Ted C
On 2016/12/16 19:55:26, David Trainor wrote: > blimp/ lgtm. > > Based on Bo's comment ...
4 years ago (2016-12-16 20:40:40 UTC) #54
boliu
On 2016/12/16 20:40:40, Ted C wrote: > On 2016/12/16 19:55:26, David Trainor wrote: > > ...
4 years ago (2016-12-16 21:42:37 UTC) #55
Jinsuk Kim
> Also, WindowAndroid then no longer extends from ViewAndroid I believe was > the agreement ...
4 years ago (2016-12-18 23:54:17 UTC) #56
boliu
On 2016/12/18 23:54:17, Jinsuk Kim wrote: > > Also, WindowAndroid then no longer extends from ...
4 years ago (2016-12-19 00:01:41 UTC) #57
Jinsuk Kim
Left a TODO in ViewRoot.java for follow-up refactoring. https://codereview.chromium.org/2502763003/diff/240001/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java File chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java (left): https://codereview.chromium.org/2502763003/diff/240001/chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java#oldcode233 chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java:233: nativeContentBoundsChanged(mNativeVrShell, ...
4 years ago (2016-12-19 04:40:59 UTC) #68
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/2502763003/300001
4 years ago (2016-12-19 05:49:56 UTC) #75
boliu
https://codereview.chromium.org/2502763003/diff/300001/android_webview/java/src/org/chromium/android_webview/AwContents.java File android_webview/java/src/org/chromium/android_webview/AwContents.java (right): https://codereview.chromium.org/2502763003/diff/300001/android_webview/java/src/org/chromium/android_webview/AwContents.java#newcode1208 android_webview/java/src/org/chromium/android_webview/AwContents.java:1208: mViewRoot = null; On 2016/12/19 04:40:58, Jinsuk Kim wrote: ...
4 years ago (2016-12-19 17:33:09 UTC) #77
Jinsuk Kim
https://codereview.chromium.org/2502763003/diff/300001/ui/android/view_android.cc File ui/android/view_android.cc (right): https://codereview.chromium.org/2502763003/diff/300001/ui/android/view_android.cc#newcode198 ui/android/view_android.cc:198: if (!HasViewRoot()) { On 2016/12/19 17:33:09, boliu wrote: > ...
4 years ago (2016-12-19 22:59:34 UTC) #78
boliu
you have all the approvals now, right? you can land it now
4 years ago (2016-12-19 23:04:18 UTC) #79
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/2502763003/320001
4 years ago (2016-12-20 00:28:36 UTC) #86
commit-bot: I haz the power
Committed patchset #14 (id:320001)
4 years ago (2016-12-20 00:35:46 UTC) #89
commit-bot: I haz the power
4 years ago (2016-12-20 00:38:56 UTC) #91
Message was sent while issue was closed.
Patchset 14 (id:??) landed as
https://crrev.com/603de249d822522b152b29184be793550695f2c8
Cr-Commit-Position: refs/heads/master@{#439636}

Powered by Google App Engine
This is Rietveld 408576698