Chromium Code Reviews| Index: ui/ozone/platform/drm/gpu/drm_device_manager.h |
| diff --git a/ui/ozone/platform/drm/gpu/drm_device_manager.h b/ui/ozone/platform/drm/gpu/drm_device_manager.h |
| index 4d0a97ba43472508802c669f1e127815170ee139..f9d30d294d66c6b5166bbfc5da4affa8034a969d 100644 |
| --- a/ui/ozone/platform/drm/gpu/drm_device_manager.h |
| +++ b/ui/ozone/platform/drm/gpu/drm_device_manager.h |
| @@ -6,23 +6,44 @@ |
| #define UI_OZONE_PLATFORM_DRM_GPU_DRM_DEVICE_MANAGER_H_ |
| #include <map> |
| +#include <vector> |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "base/synchronization/lock.h" |
| +#include "base/threading/thread_checker.h" |
| #include "ui/gfx/native_widget_types.h" |
| #include "ui/ozone/ozone_export.h" |
| +namespace base { |
| +class FilePath; |
| +struct FileDescriptor; |
| +class SingleThreadTaskRunner; |
| +} |
| + |
| namespace ui { |
| class DrmDevice; |
| +class DrmDeviceGenerator; |
| + |
| +typedef std::vector<scoped_refptr<DrmDevice>> DrmDeviceVector; |
| // Tracks the mapping between widgets and the DRM devices used to allocate |
| // buffers for the window represented by the widget. |
| +// Note: All calls are protected by a lock since |
| +// GetDrmDevice(gfx::AcceleratedWidget) may be called on the IO thread. |
| class OZONE_EXPORT DrmDeviceManager { |
| public: |
| - DrmDeviceManager(const scoped_refptr<DrmDevice>& primary_device); |
| + DrmDeviceManager(scoped_ptr<DrmDeviceGenerator> drm_device_generator); |
| ~DrmDeviceManager(); |
| + // The first device registered is assumed to be the primary device. |
| + bool AddDrmDevice(const base::FilePath& path, const base::FileDescriptor& fd); |
| + void RemoveDrmDevice(const base::FilePath& path); |
| + |
| + void InitializeIOTaskRunner( |
| + const scoped_refptr<base::SingleThreadTaskRunner>& task_runner); |
| + |
| // Updates the device associated with |widget|. |
| void UpdateDrmDevice(gfx::AcceleratedWidget widget, |
| const scoped_refptr<DrmDevice>& device); |
| @@ -34,7 +55,19 @@ class OZONE_EXPORT DrmDeviceManager { |
| // returns |primary_device_|. |
| scoped_refptr<DrmDevice> GetDrmDevice(gfx::AcceleratedWidget widget); |
| + DrmDeviceVector GetDrmDevices(); |
|
alexst (slow to review)
2015/04/23 13:53:43
One more nit: do you need to make a copy here or c
dnicoara
2015/04/23 14:06:11
Nope, done.
|
| + |
| private: |
| + // With the exception of GetDrmDevice() all functions must be called on GPU |
| + // main. |
| + base::ThreadChecker thread_checker_; |
| + |
| + scoped_ptr<DrmDeviceGenerator> drm_device_generator_; |
| + |
| + scoped_refptr<base::SingleThreadTaskRunner> io_task_runner_; |
| + |
| + DrmDeviceVector devices_; |
| + |
| std::map<gfx::AcceleratedWidget, scoped_refptr<DrmDevice>> drm_device_map_; |
| // This device represents the primary graphics device and is used when: |