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

Issue 2916823002: Move Mus into chrome's process when running with --mus.

Created:
3 years, 6 months ago by mfomitchev
Modified:
3 years, 5 months ago
Reviewers:
sadrul, Elliot Glaysher, sky
CC:
chromium-reviews, rjkroege, sadrul, tfarina, jam, darin-cc_chromium.org, piman+watch_chromium.org, kalyank
Target Ref:
refs/heads/master
Project:
chromium
Visibility:
Public.

Description

Move Mus into browser process when running with --mus. Moves Mus into browser process when running Mustash (chrome --mus). Window Server is running on its own thread with ThreadPriority::DISPLAY when running in browser process. For now both WS and GPU are moved. Once WS/GPU split if finished, GPU will need to be moved into its separate process. A lot of this CL is fixing up various singletons to work when Mus is running in-process. For example, CursorFactoryOzone and InputDeviceManage are made thread-local instead of global singletons, because both Mus and ash/chrome need an instance. Another significant aspect of this CL is making cursors work when Mus is running in-process. Cursor manipulation requires loading resources from a ResourceBundle, which can only happen on the browser thread. As such, Mus creates ui::ImageCursors objects for its displays, but the ownership is then passed to the browser thread, and all manipulation of these objects is subsequently also done on the browser thread via Mus posting tasks. BUG=722527

Patch Set 1 #

Patch Set 2 : Some comments and cleanup. #

Patch Set 3 : Addressing most feedback, making this work on device. #

Total comments: 13

Patch Set 4 : Thread-safety #

Patch Set 5 : Comments, cleanup #

Patch Set 6 : More cleanup and fixing WS tests. #

Patch Set 7 : Rebase #

Patch Set 8 : Missed ifdef #

Patch Set 9 : More ifdefs #

Patch Set 10 : Undo Screen TLS change, don't use Screen::GetScreen() in Mus. #

Total comments: 40

Patch Set 11 : Addressing feedback, fixing the cursor issue, rebase. #

Patch Set 12 : Some comments #

Patch Set 13 : Multi-display support. #

Patch Set 14 : Rebase on top of https://codereview.chromium.org/2978833002/ #

Patch Set 15 : Fix Android build #

Patch Set 16 : Merge https://codereview.chromium.org/2976923002 in for now. #

Patch Set 17 : Missing include for Android, Windows #

Patch Set 18 : Fixing non-ozone CrOS build #

Patch Set 19 : Turning PlatformEventSource into a thread-local singleton #

Patch Set 20 : Removing debug include. #

