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

Unified Diff: ui/ozone/platform/drm/gpu/drm_gpu_platform_support_inprocess.cc

Issue 1285183008: Ozone integration. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: add missing license header 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/gpu/drm_gpu_platform_support_inprocess.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_gpu_platform_support_inprocess.cc b/ui/ozone/platform/drm/gpu/drm_gpu_platform_support_inprocess.cc
new file mode 100644
index 0000000000000000000000000000000000000000..a46748045e7615c91f3bea63e02275360b3253b3
--- /dev/null
+++ b/ui/ozone/platform/drm/gpu/drm_gpu_platform_support_inprocess.cc
@@ -0,0 +1,94 @@
+// Copyright 2014 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 "base/bind.h"
+#include "base/location.h"
+#include "ui/ozone/platform/drm/gpu/drm_gpu_display_manager.h"
+#include "ui/ozone/platform/drm/gpu/drm_gpu_platform_support_inprocess.h"
+#include "ui/ozone/public/ozone_platform.h"
+
+namespace ui {
+
+DrmGpuPlatformSupportInprocess::DrmGpuPlatformSupportInprocess()
+ : platform_support_(static_cast<ui::DrmGpuPlatformSupport*>(
+ ui::OzonePlatform::GetInstance()->GetGpuPlatformSupport())) {
+ platform_support_->SetDelegate(this);
+}
+
+DrmGpuPlatformSupportInprocess::~DrmGpuPlatformSupportInprocess() {
+}
+
+void DrmGpuPlatformSupportInprocess::OnChannelEstablished(
+ scoped_refptr<base::SingleThreadTaskRunner> send_runner,
+ base::Callback<void(Message*)> send_callback) {
+
+ send_runner_ = send_runner;
+ send_callback_ = send_callback;
+
+ platform_support_->OnChannelEstablished();
+}
+
+bool DrmGpuPlatformSupportInprocess::OnMessageReceived(const Message& message) {
+ bool handled = true;
+
+ switch (message.id) {
+ case OZONE_GPU_MSG__CREATE_WINDOW:
+ platform_support_->OnCreateWindow(
+ static_cast<const OzoneGpuMsg_CreateWindow*>(&message)->widget);
+ break;
+
+ case OZONE_GPU_MSG__WINDOW_BOUNDS_CHANGED: {
+ auto message_params = static_cast<
+ const OzoneGpuMsg_WindowBoundsChanged*>(&message);
+ platform_support_->OnWindowBoundsChanged(message_params->widget,
+ message_params->bounds);
+ break;
+ }
+
+ case OZONE_GPU_MSG__ADD_GRAPHICS_DEVICE: {
+ auto message_params = static_cast<
+ const OzoneGpuMsg_AddGraphicsDevice*>(&message);
+ platform_support_->OnAddGraphicsDevice(message_params->path,
+ message_params->fd);
+ break;
+ }
+
+ case OZONE_GPU_MSG__REFRESH_NATIVE_DISPLAYS:
+ platform_support_->OnRefreshNativeDisplays();
+ break;
+
+ case OZONE_GPU_MSG__CONFIGURE_NATIVE_DISPLAY: {
+ auto message_params = static_cast<
+ const OzoneGpuMsg_ConfigureNativeDisplay*>(&message);
+ platform_support_->OnConfigureNativeDisplay(
+ message_params->id, message_params->mode, message_params->originhost);
+ break;
+ }
+
+ default:
+ handled = false;
+ }
+
+ return handled;
+}
+
+void DrmGpuPlatformSupportInprocess::UpdateNativeDisplays(
+ const std::vector<DisplaySnapshot_Params>& displays) {
+ Send(new OzoneHostMsg_UpdateNativeDisplays(displays));
+}
+
+void DrmGpuPlatformSupportInprocess::DisplayConfigured(int64_t id,
+ bool result) {
+ Send(new OzoneHostMsg_DisplayConfigured(id, result));
+}
+
+bool DrmGpuPlatformSupportInprocess::Send(Message* message) {
+ if (send_runner_->PostTask(FROM_HERE, base::Bind(send_callback_, message)))
+ return true;
+
+ delete message;
+ return false;
+}
+
+} // namespace
« no previous file with comments | « ui/ozone/platform/drm/gpu/drm_gpu_platform_support_inprocess.h ('k') | ui/ozone/platform/drm/gpu/drm_surface.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698