Index: ui/ozone/platform/dri/dri_window_delegate_proxy.cc |
diff --git a/ui/ozone/platform/dri/dri_window_delegate_proxy.cc b/ui/ozone/platform/dri/dri_window_delegate_proxy.cc |
index 297bbd7fd1973fb0908c897fcce7c701af60db7a..cf2421850551f915d1f8f6ac36254d888927f8b6 100644 |
--- a/ui/ozone/platform/dri/dri_window_delegate_proxy.cc |
+++ b/ui/ozone/platform/dri/dri_window_delegate_proxy.cc |
@@ -12,18 +12,23 @@ namespace ui { |
DriWindowDelegateProxy::DriWindowDelegateProxy( |
gfx::AcceleratedWidget widget, |
GpuPlatformSupportHostGbm* sender) |
- : widget_(widget), sender_(sender) { |
+ : widget_(widget), sender_(sender), has_connection_(false) { |
} |
DriWindowDelegateProxy::~DriWindowDelegateProxy() { |
} |
void DriWindowDelegateProxy::Initialize() { |
- bool status = sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); |
- DCHECK(status); |
+ TRACE_EVENT1("dri", "DriWindowDelegateProxy::Initialize", "widget", widget_); |
+ sender_->AddChannelObserver(this); |
} |
void DriWindowDelegateProxy::Shutdown() { |
+ TRACE_EVENT1("dri", "DriWindowDelegateProxy::Shutdown", "widget", widget_); |
+ sender_->RemoveChannelObserver(this); |
+ if (!has_connection_) |
+ return; |
+ |
bool status = sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_)); |
DCHECK(status); |
} |
@@ -38,9 +43,34 @@ HardwareDisplayController* DriWindowDelegateProxy::GetController() { |
} |
void DriWindowDelegateProxy::OnBoundsChanged(const gfx::Rect& bounds) { |
+ TRACE_EVENT2("dri", |
+ "DriWindowDelegateProxy::OnBoundsChanged", |
+ "widget", |
+ widget_, |
+ "bounds", |
+ bounds.ToString()); |
+ bounds_ = bounds; |
+ if (!has_connection_) |
+ return; |
+ |
bool status = |
sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds)); |
DCHECK(status); |
} |
+void DriWindowDelegateProxy::OnChannelEstablished() { |
+ TRACE_EVENT1( |
+ "dri", "DriWindowDelegateProxy::OnChannelEstablished", "widget", widget_); |
+ has_connection_ = true; |
+ bool status = sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); |
+ DCHECK(status); |
+ OnBoundsChanged(bounds_); |
+} |
+ |
+void DriWindowDelegateProxy::OnChannelDestroyed() { |
+ TRACE_EVENT1( |
+ "dri", "DriWindowDelegateProxy::OnChannelDestroyed", "widget", widget_); |
+ has_connection_ = false; |
+} |
+ |
} // namespace ui |