Chromium Code Reviews| 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/drm/host/drm_window_host.h" | 5 #include "ui/ozone/platform/drm/host/drm_window_host.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "ui/events/devices/device_data_manager.h" | 8 #include "ui/events/devices/device_data_manager.h" |
| 9 #include "ui/events/event.h" | 9 #include "ui/events/event.h" |
| 10 #include "ui/events/ozone/evdev/event_factory_evdev.h" | 10 #include "ui/events/ozone/evdev/event_factory_evdev.h" |
| 11 #include "ui/events/ozone/events_ozone.h" | 11 #include "ui/events/ozone/events_ozone.h" |
| 12 #include "ui/events/platform/platform_event_source.h" | 12 #include "ui/events/platform/platform_event_source.h" |
| 13 #include "ui/gfx/display.h" | 13 #include "ui/gfx/display.h" |
| 14 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" | 14 #include "ui/ozone/common/gpu/ozone_gpu_messages.h" |
|
dnicoara
2016/02/03 14:54:30
nit: Maybe remove this include.
rjkroege
2016/02/04 00:09:40
Done.
| |
| 15 #include "ui/ozone/platform/drm/host/drm_cursor.h" | 15 #include "ui/ozone/platform/drm/host/drm_cursor.h" |
| 16 #include "ui/ozone/platform/drm/host/drm_display_host.h" | 16 #include "ui/ozone/platform/drm/host/drm_display_host.h" |
| 17 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" | 17 #include "ui/ozone/platform/drm/host/drm_display_host_manager.h" |
| 18 #include "ui/ozone/platform/drm/host/drm_gpu_platform_support_host.h" | |
| 19 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" | 18 #include "ui/ozone/platform/drm/host/drm_overlay_manager.h" |
| 20 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" | 19 #include "ui/ozone/platform/drm/host/drm_window_host_manager.h" |
| 21 #include "ui/platform_window/platform_window_delegate.h" | 20 #include "ui/platform_window/platform_window_delegate.h" |
| 22 | 21 |
| 23 namespace ui { | 22 namespace ui { |
| 24 | 23 |
| 25 DrmWindowHost::DrmWindowHost(PlatformWindowDelegate* delegate, | 24 DrmWindowHost::DrmWindowHost(PlatformWindowDelegate* delegate, |
| 26 const gfx::Rect& bounds, | 25 const gfx::Rect& bounds, |
| 27 DrmGpuPlatformSupportHost* sender, | 26 GpuThreadAdapter* sender, |
| 28 EventFactoryEvdev* event_factory, | 27 EventFactoryEvdev* event_factory, |
| 29 DrmCursor* cursor, | 28 DrmCursor* cursor, |
| 30 DrmWindowHostManager* window_manager, | 29 DrmWindowHostManager* window_manager, |
| 31 DrmDisplayHostManager* display_manager, | 30 DrmDisplayHostManager* display_manager, |
| 32 DrmOverlayManager* overlay_manager) | 31 DrmOverlayManager* overlay_manager) |
| 33 : delegate_(delegate), | 32 : delegate_(delegate), |
| 34 sender_(sender), | 33 sender_(sender), |
| 35 event_factory_(event_factory), | 34 event_factory_(event_factory), |
| 36 cursor_(cursor), | 35 cursor_(cursor), |
| 37 window_manager_(window_manager), | 36 window_manager_(window_manager), |
| 38 display_manager_(display_manager), | 37 display_manager_(display_manager), |
| 39 overlay_manager_(overlay_manager), | 38 overlay_manager_(overlay_manager), |
| 40 bounds_(bounds), | 39 bounds_(bounds), |
| 41 widget_(window_manager->NextAcceleratedWidget()) { | 40 widget_(window_manager->NextAcceleratedWidget()) { |
| 42 window_manager_->AddWindow(widget_, this); | 41 window_manager_->AddWindow(widget_, this); |
| 43 } | 42 } |
| 44 | 43 |
| 45 DrmWindowHost::~DrmWindowHost() { | 44 DrmWindowHost::~DrmWindowHost() { |
| 46 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 45 PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
| 47 window_manager_->RemoveWindow(widget_); | 46 window_manager_->RemoveWindow(widget_); |
| 48 cursor_->OnWindowRemoved(widget_); | 47 cursor_->OnWindowRemoved(widget_); |
| 49 | 48 |
| 50 sender_->RemoveGpuThreadObserver(this); | 49 sender_->RemoveGpuThreadObserver(this); |
| 51 sender_->Send(new OzoneGpuMsg_DestroyWindow(widget_)); | 50 sender_->GpuDestroyWindow(widget_); |
| 52 } | 51 } |
| 53 | 52 |
| 54 void DrmWindowHost::Initialize() { | 53 void DrmWindowHost::Initialize() { |
| 55 sender_->AddGpuThreadObserver(this); | 54 sender_->AddGpuThreadObserver(this); |
| 56 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 55 PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| 57 cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); | 56 cursor_->OnWindowAdded(widget_, bounds_, GetCursorConfinedBounds()); |
| 58 delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); | 57 delegate_->OnAcceleratedWidgetAvailable(widget_, 1.f); |
| 59 } | 58 } |
| 60 | 59 |
| 61 gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { | 60 gfx::AcceleratedWidget DrmWindowHost::GetAcceleratedWidget() { |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 182 located_event->set_location_f(location); | 181 located_event->set_location_f(location); |
| 183 located_event->set_root_location_f(location); | 182 located_event->set_root_location_f(location); |
| 184 } | 183 } |
| 185 DispatchEventFromNativeUiEvent( | 184 DispatchEventFromNativeUiEvent( |
| 186 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, | 185 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, |
| 187 base::Unretained(delegate_))); | 186 base::Unretained(delegate_))); |
| 188 return POST_DISPATCH_STOP_PROPAGATION; | 187 return POST_DISPATCH_STOP_PROPAGATION; |
| 189 } | 188 } |
| 190 | 189 |
| 191 void DrmWindowHost::OnGpuThreadReady() { | 190 void DrmWindowHost::OnGpuThreadReady() { |
| 192 sender_->Send(new OzoneGpuMsg_CreateWindow(widget_)); | 191 sender_->GpuCreateWindow(widget_); |
| 193 SendBoundsChange(); | 192 SendBoundsChange(); |
| 194 } | 193 } |
| 195 | 194 |
| 196 void DrmWindowHost::OnGpuThreadRetired() {} | 195 void DrmWindowHost::OnGpuThreadRetired() {} |
| 197 | 196 |
| 198 void DrmWindowHost::SendBoundsChange() { | 197 void DrmWindowHost::SendBoundsChange() { |
| 199 // Update the cursor before the window so that the cursor stays within the | 198 // Update the cursor before the window so that the cursor stays within the |
| 200 // window bounds when the window size shrinks. | 199 // window bounds when the window size shrinks. |
| 201 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); | 200 cursor_->CommitBoundsChange(widget_, bounds_, GetCursorConfinedBounds()); |
| 202 sender_->Send(new OzoneGpuMsg_WindowBoundsChanged(widget_, bounds_)); | 201 sender_->GpuWindowBoundsChanged(widget_, bounds_); |
| 203 | 202 |
| 204 overlay_manager_->ResetCache(); | 203 overlay_manager_->ResetCache(); |
| 205 } | 204 } |
| 206 | 205 |
| 207 } // namespace ui | 206 } // namespace ui |
| OLD | NEW |