Index: chrome/browser/chrome_content_browser_client.cc |
diff --git a/chrome/browser/chrome_content_browser_client.cc b/chrome/browser/chrome_content_browser_client.cc |
index a607f6a0e6f464780a2666753cb8b2acdc8e732d..e8185a519d955597d2297c033fba3e072251152d 100644 |
--- a/chrome/browser/chrome_content_browser_client.cc |
+++ b/chrome/browser/chrome_content_browser_client.cc |
@@ -209,6 +209,10 @@ |
#include "services/service_manager/public/cpp/binder_registry.h" |
#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" |
+// TODO: Is this okay? |
+// Note we also do this in chrome/app/mash/embedded_services.cc |
+#include "services/ui/service.h" |
#include "storage/browser/fileapi/external_mount_points.h" |
#include "third_party/WebKit/public/platform/modules/installedapp/installed_app_provider.mojom.h" |
#include "third_party/WebKit/public/platform/modules/webshare/webshare.mojom.h" |
@@ -941,6 +945,12 @@ WebContents* GetWebContents(int render_process_id, int render_frame_id) { |
return WebContents::FromRenderFrameHost(rfh); |
} |
+std::unique_ptr<service_manager::Service> CreateEmbeddedUIService( |
+ const scoped_refptr<base::SingleThreadTaskRunner>& task_runner) { |
+ LOG(ERROR) << "CreateEmbeddedUIService"; |
+ return base::MakeUnique<ui::Service>(task_runner); |
+} |
+ |
#if BUILDFLAG(ENABLE_EXTENSIONS) |
// Returns true if there is is an extension with the same origin as |
// |source_origin| in |opener_render_process_id| with |
@@ -3141,6 +3151,8 @@ void ChromeContentBrowserClient::BindInterfaceRequest( |
void ChromeContentBrowserClient::RegisterInProcessServices( |
StaticServiceMap* services) { |
+ LOG(ERROR) << "ChromeContentBrowserClient::RegisterInProcessServices"; |
+// base::debug::StackTrace().Print(); |
#if BUILDFLAG(ENABLE_MOJO_MEDIA_IN_BROWSER_PROCESS) |
content::ServiceInfo info; |
info.factory = base::Bind(&media::CreateMediaService); |
@@ -3165,11 +3177,26 @@ void ChromeContentBrowserClient::RegisterInProcessServices( |
} |
if (!ash_util::IsRunningInMash()) { |
- content::ServiceInfo info; |
- info.factory = base::Bind(&ash_util::CreateEmbeddedAshService, |
- base::ThreadTaskRunnerHandle::Get()); |
- info.task_runner = base::ThreadTaskRunnerHandle::Get(); |
- services->insert(std::make_pair(ash::mojom::kServiceName, info)); |
+ content::ServiceInfo info_ash; |
+ info_ash.factory = base::Bind(&ash_util::CreateEmbeddedAshService, |
+ base::ThreadTaskRunnerHandle::Get()); |
+ info_ash.task_runner = base::ThreadTaskRunnerHandle::Get(); |
+ services->insert(std::make_pair(ash::mojom::kServiceName, info_ash)); |
+ |
+ // TODO: Note that even if we wanted, we wouldn't be able to run this on the |
+ // UI thread because of WindowTreeClient::WaitForInitialDisplays in AshInit. |
+ // On the other hand, running all interfaces on the other thread is also |
+ // problematic, because resources have to all be loaded on the same thread - |
+ // see CalledOnValidSequence() DCHECKs in ResourceBundle. |
+ // WindowServer loads resources for cursor. |
+ content::ServiceInfo info_ui; |
+ info_ui.factory = base::Bind( |
+ &CreateEmbeddedUIService, |
+ base::ThreadTaskRunnerHandle::Get()); //, window_server_task_runner); |
+ info_ui.use_own_thread = true; |
+ info_ui.message_loop_type = base::MessageLoop::TYPE_UI; |
+ info_ui.thread_priority = base::ThreadPriority::DISPLAY; |
+ services->insert(std::make_pair(ui::mojom::kServiceName, info_ui)); |
} |
#endif // OS_CHROMEOS |
} |