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

Unified Diff: ui/ozone/platform/dri/gpu_platform_support_gbm.cc

Issue 479713002: [Ozone-GBM] Adding NativeWindowDelegate to IPC window changes to the GPU (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix name Created 6 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
« no previous file with comments | « ui/ozone/platform/dri/gpu_platform_support_gbm.h ('k') | ui/ozone/platform/dri/ozone_platform_gbm.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/ozone/platform/dri/gpu_platform_support_gbm.cc
diff --git a/ui/ozone/platform/dri/gpu_platform_support_gbm.cc b/ui/ozone/platform/dri/gpu_platform_support_gbm.cc
index 051538e3b8d0900e07e8e055b1a3fad3a8237fee..c18084e81b182449f746b384568cba67597582f8 100644
--- a/ui/ozone/platform/dri/gpu_platform_support_gbm.cc
+++ b/ui/ozone/platform/dri/gpu_platform_support_gbm.cc
@@ -7,11 +7,18 @@
#include "ipc/ipc_message_macros.h"
#include "ui/ozone/common/gpu/ozone_gpu_messages.h"
#include "ui/ozone/platform/dri/dri_surface_factory.h"
+#include "ui/ozone/platform/dri/dri_window_delegate_impl.h"
+#include "ui/ozone/platform/dri/dri_window_manager.h"
namespace ui {
-GpuPlatformSupportGbm::GpuPlatformSupportGbm(DriSurfaceFactory* dri)
- : sender_(NULL), dri_(dri) {
+GpuPlatformSupportGbm::GpuPlatformSupportGbm(DriSurfaceFactory* dri,
+ DriWindowManager* window_manager,
+ ScreenManager* screen_manager)
+ : sender_(NULL),
+ dri_(dri),
+ window_manager_(window_manager),
+ screen_manager_(screen_manager) {
}
GpuPlatformSupportGbm::~GpuPlatformSupportGbm() {}
@@ -31,6 +38,11 @@ bool GpuPlatformSupportGbm::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GpuPlatformSupportGbm, message)
+ IPC_MESSAGE_HANDLER(OzoneGpuMsg_CreateWindowDelegate, OnCreateWindowDelegate)
+ IPC_MESSAGE_HANDLER(OzoneGpuMsg_DestroyWindowDelegate,
+ OnDestroyWindowDelegate)
+ IPC_MESSAGE_HANDLER(OzoneGpuMsg_WindowBoundsChanged, OnWindowBoundsChanged)
+
IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorSet, OnCursorSet)
IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorMove, OnCursorMove)
IPC_MESSAGE_UNHANDLED(handled = false);
@@ -44,6 +56,39 @@ bool GpuPlatformSupportGbm::OnMessageReceived(const IPC::Message& message) {
return false;
}
+void GpuPlatformSupportGbm::OnCreateWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ // Due to how the GPU process starts up this IPC call may happen after the IPC
+ // to create a surface. Since a surface wants to know the window associated
+ // with it, we create it ahead of time. So when this call happens we do not
+ // create a delegate if it already exists.
+ if (!window_manager_->HasWindowDelegate(widget)) {
+ scoped_ptr<DriWindowDelegate> delegate(
+ new DriWindowDelegateImpl(widget, screen_manager_));
+ delegate->Initialize();
+ window_manager_->AddWindowDelegate(widget, delegate.get());
+
+ std::pair<WidgetToWindowDelegateMap::iterator, bool> result =
+ window_delegate_owner_.add(widget, delegate.Pass());
+ DCHECK(result.second) << "Delegate already added.";
+ }
+}
+
+void GpuPlatformSupportGbm::OnDestroyWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ scoped_ptr<DriWindowDelegate> delegate =
+ window_delegate_owner_.take_and_erase(widget);
+ DCHECK(delegate) << "Attempting to remove non-existing delegate.";
+
+ window_manager_->RemoveWindowDelegate(widget);
+ delegate->Shutdown();
+}
+
+void GpuPlatformSupportGbm::OnWindowBoundsChanged(gfx::AcceleratedWidget widget,
+ const gfx::Rect& bounds) {
+ window_manager_->GetWindowDelegate(widget)->OnBoundsChanged(bounds);
+}
+
void GpuPlatformSupportGbm::OnCursorSet(gfx::AcceleratedWidget widget,
const SkBitmap& bitmap,
const gfx::Point& location) {
« no previous file with comments | « ui/ozone/platform/dri/gpu_platform_support_gbm.h ('k') | ui/ozone/platform/dri/ozone_platform_gbm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698