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

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: . 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
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..a7e99c593c6f8808fd7941f90c6d7a21fd574e58 100644
--- a/ui/ozone/platform/dri/gpu_platform_support_gbm.cc
+++ b/ui/ozone/platform/dri/gpu_platform_support_gbm.cc
@@ -7,11 +7,19 @@
#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/native_window_delegate_impl.h"
+#include "ui/ozone/platform/dri/native_window_manager.h"
namespace ui {
-GpuPlatformSupportGbm::GpuPlatformSupportGbm(DriSurfaceFactory* dri)
- : sender_(NULL), dri_(dri) {
+GpuPlatformSupportGbm::GpuPlatformSupportGbm(
+ DriSurfaceFactory* dri,
+ NativeWindowManager* window_manager,
+ ScreenManager* screen_manager)
+ : sender_(NULL),
+ dri_(dri),
+ window_manager_(window_manager),
+ screen_manager_(screen_manager) {
}
GpuPlatformSupportGbm::~GpuPlatformSupportGbm() {}
@@ -31,6 +39,13 @@ bool GpuPlatformSupportGbm::OnMessageReceived(const IPC::Message& message) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(GpuPlatformSupportGbm, message)
+ IPC_MESSAGE_HANDLER(OzoneGpuMsg_CreateNativeWindowDelegate,
+ OnCreateNativeWindowDelegate)
+ IPC_MESSAGE_HANDLER(OzoneGpuMsg_DestoryNativeWindowDelegate,
+ OnDestoryNativeWindowDelegate)
+ IPC_MESSAGE_HANDLER(OzoneGpuMsg_NativeWindowBoundsChanged,
+ OnNativeWindowBoundsChanged)
+
IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorSet, OnCursorSet)
IPC_MESSAGE_HANDLER(OzoneGpuMsg_CursorMove, OnCursorMove)
IPC_MESSAGE_UNHANDLED(handled = false);
@@ -44,6 +59,29 @@ bool GpuPlatformSupportGbm::OnMessageReceived(const IPC::Message& message) {
return false;
}
+void GpuPlatformSupportGbm::OnCreateNativeWindowDelegate(
+ 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.
+ // Note: NativeWindowDelegateImpl registers itself with |window_manager_| on
+ // allocation, so we don't need to keep track of it further.
+ if (!window_manager_->HasNativeWindowDelegate(widget))
+ new NativeWindowDelegateImpl(widget, window_manager_, screen_manager_);
alexst (slow to review) 2014/08/18 17:43:47 Can you make the registration with window manager
dnicoara 2014/08/18 18:55:24 I think this is better since the object registers
alexst (slow to review) 2014/08/18 20:30:34 I disagree. All I see is "new Stuff()" This requir
spang 2014/08/18 23:48:46 This does look like a memory leak to me as well. "
dnicoara 2014/08/19 15:53:38 Fine, updated.
+}
+
+void GpuPlatformSupportGbm::OnDestoryNativeWindowDelegate(
+ gfx::AcceleratedWidget widget) {
+ scoped_ptr<NativeWindowDelegate> delegate(
alexst (slow to review) 2014/08/18 17:43:47 DCHECK that it exists and remove it explicitly ple
dnicoara 2014/08/18 18:55:24 NativeWindowManager is doing all the DCHECKs, so I
+ window_manager_->GetNativeWindowDelegate(widget));
+}
+
+void GpuPlatformSupportGbm::OnNativeWindowBoundsChanged(
+ gfx::AcceleratedWidget widget, const gfx::Rect& bounds) {
+ window_manager_->GetNativeWindowDelegate(widget)->OnBoundsChanged(bounds);
alexst (slow to review) 2014/08/18 17:43:47 DCHECK here please.
dnicoara 2014/08/18 18:55:24 See above comment.
+}
+
void GpuPlatformSupportGbm::OnCursorSet(gfx::AcceleratedWidget widget,
const SkBitmap& bitmap,
const gfx::Point& location) {

Powered by Google App Engine
This is Rietveld 408576698