Commit a872e762 authored by mfomitchev's avatar mfomitchev Committed by Commit Bot

Make chrome --mus run the UI Service inside the browser process.

This CL takes advantage of the mechanisms introduced in
https://codereview.chromium.org/2979933002/ to run the UI Service inside the
browser process in Mushrome (i.e. when chrome is launched with --mus parameter).

UI Service runs on a separate thread with high priority. For now both the UI
Service and the GPU Service are moved. Once WS/GPU split if finished, GPU will
need to be moved into its separate process.

CrOS BrowserProcessPlatformPart owns the ImageCursorsSet used by the UI Service
for cursor manipulation.

BUG=722527

Review-Url: https://codereview.chromium.org/2983443002
Cr-Commit-Position: refs/heads/master@{#486688}
parent 397fe70f
......@@ -408,7 +408,10 @@ service_manifest("chrome_content_packaged_services_manifest_overlay") {
"//chrome/browser/chrome_content_packaged_services_manifest_overlay.json"
packaged_services = chrome_packaged_services
if (is_chromeos) {
packaged_services += [ "//ash/mus:manifest" ]
packaged_services += [
"//ash/mus:manifest",
"//services/ui:manifest",
]
}
}
......
......@@ -122,8 +122,6 @@ if (is_chromeos) {
catalog("catalog_mus") {
catalog_deps = [ "//chrome/app:catalog" ]
embedded_services = [
"//services/ui:manifest",
# TODO(sky): verify if we need this.
"//services/ui/ime/test_ime_driver:manifest",
]
......
......@@ -53,7 +53,9 @@ include_rules = [
"+services/resource_coordinator/public/interfaces/memory_instrumentation",
"+services/service_manager",
"+services/shape_detection/public/interfaces",
"+services/ui/common",
"+services/ui/public",
"+services/ui/service.h",
"+skia/ext",
"+third_party/boringssl/src/include",
"+third_party/crashpad",
......
......@@ -44,6 +44,7 @@
#include "services/service_manager/public/cpp/interface_provider.h"
#include "services/service_manager/public/cpp/service.h"
#include "services/ui/public/interfaces/constants.mojom.h"
#include "services/ui/service.h"
#if defined(USE_OZONE)
#include "content/public/common/service_manager_connection.h"
......@@ -129,6 +130,15 @@ class ChromeServiceChromeOS : public service_manager::Service,
DISALLOW_COPY_AND_ASSIGN(ChromeServiceChromeOS);
};
std::unique_ptr<service_manager::Service> CreateEmbeddedUIService(
const scoped_refptr<base::SingleThreadTaskRunner>& task_runner,
base::WeakPtr<ui::ImageCursorsSet> image_cursors_set_weak_ptr) {
ui::Service::InProcessConfig config;
config.resource_runner = task_runner;
config.image_cursors_set_weak_ptr = image_cursors_set_weak_ptr;
return base::MakeUnique<ui::Service>(&config);
}
} // namespace
BrowserProcessPlatformPart::BrowserProcessPlatformPart()
......@@ -274,6 +284,17 @@ void BrowserProcessPlatformPart::RegisterInProcessServices(
info.task_runner = base::ThreadTaskRunnerHandle::Get();
services->insert(std::make_pair(ash::mojom::kServiceName, info));
}
if (chromeos::GetAshConfig() == ash::Config::MUS) {
service_manager::EmbeddedServiceInfo info;
info.factory = base::Bind(&CreateEmbeddedUIService,
base::ThreadTaskRunnerHandle::Get(),
image_cursors_set_.GetWeakPtr());
info.use_own_thread = true;
info.message_loop_type = base::MessageLoop::TYPE_UI;
info.thread_priority = base::ThreadPriority::DISPLAY;
services->insert(std::make_pair(ui::mojom::kServiceName, info));
}
}
chromeos::system::SystemClock* BrowserProcessPlatformPart::GetSystemClock() {
......
......@@ -13,6 +13,7 @@
#include "base/macros.h"
#include "base/sequence_checker.h"
#include "chrome/browser/browser_process_platform_part_base.h"
#include "services/ui/common/image_cursors_set.h"
namespace chromeos {
class ChromeSessionManager;
......@@ -140,6 +141,9 @@ class BrowserProcessPlatformPart : public BrowserProcessPlatformPartBase {
base::flat_set<std::string> compatible_cros_components_;
// Used by the UI Service.
ui::ImageCursorsSet image_cursors_set_;
#if defined(USE_OZONE)
std::unique_ptr<ui::InputDeviceControllerClient>
input_device_controller_client_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment