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

Issue 549603003: Create Mojo service for locking/unlocking screen orientation. (Closed)

Created:
6 years, 3 months ago by blundell
Modified:
5 years, 10 months ago
CC:
chromium-reviews, creis+watch_chromium.org, qsr+mojo_chromium.org, viettrungluu+watch_chromium.org, nasko+codewatch_chromium.org, jam, yzshen+watch_chromium.org, abarth-chromium, Aaron Boodman, darin-cc_chromium.org, darin (slow to review), ben+mojo_chromium.org, timvolodine, jonross
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Project:
chromium
Visibility:
Public.

Description

Mojo-ify implementation of screen orientation locking/unlocking. This CL creates a Mojo service to replace the //content-based IPC currently used for locking/unlocking screen orientation. Major changes: - Renderer and browser communicate via a Mojo interface defined in screen_orientation_service.mojom. - The browser-side ScreenOrientationServiceImpl is per-RenderFrameHost, as opposed to ScreenOrientationDispatcherHostImpl's being per-WebContents. This change is due to the fact that the connection established from the renderer is a per-render frame connection. As a result, ScreenOrientationServiceImpl does not have to do the muxing of RenderFrameHosts that ScreenOrientationDispatcherHostImpl did. - A new ScreenOrientationContext is introduced to provide the per-WebContents screen orientation context that ScreenOrientationServiceImpl requires (e.g., notification of a change in screen orientation). - Request IDs no longer have to be passed from the renderer to the browser, as the renderer binds the request ID associated with a request in the response callback that it creates for the request. This CL does not attempt to decouple the screen orientation service from // content. Decoupling ScreenOrientationServiceImpl, ScreenOrientationProvider, and ScreenOrientationContext will be relatively easy: it will just require some fiddling so that ScreenOrientationProvider::Create() no longer needs to take a WebContents. Decoupling ScreenOrientationProviderAndroid will be an interesting exercise, as it looks like there are some real dependencies on //content that will need to be injected. TEST=Test that websites using the screen orientation API can still correctly lock/unlock the screen orientation on Android.

Patch Set 1 #

Patch Set 2 : nits #

Patch Set 3 : Use service for IPC #

Patch Set 4 : Fixes #

Patch Set 5 : Fixes #

Patch Set 6 : Fix #

Total comments: 2

Patch Set 7 : Fix #

Total comments: 4

Patch Set 8 : Ifdef out test to be able to run trybots #

Patch Set 9 : Clang fixes #

Patch Set 10 : Response to review, port unittest #

Total comments: 5

Patch Set 11 : Upload chromium.ycm_extra_conf.py change #

Patch Set 12 : Eliminate ScreenOrientationContext #

Patch Set 13 : Nits #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+460 lines, -457 lines) Patch
M content/browser/android/content_view_core_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +4 lines, -3 lines 0 comments Download
M content/browser/frame_host/render_frame_host_delegate.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
M content/browser/frame_host/render_frame_host_delegate.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +5 lines, -0 lines 0 comments Download
M content/browser/frame_host/render_frame_host_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
D content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.h View 1 2 1 chunk +0 lines, -70 lines 0 comments Download
D content/browser/screen_orientation/screen_orientation_dispatcher_host_impl.cc View 1 2 1 chunk +0 lines, -138 lines 0 comments Download
M content/browser/screen_orientation/screen_orientation_provider_android.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +16 lines, -13 lines 0 comments Download
M content/browser/screen_orientation/screen_orientation_provider_android.cc View 1 2 3 4 5 6 7 8 9 10 11 7 chunks +28 lines, -32 lines 1 comment Download
A content/browser/screen_orientation/screen_orientation_service_impl.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +42 lines, -0 lines 0 comments Download
A content/browser/screen_orientation/screen_orientation_service_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +64 lines, -0 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.h View 1 2 3 4 5 6 7 8 9 10 11 4 chunks +2 lines, -7 lines 0 comments Download
M content/browser/web_contents/web_contents_impl.cc View 1 2 3 4 5 6 7 8 9 10 11 6 chunks +13 lines, -9 lines 0 comments Download
M content/common/BUILD.gn View 1 2 3 4 5 1 chunk +2 lines, -0 lines 0 comments Download
A content/common/screen_orientation_service.mojom View 1 2 1 chunk +15 lines, -0 lines 0 comments Download
A content/common/screen_orientation_utils.h View 1 2 3 1 chunk +23 lines, -0 lines 0 comments Download
A content/common/screen_orientation_utils.cc View 1 2 1 chunk +67 lines, -0 lines 0 comments Download
M content/content_browser.gypi View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +2 lines, -3 lines 0 comments Download
M content/content_common.gypi View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
M content/content_common_mojo_bindings.gypi View 1 2 1 chunk +2 lines, -0 lines 0 comments Download
D content/public/browser/screen_orientation_dispatcher_host.h View 1 2 1 chunk +0 lines, -36 lines 0 comments Download
M content/public/browser/screen_orientation_provider.h View 1 2 3 4 5 6 7 8 9 10 11 3 chunks +12 lines, -10 lines 0 comments Download
A content/public/common/screen_orientation.mojom View 1 2 1 chunk +33 lines, -0 lines 0 comments Download
M content/renderer/render_frame_impl.h View 1 2 3 4 5 6 7 8 9 3 chunks +5 lines, -1 line 0 comments Download
M content/renderer/render_frame_impl.cc View 1 2 3 4 5 6 7 8 9 2 chunks +7 lines, -3 lines 0 comments Download
M content/renderer/screen_orientation/screen_orientation_dispatcher.h View 1 2 3 4 5 6 7 8 9 3 chunks +8 lines, -10 lines 0 comments Download
M content/renderer/screen_orientation/screen_orientation_dispatcher.cc View 1 2 3 4 5 6 7 8 9 2 chunks +33 lines, -32 lines 0 comments Download
M content/renderer/screen_orientation/screen_orientation_dispatcher_unittest.cc View 1 2 3 4 5 6 7 8 9 6 chunks +65 lines, -90 lines 0 comments Download