Unified diffs Side-by-side diffs Delta from patch set Stats (+768 lines, -195 lines) Patch
M chrome/app/BUILD.gn View 1 2 1 chunk +4 lines, -1 line 0 comments Download
M chrome/app/mash/BUILD.gn View 1 2 1 chunk +0 lines, -2 lines 0 comments Download
M chrome/app/mash/embedded_services.cc View 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M chrome/browser/DEPS View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_platform_part_base.h View 1 2 3 4 5 6 7 8 9 10 11 2 chunks +5 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_platform_part_base.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M chrome/browser/browser_process_platform_part_chromeos.h View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +6 lines, -1 line 0 comments Download
M chrome/browser/browser_process_platform_part_chromeos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 3 chunks +143 lines, -1 line 0 comments Download
M chrome/browser/chrome_content_browser_client.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 9 chunks +2 lines, -121 lines 0 comments Download
M services/ui/common/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +2 lines, -0 lines 0 comments Download
A services/ui/common/image_cursors_set.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +36 lines, -0 lines 0 comments Download
A services/ui/common/image_cursors_set.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +37 lines, -0 lines 0 comments Download
M services/ui/display/screen_manager_forwarding.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +11 lines, -1 line 0 comments Download
M services/ui/display/screen_manager_forwarding.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +7 lines, -4 lines 0 comments Download
M services/ui/gpu/gpu_main.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M services/ui/gpu/gpu_main.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +8 lines, -1 line 0 comments Download
M services/ui/main.cc View 3 4 5 6 7 8 9 10 1 chunk +1 line, -1 line 0 comments Download
M services/ui/public/cpp/gpu/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 1 chunk +0 lines, -1 line 0 comments Download
M services/ui/service.h View 1 2 3 4 5 6 7 8 9 10 11 12 6 chunks +32 lines, -2 lines 0 comments Download
M services/ui/service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 12 chunks +78 lines, -8 lines 0 comments Download
M services/ui/ws/BUILD.gn View 1 2 3 4 5 6 7 8 9 10 1 chunk +3 lines, -0 lines 0 comments Download
M services/ui/ws/display.cc View 1 2 3 4 5 6 7 8 9 10 1 chunk +2 lines, -1 line 0 comments Download
M services/ui/ws/platform_display.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -1 line 0 comments Download
M services/ui/ws/platform_display.cc View 1 2 3 4 5 6 7 8 9 10 3 chunks +5 lines, -3 lines 0 comments Download
M services/ui/ws/platform_display_default.h View 1 2 3 4 5 6 3 chunks +4 lines, -3 lines 0 comments Download
M services/ui/ws/platform_display_default.cc View 1 2 3 4 5 6 7 8 9 10 6 chunks +15 lines, -11 lines 0 comments Download
M services/ui/ws/platform_display_default_unittest.cc View 1 2 3 4 5 6 7 8 9 10 11 12 3 chunks +11 lines, -2 lines 0 comments Download
M services/ui/ws/test_utils.h View 1 2 3 4 5 6 7 8 9 10 11 12 2 chunks +2 lines, -0 lines 0 comments Download
M services/ui/ws/test_utils.cc View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +33 lines, -1 line 0 comments Download
A services/ui/ws/threaded_image_cursors.h View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +87 lines, -0 lines 0 comments Download
A services/ui/ws/threaded_image_cursors.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +134 lines, -0 lines 0 comments Download
A services/ui/ws/threaded_image_cursors_factory.h View 1 2 3 4 5 6 7 8 9 10 1 chunk +23 lines, -0 lines 0 comments Download
M services/ui/ws/user_display_manager.cc View 1 2 3 4 5 6 7 8 9 4 chunks +14 lines, -7 lines 0 comments Download
M services/ui/ws/window_server.h View 1 2 3 4 5 6 7 8 9 10 11 12 4 chunks +5 lines, -1 line 0 comments Download
M services/ui/ws/window_server.cc View 1 2 3 4 5 6 7 8 9 10 11 12 1 chunk +4 lines, -0 lines 0 comments Download
M services/ui/ws/window_server_delegate.h View 1 2 3 4 5 6 7 8 9 10 2 chunks +3 lines, -0 lines 0 comments Download
M ui/events/devices/input_device_manager.h View 1 2 3 2 chunks +3 lines, -3 lines 0 comments Download
M ui/events/devices/input_device_manager.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +17 lines, -7 lines 0 comments Download
M ui/events/platform/platform_event_source.h View 1 2 3 11 12 13 14 15 16 17 18 3 chunks +2 lines, -2 lines 0 comments Download
M ui/events/platform/platform_event_source.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +19 lines, -7 lines 0 comments Download

Depends on Patchset:

Messages

