OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" | 5 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" |
6 | 6 |
7 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" | 7 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
8 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" | 8 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" |
9 | 9 |
10 namespace ui { | 10 namespace ui { |
11 | 11 |
12 DriWindowDelegateProxy::DriWindowDelegateProxy( | 12 DriWindowDelegateProxy::DriWindowDelegateProxy( |
13 gfx::AcceleratedWidget widget, | 13 gfx::AcceleratedWidget widget, |
14 GpuPlatformSupportHostGbm* sender) | 14 GpuPlatformSupportHostGbm* sender) |
15 : widget_(widget), sender_(sender) { | 15 : widget_(widget), sender_(sender), has_connection_(false) { |
16 } | 16 } |
17 | 17 |
18 DriWindowDelegateProxy::~DriWindowDelegateProxy() { | 18 DriWindowDelegateProxy::~DriWindowDelegateProxy() { |
19 } | 19 } |
20 | 20 |
21 void DriWindowDelegateProxy::Initialize() { | 21 void DriWindowDelegateProxy::Initialize() { |
22 bool status = sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); | 22 TRACE_EVENT1("dri", "DriWindowDelegateProxy::Initialize", "widget", widget_); |
dnicoara
2014/08/29 22:36:48
Can I now remove the Initialize/Shutdown functions
alexst (slow to review)
2014/09/02 13:37:07
Init can go, but shutdown still sends an IPC.
dnicoara
2014/09/03 17:17:25
I like the symmetry so I'm going to leave it then.
| |
23 DCHECK(status); | 23 sender_->AddChannelObserver(this); |
24 } | 24 } |
25 | 25 |
26 void DriWindowDelegateProxy::Shutdown() { | 26 void DriWindowDelegateProxy::Shutdown() { |
27 TRACE_EVENT1("dri", "DriWindowDelegateProxy::Shutdown", "widget", widget_); | |
28 sender_->RemoveChannelObserver(this); | |
27 bool status = sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_)); | 29 bool status = sender_->Send(new OzoneGpuMsg_DestroyWindowDelegate(widget_)); |
alexst (slow to review)
2014/09/02 13:37:07
Is it possible to not have a connection here? Some
dnicoara
2014/09/03 17:17:25
Done.
| |
28 DCHECK(status); | 30 DCHECK(status); |
29 } | 31 } |
30 | 32 |
31 gfx::AcceleratedWidget DriWindowDelegateProxy::GetAcceleratedWidget() { | 33 gfx::AcceleratedWidget DriWindowDelegateProxy::GetAcceleratedWidget() { |
32 return widget_; | 34 return widget_; |
33 } | 35 } |
34 | 36 |
35 HardwareDisplayController* DriWindowDelegateProxy::GetController() { | 37 HardwareDisplayController* DriWindowDelegateProxy::GetController() { |
36 NOTREACHED(); | 38 NOTREACHED(); |
37 return NULL; | 39 return NULL; |
38 } | 40 } |
39 | 41 |
40 void DriWindowDelegateProxy::OnBoundsChanged(const gfx::Rect& bounds) { | 42 void DriWindowDelegateProxy::OnBoundsChanged(const gfx::Rect& bounds) { |
43 TRACE_EVENT1( | |
44 "dri", "DriWindowDelegateProxy::OnBoundsChanged", "widget", widget_); | |
45 bounds_ = bounds; | |
46 if (!has_connection_) | |
47 return; | |
48 | |
41 bool status = | 49 bool status = |
42 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds)); | 50 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds)); |
43 DCHECK(status); | 51 DCHECK(status); |
44 } | 52 } |
45 | 53 |
54 void DriWindowDelegateProxy::OnChannelEstablished() { | |
55 TRACE_EVENT1( | |
56 "dri", "DriWindowDelegateProxy::OnChannelEstablished", "widget", widget_); | |
57 has_connection_ = true; | |
58 bool status = sender_->Send(new OzoneGpuMsg_CreateWindowDelegate(widget_)); | |
59 DCHECK(status); | |
60 OnBoundsChanged(bounds_); | |
61 } | |
62 | |
63 void DriWindowDelegateProxy::OnChannelDestroyed() { | |
64 TRACE_EVENT1( | |
65 "dri", "DriWindowDelegateProxy::OnChannelDestroyed", "widget", widget_); | |
66 has_connection_ = false; | |
67 } | |
68 | |
46 } // namespace ui | 69 } // namespace ui |
OLD | NEW |