Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(258)

Side by Side Diff: ui/ozone/platform/wayland/ozone_platform_wayland.cc

Issue 1610683003: Add initial SHM-only Wayland Ozone implementation (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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/caca/ozone_platform_caca.h" 5 #include "ui/ozone/platform/wayland/ozone_platform_wayland.h"
6 6
7 #include "base/macros.h"
8 #include "ui/events/ozone/layout/keyboard_layout_engine_manager.h"
9 #include "ui/events/ozone/layout/no/no_keyboard_layout_engine.h"
10 #include "ui/ozone/common/native_display_delegate_ozone.h" 7 #include "ui/ozone/common/native_display_delegate_ozone.h"
11 #include "ui/ozone/common/stub_overlay_manager.h" 8 #include "ui/ozone/common/stub_overlay_manager.h"
12 #include "ui/ozone/platform/caca/caca_event_source.h" 9 #include "ui/ozone/platform/wayland/wayland_display.h"
13 #include "ui/ozone/platform/caca/caca_window.h" 10 #include "ui/ozone/platform/wayland/wayland_surface_factory.h"
14 #include "ui/ozone/platform/caca/caca_window_manager.h" 11 #include "ui/ozone/platform/wayland/wayland_window.h"
15 #include "ui/ozone/public/cursor_factory_ozone.h" 12 #include "ui/ozone/public/cursor_factory_ozone.h"
16 #include "ui/ozone/public/gpu_platform_support.h" 13 #include "ui/ozone/public/gpu_platform_support.h"
17 #include "ui/ozone/public/gpu_platform_support_host.h" 14 #include "ui/ozone/public/gpu_platform_support_host.h"
18 #include "ui/ozone/public/input_controller.h" 15 #include "ui/ozone/public/input_controller.h"
19 #include "ui/ozone/public/ozone_platform.h" // nogncheck 16 #include "ui/ozone/public/ozone_platform.h" // nogncheck
20 #include "ui/ozone/public/system_input_injector.h" 17 #include "ui/ozone/public/system_input_injector.h"
21 18
22 namespace ui { 19 namespace ui {
23 20
24 namespace { 21 namespace {
25 22
26 class OzonePlatformCaca : public OzonePlatform { 23 class OzonePlatformWayland : public OzonePlatform {
27 public: 24 public:
28 OzonePlatformCaca() {} 25 OzonePlatformWayland() {}
29 ~OzonePlatformCaca() override {} 26 ~OzonePlatformWayland() override {}
30 27
31 // OzonePlatform: 28 // OzonePlatform
32 ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() override { 29 SurfaceFactoryOzone* GetSurfaceFactoryOzone() override {
33 return window_manager_.get(); 30 return surface_factory_.get();
34 } 31 }
32
35 OverlayManagerOzone* GetOverlayManager() override { 33 OverlayManagerOzone* GetOverlayManager() override {
36 return overlay_manager_.get(); 34 return overlay_manager_.get();
37 } 35 }
36
38 CursorFactoryOzone* GetCursorFactoryOzone() override { 37 CursorFactoryOzone* GetCursorFactoryOzone() override {
39 return cursor_factory_ozone_.get(); 38 return cursor_factory_.get();
40 } 39 }
40
41 InputController* GetInputController() override { 41 InputController* GetInputController() override {
42 return input_controller_.get(); 42 return input_controller_.get();
43 } 43 }
44
44 GpuPlatformSupport* GetGpuPlatformSupport() override { 45 GpuPlatformSupport* GetGpuPlatformSupport() override {
45 return gpu_platform_support_.get(); 46 return gpu_platform_support_.get();
46 } 47 }
48
47 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { 49 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override {
48 return gpu_platform_support_host_.get(); 50 return gpu_platform_support_host_.get();
49 } 51 }
52
50 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { 53 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override {
51 return nullptr; // no input injection support. 54 return nullptr;
52 } 55 }
56
53 scoped_ptr<PlatformWindow> CreatePlatformWindow( 57 scoped_ptr<PlatformWindow> CreatePlatformWindow(
54 PlatformWindowDelegate* delegate, 58 PlatformWindowDelegate* delegate,
55 const gfx::Rect& bounds) override { 59 const gfx::Rect& bounds) override {
56 scoped_ptr<CacaWindow> caca_window(new CacaWindow( 60 auto window =
57 delegate, window_manager_.get(), event_source_.get(), bounds)); 61 make_scoped_ptr(new WaylandWindow(delegate, display_.get(), bounds));
58 if (!caca_window->Initialize()) 62 if (!window->Initialize())
59 return nullptr; 63 return nullptr;
60 return std::move(caca_window); 64 return std::move(window);
61 } 65 }
66
62 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { 67 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
63 return make_scoped_ptr(new NativeDisplayDelegateOzone()); 68 return make_scoped_ptr(new NativeDisplayDelegateOzone);
64 } 69 }
70
65 base::ScopedFD OpenClientNativePixmapDevice() const override { 71 base::ScopedFD OpenClientNativePixmapDevice() const override {
72 NOTIMPLEMENTED();
66 return base::ScopedFD(); 73 return base::ScopedFD();
67 } 74 }
68 75
69 void InitializeUI() override { 76 void InitializeUI() override {
70 window_manager_.reset(new CacaWindowManager); 77 display_.reset(new WaylandDisplay);
71 overlay_manager_.reset(new StubOverlayManager()); 78 if (!display_->Initialize())
72 event_source_.reset(new CacaEventSource()); 79 LOG(FATAL) << "Failed to initialize Wayland platform";
73 cursor_factory_ozone_.reset(new CursorFactoryOzone()); 80
81 cursor_factory_.reset(new CursorFactoryOzone);
82 overlay_manager_.reset(new StubOverlayManager);
83 input_controller_ = CreateStubInputController();
84 surface_factory_.reset(new WaylandSurfaceFactory(display_.get()));
74 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); 85 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
75 input_controller_ = CreateStubInputController();
76 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
77 make_scoped_ptr(new NoKeyboardLayoutEngine()));
78 } 86 }
79 87
80 void InitializeGPU() override { 88 void InitializeGPU() override {
89 // Don't reinitialize the surface factory in case InitializeUI was called
90 // previously in the same process.
91 if (!surface_factory_)
92 surface_factory_.reset(new WaylandSurfaceFactory(nullptr));
81 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); 93 gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
82 } 94 }
83 95
84 private: 96 private:
85 scoped_ptr<CacaWindowManager> window_manager_; 97 scoped_ptr<WaylandDisplay> display_;
86 scoped_ptr<CacaEventSource> event_source_; 98 scoped_ptr<WaylandSurfaceFactory> surface_factory_;
87 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; 99 scoped_ptr<CursorFactoryOzone> cursor_factory_;
100 scoped_ptr<StubOverlayManager> overlay_manager_;
101 scoped_ptr<InputController> input_controller_;
102 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
88 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; 103 scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
89 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
90 scoped_ptr<InputController> input_controller_;
91 scoped_ptr<OverlayManagerOzone> overlay_manager_;
92 104
93 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); 105 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland);
94 }; 106 };
95 107
96 } // namespace 108 } // namespace
97 109
98 OzonePlatform* CreateOzonePlatformCaca() { 110 OzonePlatform* CreateOzonePlatformWayland() {
99 return new OzonePlatformCaca; 111 return new OzonePlatformWayland;
100 } 112 }
101 113
102 } // namespace ui 114 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/wayland/ozone_platform_wayland.h ('k') | ui/ozone/platform/wayland/wayland.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698