Total messages: 94 (58 generated)
mfomitchev
3 years, 6 months ago (2017-06-01 03:19:11 UTC) #3
sky
I added comments to your doc. Let me know if you think it's worth still ...
3 years, 6 months ago (2017-06-01 18:10:08 UTC) #5
mfomitchev
I uploaded a new patch. It still requires work, but can you PTAL at services/ui/ws/threaded_image_cursors.* ...
3 years, 6 months ago (2017-06-19 19:13:36 UTC) #6
sky
+erg as he has been looking at cursors. https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h File services/ui/service.h (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h#newcode70 services/ui/service.h:70: Service(scoped_refptr<base::SingleThreadTaskRunner> ...
3 years, 6 months ago (2017-06-19 21:25:47 UTC) #8
Elliot Glaysher
https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h File services/ui/service.h (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h#newcode70 services/ui/service.h:70: Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner); On 2017/06/19 21:25:47, sky wrote: > Rather ...
3 years, 6 months ago (2017-06-19 21:46:43 UTC) #9
mfomitchev
https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h File services/ui/service.h (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h#newcode70 services/ui/service.h:70: Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner); On 2017/06/19 21:25:47, sky wrote: > Rather ...
3 years, 6 months ago (2017-06-19 21:50:20 UTC) #10
sky
https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h File services/ui/service.h (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h#newcode70 services/ui/service.h:70: Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner); On 2017/06/19 21:50:19, mfomitchev wrote: > On ...
3 years, 6 months ago (2017-06-20 16:07:09 UTC) #11
mfomitchev
https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h File services/ui/service.h (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/service.h#newcode70 services/ui/service.h:70: Service(scoped_refptr<base::SingleThreadTaskRunner> resource_runner); On 2017/06/20 16:07:09, sky wrote: > On ...
3 years, 6 months ago (2017-06-20 17:00:42 UTC) #12
sky
Elliot and myself spoke about this and feel that this isn't a lot of data, ...
3 years, 6 months ago (2017-06-20 19:15:04 UTC) #13
mfomitchev
Would you mind explaining why you feel that the approach in this CL is less ...
3 years, 6 months ago (2017-06-20 19:51:16 UTC) #14
Elliot Glaysher
On 2017/06/20 19:51:16, mfomitchev wrote: > Would you mind explaining why you feel that the ...
3 years, 6 months ago (2017-06-20 20:16:47 UTC) #15
sky
Generally the smaller the code the less complex it is and the easier it is ...
3 years, 6 months ago (2017-06-20 20:21:18 UTC) #16
mfomitchev
@sky: I think the preload route will be more code. The new cursor code right ...
3 years, 6 months ago (2017-06-20 21:41:52 UTC) #17
sky
Ok, you convinced me, go with what you have here. -Scott On Tue, Jun 20, ...
3 years, 6 months ago (2017-06-20 21:55:37 UTC) #18
sky
https://codereview.chromium.org/2916823002/diff/40001/services/ui/ws/threaded_image_cursors.cc File services/ui/ws/threaded_image_cursors.cc (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/ws/threaded_image_cursors.cc#newcode23 services/ui/ws/threaded_image_cursors.cc:23: if (task_runner_) { WDYT of *always* using a task ...
3 years, 6 months ago (2017-06-20 22:33:13 UTC) #19
sky
On 2017/06/20 22:33:13, sky wrote: > https://codereview.chromium.org/2916823002/diff/40001/services/ui/ws/threaded_image_cursors.cc > File services/ui/ws/threaded_image_cursors.cc (right): > > https://codereview.chromium.org/2916823002/diff/40001/services/ui/ws/threaded_image_cursors.cc#newcode23 > ...
3 years, 6 months ago (2017-06-20 22:34:00 UTC) #20
mfomitchev
https://codereview.chromium.org/2916823002/diff/40001/services/ui/ws/threaded_image_cursors.cc File services/ui/ws/threaded_image_cursors.cc (right): https://codereview.chromium.org/2916823002/diff/40001/services/ui/ws/threaded_image_cursors.cc#newcode23 services/ui/ws/threaded_image_cursors.cc:23: if (task_runner_) { On 2017/06/20 22:33:13, sky wrote: > ...
3 years, 6 months ago (2017-06-21 21:22:51 UTC) #21
sky
This looks reasonable to me now. You mention this as WIP and there is still ...
3 years, 6 months ago (2017-06-22 00:50:53 UTC) #22
mfomitchev
Does it make sense to not execute any code in Service::InitializeResources() in the in-process case? ...
3 years, 6 months ago (2017-06-22 22:27:41 UTC) #23
sky
On Thu, Jun 22, 2017 at 3:27 PM, <mfomitchev@chromium.org> wrote: > Does it make sense ...
3 years, 6 months ago (2017-06-23 03:23:22 UTC) #24
mfomitchev
Other than the remaining CursorFactoryOzone conflict with Ash, this should be good now.
3 years, 5 months ago (2017-06-27 16:02:30 UTC) #45
sky
https://codereview.chromium.org/2916823002/diff/180001/chrome/browser/chrome_content_browser_client.cc File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2916823002/diff/180001/chrome/browser/chrome_content_browser_client.cc#newcode3050 chrome/browser/chrome_content_browser_client.cc:3050: if (!image_cursors_) Is this conditional necessary? We're starting to ...
3 years, 5 months ago (2017-06-27 19:58:57 UTC) #48
mfomitchev
Just answering a couple of questions, I will address the rest of the comments in ...
3 years, 5 months ago (2017-06-27 22:14:55 UTC) #49
sky
https://codereview.chromium.org/2916823002/diff/180001/ui/events/devices/input_device_manager.cc File ui/events/devices/input_device_manager.cc (right): https://codereview.chromium.org/2916823002/diff/180001/ui/events/devices/input_device_manager.cc#newcode14 ui/events/devices/input_device_manager.cc:14: base::LazyInstance<base::ThreadLocalPointer<InputDeviceManager>>::Leaky On 2017/06/27 22:14:55, mfomitchev wrote: > On 2017/06/27 ...
3 years, 5 months ago (2017-06-28 00:22:02 UTC) #50
mfomitchev
https://codereview.chromium.org/2916823002/diff/180001/ui/events/platform/platform_event_source.cc File ui/events/platform/platform_event_source.cc (right): https://codereview.chromium.org/2916823002/diff/180001/ui/events/platform/platform_event_source.cc#newcode23 ui/events/platform/platform_event_source.cc:23: base::LazyInstance<base::ThreadLocalPointer<PlatformEventSource>>::Leaky On 2017/06/28 00:22:02, sky wrote: > On 2017/06/27 ...
3 years, 5 months ago (2017-06-28 15:56:32 UTC) #51
mfomitchev
https://codereview.chromium.org/2916823002/diff/180001/chrome/browser/chrome_content_browser_client.cc File chrome/browser/chrome_content_browser_client.cc (right): https://codereview.chromium.org/2916823002/diff/180001/chrome/browser/chrome_content_browser_client.cc#newcode3050 chrome/browser/chrome_content_browser_client.cc:3050: if (!image_cursors_) On 2017/06/27 19:58:56, sky OOO wrote: > ...
3 years, 5 months ago (2017-07-11 21:47:00 UTC) #54
sky
On 2017/07/11 21:47:00, mfomitchev wrote: > https://codereview.chromium.org/2916823002/diff/180001/chrome/browser/chrome_content_browser_client.cc > File chrome/browser/chrome_content_browser_client.cc (right): > > https://codereview.chromium.org/2916823002/diff/180001/chrome/browser/chrome_content_browser_client.cc#newcode3050 > ...
3 years, 5 months ago (2017-07-11 22:16:44 UTC) #58
chromium-reviews
https://codereview.chromium.org/2961403002/ was actually based on this CL ( https://codereview.chromium.org/2916823002/). I can split out the ozone ...
3 years, 5 months ago (2017-07-11 22:35:23 UTC) #59
mfomitchev
PTAL. Added multi-display support. Next going to factor out the ozone changes, and work on ...
3 years, 5 months ago (2017-07-12 18:11:59 UTC) #61
sky
Can you separate the parts out now that are ready into it's own patch? On ...
3 years, 5 months ago (2017-07-12 19:25:24 UTC) #68
mfomitchev
On 2017/07/12 19:25:24, sky wrote: > Can you separate the parts out now that are ...
3 years, 5 months ago (2017-07-12 19:41:11 UTC) #69
mfomitchev
https://codereview.chromium.org/2916823002/diff/180001/ui/events/platform/platform_event_source.cc File ui/events/platform/platform_event_source.cc (right): https://codereview.chromium.org/2916823002/diff/180001/ui/events/platform/platform_event_source.cc#newcode23 ui/events/platform/platform_event_source.cc:23: base::LazyInstance<base::ThreadLocalPointer<PlatformEventSource>>::Leaky On 2017/06/28 15:56:32, mfomitchev wrote: > On 2017/06/28 ...
3 years, 5 months ago (2017-07-12 20:37:13 UTC) #70
sky
We only want PlatformEventSource used from mus, right? In that case I don't think you ...
3 years, 5 months ago (2017-07-12 22:33:40 UTC) #77
mfomitchev
It's okay for classic ash to use PlatformEventSource though (e.g. via UserActivityDetector). The flow which ...
3 years, 5 months ago (2017-07-12 22:59:13 UTC) #80
mfomitchev
Most of the bots seem happy now. I am going to break this up into ...
3 years, 5 months ago (2017-07-13 01:30:00 UTC) #91
sky
3 years, 5 months ago (2017-07-13 17:02:13 UTC) #94
On Wed, Jul 12, 2017 at 3:59 PM, <mfomitchev@chromium.org> wrote:

> It's okay for classic ash to use PlatformEventSource though (e.g. via
> UserActivityDetector). The flow which is causing use a problem with
> in-process
> Mus would be WAI with classic Ash. Note that this flow is broken for
> out-of-process Mus, but it's not noticeable because UserActivityDetector
> has
> null checks:
> https://cs-staging.chromium.org/chromium/src/ui/base/user_
> activity/user_activity_detector.cc?type=cs&sq=package:chromium&l=56
>
> The right way to fix this could be to create a client-side
> PlatformEventSource,
> similar to what we have for InputDeviceManager:
> https://cs.chromium.org/chromium/src/chrome/browser/
> ui/views/chrome_browser_main_extra_parts_views.cc?type=cs&
> q=inputdeviceclient&l=164
> Or create a Mus version of UserActivityDetector talking with the UI
> Service over
> Mojo.
>
> For now though making PlatformEventSource TLS seems like an okay stop gap?
>

SGTM

  -Scott


>
>
> On 2017/07/12 22:33:40, sky wrote:
> > We only want PlatformEventSource used from mus, right? In that case I
> don't
> > think you need a TLS, you just need to make sure PlatformEventSource is
> > only used on mus's thread. How about making it so that ash hits a CHECK
> if
> > it attempts to use PlatformEventObserver? Maybe adding a thread check in
> > PlatformEventSource and having mus call a setter so that
> PlatformEventSource
> > knows the only thread it should be used in?
> >
> > -Scott
> >
> > On Wed, Jul 12, 2017 at 1:37 PM, <mailto:mfomitchev@chromium.org> wrote:
> >
> > >
> > > https://codereview.chromium.org/2916823002/diff/180001/ui/
> > > events/platform/platform_event_source.cc
> > > File ui/events/platform/platform_event_source.cc (right):
> > >
> > > https://codereview.chromium.org/2916823002/diff/180001/ui/
> > > events/platform/platform_event_source.cc#newcode23
> > > ui/events/platform/platform_event_source.cc:23:
> > > base::LazyInstance<base::ThreadLocalPointer<
> PlatformEventSource>>::Leaky
> > > On 2017/06/28 15:56:32, mfomitchev wrote:
> > > > On 2017/06/28 00:22:02, sky wrote:
> > > > > On 2017/06/27 22:14:55, mfomitchev wrote:
> > > > > > On 2017/06/27 19:58:57, sky wrote:
> > > > > > > Same comment here. What code in chrome/ash is making use of
> > > this?
> > > > > >
> > > > > > Aura does it:
> > > > > >
> > > > >
> > > >
> > > https://cs.chromium.org/chromium/src/ui/aura/env.cc
> > > type=cs&q=PlatformEventSource&sq=package:chromium&l=180
> > > > >
> > > > > That's only for the LOCAL case. How are we triggering the LOCAL
> case
> > > for
> > > > > mus/mash?
> > > >
> > > > Oops, you are right, this isn't needed. I misread the code. Will
> > > revert this
> > > > back to the way it was.
> > >
> > > I remember now there was another reason I made this TLS. If it's not
> > > TLS, then Ash can execute code on Mus thread by adding
> > > |PlatformEventObserver|s, which doesn't seem good. This also leads to a
> > > concrete issue:
> > >
> > > ui::PlatformEventSource::DispatchEvent ->
> > > ui::UserActivityDetector::DidProcessEvent ->
> > > chromeos::SessionLengthLimiter::OnUserActivity ->
> > > SequenceChecker DCHECK in BrowserProcessImple::local_state()
> > >
> > > Do you think it would be okay to make PlatformEventObserver
> > > thread-local?
> > >
> > > https://codereview.chromium.org/2916823002/
> > >
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Chromium-reviews" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> email
> > to mailto:chromium-reviews+unsubscribe@chromium.org.
>
>
>
> https://codereview.chromium.org/2916823002/
>

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698