| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/ozone_platform_dri.h" | 5 #include "ui/ozone/platform/dri/ozone_platform_dri.h" |
| 6 | 6 |
| 7 #include "base/at_exit.h" | 7 #include "base/at_exit.h" |
| 8 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" | 8 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" |
| 9 #include "ui/events/ozone/device/device_manager.h" | 9 #include "ui/events/ozone/device/device_manager.h" |
| 10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" | 10 #include "ui/events/ozone/evdev/cursor_delegate_evdev.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 buffer_generator_(new DriBufferGenerator(dri_.get())), | 43 buffer_generator_(new DriBufferGenerator(dri_.get())), |
| 44 screen_manager_(new ScreenManager(dri_.get(), | 44 screen_manager_(new ScreenManager(dri_.get(), |
| 45 buffer_generator_.get())), | 45 buffer_generator_.get())), |
| 46 device_manager_(CreateDeviceManager()) { | 46 device_manager_(CreateDeviceManager()) { |
| 47 base::AtExitManager::RegisterTask( | 47 base::AtExitManager::RegisterTask( |
| 48 base::Bind(&base::DeletePointer<OzonePlatformDri>, this)); | 48 base::Bind(&base::DeletePointer<OzonePlatformDri>, this)); |
| 49 } | 49 } |
| 50 virtual ~OzonePlatformDri() {} | 50 virtual ~OzonePlatformDri() {} |
| 51 | 51 |
| 52 // OzonePlatform: | 52 // OzonePlatform: |
| 53 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() OVERRIDE { | 53 virtual ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { |
| 54 return surface_factory_ozone_.get(); | 54 return surface_factory_ozone_.get(); |
| 55 } | 55 } |
| 56 virtual CursorFactoryOzone* GetCursorFactoryOzone() OVERRIDE { | 56 virtual CursorFactoryOzone* GetCursorFactoryOzone() override { |
| 57 return cursor_factory_ozone_.get(); | 57 return cursor_factory_ozone_.get(); |
| 58 } | 58 } |
| 59 virtual GpuPlatformSupport* GetGpuPlatformSupport() OVERRIDE { | 59 virtual GpuPlatformSupport* GetGpuPlatformSupport() override { |
| 60 return gpu_platform_support_.get(); | 60 return gpu_platform_support_.get(); |
| 61 } | 61 } |
| 62 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { | 62 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 63 return gpu_platform_support_host_.get(); | 63 return gpu_platform_support_host_.get(); |
| 64 } | 64 } |
| 65 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( | 65 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 66 PlatformWindowDelegate* delegate, | 66 PlatformWindowDelegate* delegate, |
| 67 const gfx::Rect& bounds) OVERRIDE { | 67 const gfx::Rect& bounds) override { |
| 68 scoped_ptr<DriWindow> platform_window( | 68 scoped_ptr<DriWindow> platform_window( |
| 69 new DriWindow(delegate, | 69 new DriWindow(delegate, |
| 70 bounds, | 70 bounds, |
| 71 gpu_platform_support_host_.get(), | 71 gpu_platform_support_host_.get(), |
| 72 event_factory_ozone_.get(), | 72 event_factory_ozone_.get(), |
| 73 window_manager_.get())); | 73 window_manager_.get())); |
| 74 platform_window->Initialize(); | 74 platform_window->Initialize(); |
| 75 return platform_window.PassAs<PlatformWindow>(); | 75 return platform_window.PassAs<PlatformWindow>(); |
| 76 } | 76 } |
| 77 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() | 77 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() |
| 78 OVERRIDE { | 78 override { |
| 79 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri( | 79 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateDri( |
| 80 dri_.get(), screen_manager_.get(), device_manager_.get())); | 80 dri_.get(), screen_manager_.get(), device_manager_.get())); |
| 81 } | 81 } |
| 82 virtual void InitializeUI() OVERRIDE { | 82 virtual void InitializeUI() override { |
| 83 dri_->Initialize(); | 83 dri_->Initialize(); |
| 84 surface_factory_ozone_.reset(new DriSurfaceFactory( | 84 surface_factory_ozone_.reset(new DriSurfaceFactory( |
| 85 dri_.get(), screen_manager_.get(), &window_delegate_manager_)); | 85 dri_.get(), screen_manager_.get(), &window_delegate_manager_)); |
| 86 gpu_platform_support_.reset( | 86 gpu_platform_support_.reset( |
| 87 new DriGpuPlatformSupport(surface_factory_ozone_.get(), | 87 new DriGpuPlatformSupport(surface_factory_ozone_.get(), |
| 88 &window_delegate_manager_, | 88 &window_delegate_manager_, |
| 89 screen_manager_.get(), | 89 screen_manager_.get(), |
| 90 scoped_ptr<NativeDisplayDelegateDri>())); | 90 scoped_ptr<NativeDisplayDelegateDri>())); |
| 91 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); | 91 gpu_platform_support_host_.reset(new DriGpuPlatformSupportHost()); |
| 92 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); | 92 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); |
| 93 window_manager_.reset(new DriWindowManager(surface_factory_ozone_.get())); | 93 window_manager_.reset(new DriWindowManager(surface_factory_ozone_.get())); |
| 94 event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), | 94 event_factory_ozone_.reset(new EventFactoryEvdev(window_manager_->cursor(), |
| 95 device_manager_.get())); | 95 device_manager_.get())); |
| 96 if (surface_factory_ozone_->InitializeHardware() != | 96 if (surface_factory_ozone_->InitializeHardware() != |
| 97 DriSurfaceFactory::INITIALIZED) | 97 DriSurfaceFactory::INITIALIZED) |
| 98 LOG(FATAL) << "Failed to initialize display hardware."; | 98 LOG(FATAL) << "Failed to initialize display hardware."; |
| 99 | 99 |
| 100 if (!ui_thread_gpu_.Initialize()) | 100 if (!ui_thread_gpu_.Initialize()) |
| 101 LOG(FATAL) << "Failed to initialize dummy channel."; | 101 LOG(FATAL) << "Failed to initialize dummy channel."; |
| 102 } | 102 } |
| 103 | 103 |
| 104 virtual void InitializeGPU() OVERRIDE {} | 104 virtual void InitializeGPU() override {} |
| 105 | 105 |
| 106 private: | 106 private: |
| 107 scoped_ptr<VirtualTerminalManager> vt_manager_; | 107 scoped_ptr<VirtualTerminalManager> vt_manager_; |
| 108 scoped_ptr<DriWrapper> dri_; | 108 scoped_ptr<DriWrapper> dri_; |
| 109 scoped_ptr<DriBufferGenerator> buffer_generator_; | 109 scoped_ptr<DriBufferGenerator> buffer_generator_; |
| 110 scoped_ptr<ScreenManager> screen_manager_; | 110 scoped_ptr<ScreenManager> screen_manager_; |
| 111 scoped_ptr<DeviceManager> device_manager_; | 111 scoped_ptr<DeviceManager> device_manager_; |
| 112 | 112 |
| 113 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; | 113 scoped_ptr<DriSurfaceFactory> surface_factory_ozone_; |
| 114 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; | 114 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; |
| 115 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 115 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 116 | 116 |
| 117 scoped_ptr<DriWindowManager> window_manager_; | 117 scoped_ptr<DriWindowManager> window_manager_; |
| 118 | 118 |
| 119 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; | 119 scoped_ptr<DriGpuPlatformSupport> gpu_platform_support_; |
| 120 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; | 120 scoped_ptr<DriGpuPlatformSupportHost> gpu_platform_support_host_; |
| 121 | 121 |
| 122 DriWindowDelegateManager window_delegate_manager_; | 122 DriWindowDelegateManager window_delegate_manager_; |
| 123 | 123 |
| 124 UiThreadGpu ui_thread_gpu_; | 124 UiThreadGpu ui_thread_gpu_; |
| 125 | 125 |
| 126 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); | 126 DISALLOW_COPY_AND_ASSIGN(OzonePlatformDri); |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 } // namespace | 129 } // namespace |
| 130 | 130 |
| 131 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } | 131 OzonePlatform* CreateOzonePlatformDri() { return new OzonePlatformDri; } |
| 132 | 132 |
| 133 } // namespace ui | 133 } // namespace ui |
| OLD | NEW |