Add support to the UI Service to run it insider browser's process

Desktop / Chromium - mfomitchev [chromium.org] - 13 July 2017 18:53 EDT

When UI Service runs inside the browser process in its own separate thread, there is a few things it needs to do differently:

1. It shouldn't set its Screen as a global singleton. 2. It shouldn't set its ClientNativePixmapFactory as a global singleton. 3. It can't access the ResourceBundle from its own thread - that can only be done from the browser thread.

The third point is the source of most of the complexity in this CL. UI Service needs to manipulate the cursor, which is done through the ui::ImageCursors object, which needs to load resources. Since resources can't be loaded on the UI Service's thread, a mechanism is introduced to let the UI Service do this by posting tasks to the browser's thread task runner, which is passed into the UI Service's constructor.

This CL doesn't contain browser-side changes to run the UI Service in-process.

BUG=722527

Review-Url: https://codereview.chromium.org/2979933002 Cr-Commit-Position: refs/heads/master@{#486509}

04cdb92 Add support to the UI Service to run it insider browser's process.
services/ui/common/BUILD.gn | 2 +
services/ui/common/image_cursors_set.cc | 37 ++++++
services/ui/common/image_cursors_set.h | 37 ++++++
services/ui/display/screen_manager_forwarding.cc | 11 +-
services/ui/display/screen_manager_forwarding.h | 12 +-
services/ui/main.cc | 2 +-
services/ui/service.cc | 78 ++++++++++--
services/ui/service.h | 36 +++++-
services/ui/ws/BUILD.gn | 3 +
services/ui/ws/display.cc | 3 +-
services/ui/ws/platform_display.cc | 8 +-
services/ui/ws/platform_display.h | 4 +-
services/ui/ws/platform_display_default.cc | 26 ++--
services/ui/ws/platform_display_default.h | 7 +-
.../ui/ws/platform_display_default_unittest.cc | 13 +-
services/ui/ws/test_utils.cc | 34 +++++-
services/ui/ws/test_utils.h | 2 +
services/ui/ws/threaded_image_cursors.cc | 134 +++++++++++++++++++++
services/ui/ws/threaded_image_cursors.h | 93 ++++++++++++++
services/ui/ws/threaded_image_cursors_factory.h | 23 ++++
services/ui/ws/user_display_manager.cc | 21 ++--
services/ui/ws/window_server.cc | 4 +
services/ui/ws/window_server.h | 3 +
services/ui/ws/window_server_delegate.h | 3 +
24 files changed, 552 insertions(+), 44 deletions(-)

Upstream: git.chromium.org


  • Share