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

Side by Side Diff: ui/ozone/platform/dri/ozone_platform_gbm.cc

Issue 556073003: [Ozone-DRI] Do proper bounds checks when moving the cursor (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@restore-cursor
Patch Set: . Created 6 years, 3 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
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 #include "ui/ozone/platform/dri/ozone_platform_gbm.h" 5 #include "ui/ozone/platform/dri/ozone_platform_gbm.h"
6 6
7 #include <dlfcn.h> 7 #include <dlfcn.h>
8 #include <gbm.h> 8 #include <gbm.h>
9 #include <stdlib.h> 9 #include <stdlib.h>
10 10
11 #include "base/at_exit.h" 11 #include "base/at_exit.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h" 13 #include "ui/base/cursor/ozone/bitmap_cursor_factory_ozone.h"
14 #include "ui/events/ozone/device/device_manager.h" 14 #include "ui/events/ozone/device/device_manager.h"
15 #include "ui/events/ozone/evdev/event_factory_evdev.h" 15 #include "ui/events/ozone/evdev/event_factory_evdev.h"
16 #include "ui/ozone/platform/dri/dri_cursor.h" 16 #include "ui/ozone/platform/dri/dri_cursor.h"
17 #include "ui/ozone/platform/dri/dri_window.h" 17 #include "ui/ozone/platform/dri/dri_window.h"
18 #include "ui/ozone/platform/dri/dri_window_delegate_manager.h"
18 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h" 19 #include "ui/ozone/platform/dri/dri_window_delegate_proxy.h"
19 #include "ui/ozone/platform/dri/dri_window_manager.h" 20 #include "ui/ozone/platform/dri/dri_window_manager.h"
20 #include "ui/ozone/platform/dri/dri_wrapper.h" 21 #include "ui/ozone/platform/dri/dri_wrapper.h"
21 #include "ui/ozone/platform/dri/gbm_buffer.h" 22 #include "ui/ozone/platform/dri/gbm_buffer.h"
22 #include "ui/ozone/platform/dri/gbm_surface.h" 23 #include "ui/ozone/platform/dri/gbm_surface.h"
23 #include "ui/ozone/platform/dri/gbm_surface_factory.h" 24 #include "ui/ozone/platform/dri/gbm_surface_factory.h"
24 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h" 25 #include "ui/ozone/platform/dri/gpu_platform_support_gbm.h"
25 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h" 26 #include "ui/ozone/platform/dri/gpu_platform_support_host_gbm.h"
26 #include "ui/ozone/platform/dri/scanout_buffer.h" 27 #include "ui/ozone/platform/dri/scanout_buffer.h"
27 #include "ui/ozone/platform/dri/screen_manager.h" 28 #include "ui/ozone/platform/dri/screen_manager.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE { 99 virtual GpuPlatformSupportHost* GetGpuPlatformSupportHost() OVERRIDE {
99 return gpu_platform_support_host_.get(); 100 return gpu_platform_support_host_.get();
100 } 101 }
101 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow( 102 virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
102 PlatformWindowDelegate* delegate, 103 PlatformWindowDelegate* delegate,
103 const gfx::Rect& bounds) OVERRIDE { 104 const gfx::Rect& bounds) OVERRIDE {
104 scoped_ptr<DriWindow> platform_window( 105 scoped_ptr<DriWindow> platform_window(
105 new DriWindow(delegate, 106 new DriWindow(delegate,
106 bounds, 107 bounds,
107 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy( 108 scoped_ptr<DriWindowDelegate>(new DriWindowDelegateProxy(
108 ui_window_manager_.NextAcceleratedWidget(), 109 window_manager_->NextAcceleratedWidget(),
109 gpu_platform_support_host_.get())), 110 gpu_platform_support_host_.get())),
110 event_factory_ozone_.get(), 111 event_factory_ozone_.get(),
111 &ui_window_manager_, 112 ui_window_delegate_manager_.get(),
113 window_manager_.get(),
112 cursor_.get())); 114 cursor_.get()));
113 platform_window->Initialize(); 115 platform_window->Initialize();
114 return platform_window.PassAs<PlatformWindow>(); 116 return platform_window.PassAs<PlatformWindow>();
115 } 117 }
116 #if defined(OS_CHROMEOS) 118 #if defined(OS_CHROMEOS)
117 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() 119 virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
118 OVERRIDE { 120 OVERRIDE {
119 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy( 121 return scoped_ptr<NativeDisplayDelegate>(new NativeDisplayDelegateProxy(
120 gpu_platform_support_host_.get(), device_manager_.get())); 122 gpu_platform_support_host_.get(), device_manager_.get()));
121 } 123 }
122 #endif 124 #endif
123 virtual void InitializeUI() OVERRIDE { 125 virtual void InitializeUI() OVERRIDE {
124 vt_manager_.reset(new VirtualTerminalManager()); 126 vt_manager_.reset(new VirtualTerminalManager());
127 ui_window_delegate_manager_.reset(new DriWindowDelegateManager());
128 window_manager_.reset(new DriWindowManager());
125 // Needed since the browser process creates the accelerated widgets and that 129 // Needed since the browser process creates the accelerated widgets and that
126 // happens through SFO. 130 // happens through SFO.
127 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); 131 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
128 device_manager_ = CreateDeviceManager(); 132 device_manager_ = CreateDeviceManager();
129 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm()); 133 gpu_platform_support_host_.reset(new GpuPlatformSupportHostGbm());
130 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone); 134 cursor_factory_ozone_.reset(new BitmapCursorFactoryOzone);
131 cursor_.reset(new DriCursor(gpu_platform_support_host_.get())); 135 cursor_.reset(
136 new DriCursor(gpu_platform_support_host_.get(), window_manager_.get()));
132 event_factory_ozone_.reset( 137 event_factory_ozone_.reset(
133 new EventFactoryEvdev(cursor_.get(), device_manager_.get())); 138 new EventFactoryEvdev(cursor_.get(), device_manager_.get()));
134 } 139 }
135 140
136 virtual void InitializeGPU() OVERRIDE { 141 virtual void InitializeGPU() OVERRIDE {
137 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath)); 142 dri_.reset(new DriWrapper(kDefaultGraphicsCardPath));
138 dri_->Initialize(); 143 dri_->Initialize();
139 buffer_generator_.reset(new GbmBufferGenerator(dri_.get())); 144 buffer_generator_.reset(new GbmBufferGenerator(dri_.get()));
140 screen_manager_.reset(new ScreenManager(dri_.get(), 145 screen_manager_.reset(new ScreenManager(dri_.get(),
141 buffer_generator_.get())); 146 buffer_generator_.get()));
147 gpu_window_delegate_manager_.reset(new DriWindowDelegateManager());
142 if (!surface_factory_ozone_) 148 if (!surface_factory_ozone_)
143 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_)); 149 surface_factory_ozone_.reset(new GbmSurfaceFactory(use_surfaceless_));
144 150
145 surface_factory_ozone_->InitializeGpu(dri_.get(), 151 surface_factory_ozone_->InitializeGpu(dri_.get(),
146 buffer_generator_->device(), 152 buffer_generator_->device(),
147 screen_manager_.get(), 153 screen_manager_.get(),
148 &gpu_window_manager_); 154 gpu_window_delegate_manager_.get());
149 gpu_platform_support_.reset( 155 gpu_platform_support_.reset(
150 new GpuPlatformSupportGbm(surface_factory_ozone_.get(), 156 new GpuPlatformSupportGbm(surface_factory_ozone_.get(),
151 &gpu_window_manager_, 157 gpu_window_delegate_manager_.get(),
152 screen_manager_.get())); 158 screen_manager_.get()));
153 #if defined(OS_CHROMEOS) 159 #if defined(OS_CHROMEOS)
154 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>( 160 gpu_platform_support_->AddHandler(scoped_ptr<GpuPlatformSupport>(
155 new DisplayMessageHandler( 161 new DisplayMessageHandler(
156 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri( 162 scoped_ptr<NativeDisplayDelegateDri>(new NativeDisplayDelegateDri(
157 dri_.get(), 163 dri_.get(),
158 screen_manager_.get(), 164 screen_manager_.get(),
159 NULL))))); 165 NULL)))));
160 #endif 166 #endif
161 if (surface_factory_ozone_->InitializeHardware() != 167 if (surface_factory_ozone_->InitializeHardware() !=
(...skipping 10 matching lines...) Expand all
172 scoped_ptr<DeviceManager> device_manager_; 178 scoped_ptr<DeviceManager> device_manager_;
173 179
174 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_; 180 scoped_ptr<GbmSurfaceFactory> surface_factory_ozone_;
175 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_; 181 scoped_ptr<BitmapCursorFactoryOzone> cursor_factory_ozone_;
176 scoped_ptr<DriCursor> cursor_; 182 scoped_ptr<DriCursor> cursor_;
177 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; 183 scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
178 184
179 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_; 185 scoped_ptr<GpuPlatformSupportGbm> gpu_platform_support_;
180 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_; 186 scoped_ptr<GpuPlatformSupportHostGbm> gpu_platform_support_host_;
181 187
182 DriWindowManager gpu_window_manager_; 188 scoped_ptr<DriWindowDelegateManager> gpu_window_delegate_manager_;
183 DriWindowManager ui_window_manager_; 189 // TODO(dnicoara) Once we have a mock channel for the software path the window
190 // can own the delegates on the browser side. Remove this then.
191 scoped_ptr<DriWindowDelegateManager> ui_window_delegate_manager_;
192
193 // Browser side object only.
194 scoped_ptr<DriWindowManager> window_manager_;
184 195
185 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm); 196 DISALLOW_COPY_AND_ASSIGN(OzonePlatformGbm);
186 }; 197 };
187 198
188 } // namespace 199 } // namespace
189 200
190 OzonePlatform* CreateOzonePlatformGbm() { 201 OzonePlatform* CreateOzonePlatformGbm() {
191 CommandLine* cmd = CommandLine::ForCurrentProcess(); 202 CommandLine* cmd = CommandLine::ForCurrentProcess();
192 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless)); 203 return new OzonePlatformGbm(cmd->HasSwitch(switches::kOzoneUseSurfaceless));
193 } 204 }
194 205
195 } // namespace ui 206 } // namespace ui
OLDNEW
« no previous file with comments | « ui/ozone/platform/dri/ozone_platform_dri.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698