| 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 #ifndef UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ | 5 #ifndef UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ |
| 6 #define UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ | 6 #define UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 #include <queue> | 9 #include <queue> |
| 10 #include <set> | |
| 11 | 10 |
| 11 #include "base/containers/scoped_ptr_hash_map.h" |
| 12 #include "base/files/file.h" | 12 #include "base/files/file.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/memory/ref_counted.h" | |
| 16 #include "base/memory/scoped_vector.h" | 15 #include "base/memory/scoped_vector.h" |
| 17 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
| 18 #include "ui/display/types/native_display_delegate.h" | 17 #include "ui/display/types/native_display_delegate.h" |
| 19 #include "ui/events/ozone/device/device_event.h" | 18 #include "ui/events/ozone/device/device_event.h" |
| 20 #include "ui/events/ozone/device/device_event_observer.h" | 19 #include "ui/events/ozone/device/device_event_observer.h" |
| 21 #include "ui/ozone/public/gpu_platform_support_host.h" | 20 #include "ui/ozone/public/gpu_platform_support_host.h" |
| 22 | 21 |
| 23 namespace ui { | 22 namespace ui { |
| 24 | 23 |
| 25 class DeviceManager; | 24 class DeviceManager; |
| 26 class DisplayManager; | 25 class DisplayManager; |
| 26 class DrmDeviceHandle; |
| 27 class DrmGpuPlatformSupportHost; | 27 class DrmGpuPlatformSupportHost; |
| 28 | 28 |
| 29 struct DisplaySnapshot_Params; | 29 struct DisplaySnapshot_Params; |
| 30 | 30 |
| 31 class DrmNativeDisplayDelegate : public NativeDisplayDelegate, | 31 class DrmNativeDisplayDelegate : public NativeDisplayDelegate, |
| 32 public DeviceEventObserver, | 32 public DeviceEventObserver, |
| 33 public GpuPlatformSupportHost { | 33 public GpuPlatformSupportHost { |
| 34 public: | 34 public: |
| 35 DrmNativeDisplayDelegate(DrmGpuPlatformSupportHost* proxy, | 35 DrmNativeDisplayDelegate(DrmGpuPlatformSupportHost* proxy, |
| 36 DeviceManager* device_manager, | 36 DeviceManager* device_manager, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 }; | 90 }; |
| 91 | 91 |
| 92 void OnUpdateNativeDisplays( | 92 void OnUpdateNativeDisplays( |
| 93 const std::vector<DisplaySnapshot_Params>& displays); | 93 const std::vector<DisplaySnapshot_Params>& displays); |
| 94 void OnDisplayConfigured(int64_t display_id, bool status); | 94 void OnDisplayConfigured(int64_t display_id, bool status); |
| 95 | 95 |
| 96 void ProcessEvent(); | 96 void ProcessEvent(); |
| 97 | 97 |
| 98 // Called as a result of finishing to process the display hotplug event. These | 98 // Called as a result of finishing to process the display hotplug event. These |
| 99 // are responsible for dequing the event and scheduling the next event. | 99 // are responsible for dequing the event and scheduling the next event. |
| 100 void OnAddGraphicsDevice(const base::FilePath& path, base::File file); | 100 void OnAddGraphicsDevice(const base::FilePath& path, |
| 101 scoped_ptr<DrmDeviceHandle> handle); |
| 101 void OnUpdateGraphicsDevice(); | 102 void OnUpdateGraphicsDevice(); |
| 102 void OnRemoveGraphicsDevice(const base::FilePath& path); | 103 void OnRemoveGraphicsDevice(const base::FilePath& path); |
| 103 | 104 |
| 104 void OnHDCPStateReceived(int64_t display_id, bool status, HDCPState state); | 105 void OnHDCPStateReceived(int64_t display_id, bool status, HDCPState state); |
| 105 void OnHDCPStateUpdated(int64_t display_id, bool status); | 106 void OnHDCPStateUpdated(int64_t display_id, bool status); |
| 106 | 107 |
| 107 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const; | 108 void RunUpdateDisplaysCallback(const GetDisplaysCallback& callback) const; |
| 108 | 109 |
| 109 DrmGpuPlatformSupportHost* proxy_; // Not owned. | 110 DrmGpuPlatformSupportHost* proxy_; // Not owned. |
| 110 DeviceManager* device_manager_; // Not owned. | 111 DeviceManager* device_manager_; // Not owned. |
| (...skipping 20 matching lines...) Expand all Loading... |
| 131 | 132 |
| 132 std::map<int64_t, SetHDCPStateCallback> set_hdcp_state_callback_map_; | 133 std::map<int64_t, SetHDCPStateCallback> set_hdcp_state_callback_map_; |
| 133 | 134 |
| 134 // Used to serialize display event processing. This is done since | 135 // Used to serialize display event processing. This is done since |
| 135 // opening/closing DRM devices cannot be done on the UI thread and are handled | 136 // opening/closing DRM devices cannot be done on the UI thread and are handled |
| 136 // on a worker thread. Thus, we need to queue events in order to process them | 137 // on a worker thread. Thus, we need to queue events in order to process them |
| 137 // in the correct order. | 138 // in the correct order. |
| 138 std::queue<DisplayEvent> event_queue_; | 139 std::queue<DisplayEvent> event_queue_; |
| 139 | 140 |
| 140 // Keeps track of all the active DRM devices. | 141 // Keeps track of all the active DRM devices. |
| 141 std::set<base::FilePath> drm_devices_; | 142 base::ScopedPtrHashMap<base::FilePath, DrmDeviceHandle> drm_devices_; |
| 142 | 143 |
| 143 base::WeakPtrFactory<DrmNativeDisplayDelegate> weak_ptr_factory_; | 144 base::WeakPtrFactory<DrmNativeDisplayDelegate> weak_ptr_factory_; |
| 144 | 145 |
| 145 DISALLOW_COPY_AND_ASSIGN(DrmNativeDisplayDelegate); | 146 DISALLOW_COPY_AND_ASSIGN(DrmNativeDisplayDelegate); |
| 146 }; | 147 }; |
| 147 | 148 |
| 148 } // namespace ui | 149 } // namespace ui |
| 149 | 150 |
| 150 #endif // UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ | 151 #endif // UI_OZONE_PLATFORM_DRM_HOST_NATIVE_DISPLAY_DELEGATE_HOST_H_ |
| OLD | NEW |