Messages

Total messages: 10 (3 generated)
blundell
mlamouri, qsr, darin: for review. timvolodine: FYI. jonross: FYI. I won't land this without coordinating ...
6 years, 3 months ago (2014-09-18 09:52:46 UTC) #3
qsr
https://codereview.chromium.org/549603003/diff/140001/content/browser/screen_orientation/screen_orientation_service_impl.h File content/browser/screen_orientation/screen_orientation_service_impl.h (right): https://codereview.chromium.org/549603003/diff/140001/content/browser/screen_orientation/screen_orientation_service_impl.h#newcode31 content/browser/screen_orientation/screen_orientation_service_impl.h:31: // ScreenOrientationContext: ScreenOrientationContext::Observer ?
6 years, 3 months ago (2014-09-18 13:23:01 UTC) #4
blundell
I ported the ScreenOrientationDispatcher unittest to the new world. mounir, darin: friendly ping. https://codereview.chromium.org/549603003/diff/140001/content/browser/screen_orientation/screen_orientation_service_impl.h File ...
6 years, 3 months ago (2014-09-22 11:37:13 UTC) #6
qsr
https://codereview.chromium.org/549603003/diff/140001/content/browser/android/content_view_core_impl.cc File content/browser/android/content_view_core_impl.cc (right): https://codereview.chromium.org/549603003/diff/140001/content/browser/android/content_view_core_impl.cc#newcode1258 content/browser/android/content_view_core_impl.cc:1258: ->screen_orientation_context() The -> should be on the previous line. ...
6 years, 3 months ago (2014-09-22 13:01:48 UTC) #7
blundell
https://codereview.chromium.org/549603003/diff/220001/content/browser/screen_orientation/screen_orientation_service_impl.cc File content/browser/screen_orientation/screen_orientation_service_impl.cc (right): https://codereview.chromium.org/549603003/diff/220001/content/browser/screen_orientation/screen_orientation_service_impl.cc#newcode24 content/browser/screen_orientation/screen_orientation_service_impl.cc:24: provider_(ScreenOrientationProvider::Create( On 2014/09/22 13:01:48, qsr wrote: > As discussed ...
6 years, 3 months ago (2014-09-22 13:21:54 UTC) #8
blundell
I went ahead and implemented qsr's suggestion to have the ScreenOrientationProvider be per-WebContents instead of ...
6 years, 3 months ago (2014-09-23 07:07:01 UTC) #9
qsr
6 years, 3 months ago (2014-09-23 08:23:00 UTC) #10
https://chromiumcodereview.appspot.com/549603003/diff/280001/content/browser/...
File content/browser/screen_orientation/screen_orientation_provider_android.cc
(right):

https://chromiumcodereview.appspot.com/549603003/diff/280001/content/browser/...
content/browser/screen_orientation/screen_orientation_provider_android.cc:103:
if (LockMatchesCurrentOrientation(pending_lock_orientation_)) {
I don't understand exactly why we need this. If we can receive this message for
other reason than the request, then we can randomly get the right orientation,
so this might be true for another reason than the request. In the end, given the
way concurrent request can happen, I'm wondering why we don't just respond with
a success just after sending the request to the system. Given that a lock can be
overridden by a concurrent frame the ms after it succeeds, trying to return an
error for this case seems a lot of work for no benefit. What am I missing?

 Mounir, do you remember why we do it this way?

Powered by Google App Engine
This is Rietveld 408576698