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

Unified Diff: ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc

Issue 1309273005: native_viewport support for ozone (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: addressing review feedback Created 5 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc
diff --git a/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc b/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..f28872c591bd96080224965b8d9e5b0385cd668c
--- /dev/null
+++ b/ui/ozone/platform/drm/mojo/drm_ipc_init_helper.cc
@@ -0,0 +1,87 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "mojo/public/cpp/application/application_connection.h"
+#include "mojo/public/cpp/application/interface_factory_impl.h"
+#include "mojo/services/ozone_drm_gpu/public/interfaces/ozone_drm_gpu.mojom.h"
+#include "mojo/services/ozone_drm_host/public/interfaces/ozone_drm_host.mojom.h"
+#include "ui/ozone/platform/drm/mojo/drm_gpu_delegate.h"
+#include "ui/ozone/platform/drm/mojo/drm_gpu_impl.h"
+#include "ui/ozone/platform/drm/mojo/drm_host_delegate.h"
+#include "ui/ozone/platform/drm/mojo/drm_host_impl.h"
+#include "ui/ozone/public/ipc_init_helper_mojo.h"
+
+namespace ui {
+
+class InterfaceFactoryDrmHost
+ : public mojo::InterfaceFactory<mojo::OzoneDrmHost> {
+ // mojo::InterfaceFactory implementation.
+ void Create(mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::OzoneDrmHost> request) override;
+};
+
+class InterfaceFactoryDrmGpu
+ : public mojo::InterfaceFactory<mojo::OzoneDrmGpu> {
+ // mojo::InterfaceFactory<OzoneDrmGpu> implementation.
+ void Create(mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::OzoneDrmGpu> request) override;
+};
+
+void InterfaceFactoryDrmHost::Create(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::OzoneDrmHost> request) {
+ new MojoDrmHostImpl(request.Pass());
+}
+
+void InterfaceFactoryDrmGpu::Create(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::OzoneDrmGpu> request) {
+ new MojoDrmGpuImpl(request.Pass());
+}
+
+class DrmIpcInitHelperMojo : public IpcInitHelperMojo {
+ public:
jamesr 2015/08/27 19:35:48 is this just default-constructed? might be useful
cdotstout 2015/08/27 21:28:34 Yes. Done.
+ void HostInitialize(mojo::ApplicationImpl* application) override;
+ bool HostConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) override;
+
+ void GpuInitialize(mojo::ApplicationImpl* application) override;
+ bool GpuConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) override;
+
+ private:
+ mojo::OzoneDrmHostPtr ozone_drm_host_;
+ mojo::OzoneDrmGpuPtr ozone_drm_gpu_;
+};
+
+void DrmIpcInitHelperMojo::HostInitialize(mojo::ApplicationImpl* application) {
+ application->ConnectToService("mojo:native_viewport_service",
+ &ozone_drm_gpu_);
+ new MojoDrmHostDelegate(ozone_drm_gpu_.get());
+}
+
+void DrmIpcInitHelperMojo::GpuInitialize(mojo::ApplicationImpl* application) {
+ application->ConnectToService("mojo:native_viewport_service",
+ &ozone_drm_host_);
+ new MojoDrmGpuDelegate(ozone_drm_host_.get());
+}
+
+bool DrmIpcInitHelperMojo::HostConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) {
+ connection->AddService<mojo::OzoneDrmHost>(new InterfaceFactoryDrmHost());
+ return true;
+}
+
+bool DrmIpcInitHelperMojo::GpuConfigureIncomingConnection(
+ mojo::ApplicationConnection* connection) {
+ connection->AddService<mojo::OzoneDrmGpu>(new InterfaceFactoryDrmGpu());
+ return true;
+}
+
+// static
+IpcInitHelperOzone* IpcInitHelperOzone::Create() {
+ return new DrmIpcInitHelperMojo();
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698