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

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 display_->StartProcessingEvents();
Michael Forney 2016/01/21 22:11:48 It looks like base::MessageLoopForUI::current() is
spang 2016/01/22 23:42:32 It's a longstanding issue that InitializeUI() runs
Michael Forney 2016/01/23 01:08:05 Cool, thanks for the suggestion. That does appear
57 delegate, window_manager_.get(), event_source_.get(), bounds)); 61 auto window =
58 if (!caca_window->Initialize()) 62 make_scoped_ptr(new WaylandWindow(delegate, display_.get(), bounds));
63 if (!window->Initialize())
59 return nullptr; 64 return nullptr;
60 return std::move(caca_window); 65 return std::move(window);
61 } 66 }
67
62 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { 68 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
63 return make_scoped_ptr(new NativeDisplayDelegateOzone()); 69 return make_scoped_ptr(new NativeDisplayDelegateOzone);
64 } 70 }
71
65 base::ScopedFD OpenClientNativePixmapDevice() const override { 72 base::ScopedFD OpenClientNativePixmapDevice() const override {
73 NOTIMPLEMENTED();
66 return base::ScopedFD(); 74 return base::ScopedFD();
67 } 75 }
68 76
69 void InitializeUI() override { 77 void InitializeUI() override {
70 window_manager_.reset(new CacaWindowManager); 78 display_.reset(new WaylandDisplay);
71 overlay_manager_.reset(new StubOverlayManager()); 79 if (!display_->Initialize())
72 event_source_.reset(new CacaEventSource()); 80 LOG(FATAL) << "Failed to initialize Wayland platform";
73 cursor_factory_ozone_.reset(new CursorFactoryOzone()); 81
82 cursor_factory_.reset(new CursorFactoryOzone);
83 overlay_manager_.reset(new StubOverlayManager);
84 input_controller_ = CreateStubInputController();
85 surface_factory_.reset(new WaylandSurfaceFactory(display_.get()));
74 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); 86 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost());
75 input_controller_ = CreateStubInputController();
76 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine(
77 make_scoped_ptr(new NoKeyboardLayoutEngine()));
78 } 87 }
79 88
80 void InitializeGPU() override { 89 void InitializeGPU() override {
90 surface_factory_.reset(new WaylandSurfaceFactory(nullptr));
81 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); 91 gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
82 } 92 }
83 93
84 private: 94 private:
85 scoped_ptr<CacaWindowManager> window_manager_; 95 scoped_ptr<WaylandDisplay> display_;
86 scoped_ptr<CacaEventSource> event_source_; 96 scoped_ptr<WaylandSurfaceFactory> surface_factory_;
87 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; 97 scoped_ptr<CursorFactoryOzone> cursor_factory_;
98 scoped_ptr<StubOverlayManager> overlay_manager_;
99 scoped_ptr<InputController> input_controller_;
100 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_;
88 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; 101 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 102
93 DISALLOW_COPY_AND_ASSIGN(OzonePlatformCaca); 103 DISALLOW_COPY_AND_ASSIGN(OzonePlatformWayland);
94 }; 104 };
95 105
96 } // namespace 106 } // namespace
97 107
98 OzonePlatform* CreateOzonePlatformCaca() { 108 OzonePlatform* CreateOzonePlatformWayland() {
99 return new OzonePlatformCaca; 109 return new OzonePlatformWayland;
100 } 110 }
101 111
102 } // namespace ui 112 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698