| OLD | NEW |
| 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/egltest/ozone_platform_egltest.h" | 5 #include "ui/ozone/platform/eglheadless/ozone_platform_eglheadless.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/environment.h" | 9 #include "base/environment.h" |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| 11 #include "base/path_service.h" | 11 #include "base/path_service.h" |
| 12 #include "base/threading/thread_checker.h" | 12 #include "base/threading/thread_checker.h" |
| 13 #include "library_loaders/libeglplatform_shim.h" | 13 #include "library_loaders/libeglplatform_shim.h" |
| 14 #include "third_party/khronos/EGL/egl.h" | 14 #include "third_party/khronos/EGL/egl.h" |
| 15 #include "ui/events/devices/device_data_manager.h" | 15 #include "ui/events/devices/device_data_manager.h" |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 double ratio = std::sqrt(size.GetArea() / touchscreen_size.GetArea()); | 67 double ratio = std::sqrt(size.GetArea() / touchscreen_size.GetArea()); |
| 68 | 68 |
| 69 event->set_location(location); | 69 event->set_location(location); |
| 70 event->set_radius_x(event->pointer_details().radius_x() * ratio); | 70 event->set_radius_x(event->pointer_details().radius_x() * ratio); |
| 71 event->set_radius_y(event->pointer_details().radius_y() * ratio); | 71 event->set_radius_y(event->pointer_details().radius_y() * ratio); |
| 72 return; | 72 return; |
| 73 } | 73 } |
| 74 } | 74 } |
| 75 } | 75 } |
| 76 | 76 |
| 77 class EgltestWindow : public PlatformWindow, public PlatformEventDispatcher { | 77 class EglheadlessWindow : public PlatformWindow, |
| 78 public PlatformEventDispatcher { |
| 78 public: | 79 public: |
| 79 EgltestWindow(PlatformWindowDelegate* delegate, | 80 EglheadlessWindow(PlatformWindowDelegate* delegate, |
| 80 LibeglplatformShimLoader* eglplatform_shim, | 81 LibeglplatformShimLoader* eglplatform_shim, |
| 81 EventFactoryEvdev* event_factory, | 82 EventFactoryEvdev* event_factory, |
| 82 const gfx::Rect& bounds); | 83 const gfx::Rect& bounds); |
| 83 ~EgltestWindow() override; | 84 ~EglheadlessWindow() override; |
| 84 | 85 |
| 85 // PlatformWindow: | 86 // PlatformWindow: |
| 86 gfx::Rect GetBounds() override; | 87 gfx::Rect GetBounds() override; |
| 87 void SetBounds(const gfx::Rect& bounds) override; | 88 void SetBounds(const gfx::Rect& bounds) override; |
| 88 void SetTitle(const base::string16& title) override; | 89 void SetTitle(const base::string16& title) override; |
| 89 void Show() override; | 90 void Show() override; |
| 90 void Hide() override; | 91 void Hide() override; |
| 91 void Close() override; | 92 void Close() override; |
| 92 void SetCapture() override; | 93 void SetCapture() override; |
| 93 void ReleaseCapture() override; | 94 void ReleaseCapture() override; |
| (...skipping 10 matching lines...) Expand all Loading... |
| 104 bool CanDispatchEvent(const PlatformEvent& event) override; | 105 bool CanDispatchEvent(const PlatformEvent& event) override; |
| 105 uint32_t DispatchEvent(const PlatformEvent& event) override; | 106 uint32_t DispatchEvent(const PlatformEvent& event) override; |
| 106 | 107 |
| 107 private: | 108 private: |
| 108 PlatformWindowDelegate* delegate_; | 109 PlatformWindowDelegate* delegate_; |
| 109 LibeglplatformShimLoader* eglplatform_shim_; | 110 LibeglplatformShimLoader* eglplatform_shim_; |
| 110 EventFactoryEvdev* event_factory_; | 111 EventFactoryEvdev* event_factory_; |
| 111 gfx::Rect bounds_; | 112 gfx::Rect bounds_; |
| 112 ShimNativeWindowId window_id_; | 113 ShimNativeWindowId window_id_; |
| 113 | 114 |
| 114 DISALLOW_COPY_AND_ASSIGN(EgltestWindow); | 115 DISALLOW_COPY_AND_ASSIGN(EglheadlessWindow); |
| 115 }; | 116 }; |
| 116 | 117 |
| 117 EgltestWindow::EgltestWindow(PlatformWindowDelegate* delegate, | 118 EglheadlessWindow::EglheadlessWindow(PlatformWindowDelegate* delegate, |
| 118 LibeglplatformShimLoader* eglplatform_shim, | 119 LibeglplatformShimLoader* eglplatform_shim, |
| 119 EventFactoryEvdev* event_factory, | 120 EventFactoryEvdev* event_factory, |
| 120 const gfx::Rect& bounds) | 121 const gfx::Rect& bounds) |
| 121 : delegate_(delegate), | 122 : delegate_(delegate), |
| 122 eglplatform_shim_(eglplatform_shim), | 123 eglplatform_shim_(eglplatform_shim), |
| 123 event_factory_(event_factory), | 124 event_factory_(event_factory), |
| 124 bounds_(bounds), | 125 bounds_(bounds), |
| 125 window_id_(SHIM_NO_WINDOW_ID) { | 126 window_id_(SHIM_NO_WINDOW_ID) { |
| 126 window_id_ = eglplatform_shim_->ShimCreateWindow(); | 127 window_id_ = eglplatform_shim_->ShimCreateWindow(); |
| 127 delegate_->OnAcceleratedWidgetAvailable(window_id_, 1.f); | 128 delegate_->OnAcceleratedWidgetAvailable(window_id_, 1.f); |
| 128 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); | 129 ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this); |
| 129 } | 130 } |
| 130 | 131 |
| 131 EgltestWindow::~EgltestWindow() { | 132 EglheadlessWindow::~EglheadlessWindow() { |
| 132 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); | 133 ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this); |
| 133 if (window_id_ != SHIM_NO_WINDOW_ID) | 134 if (window_id_ != SHIM_NO_WINDOW_ID) |
| 134 eglplatform_shim_->ShimDestroyWindow(window_id_); | 135 eglplatform_shim_->ShimDestroyWindow(window_id_); |
| 135 } | 136 } |
| 136 | 137 |
| 137 gfx::Rect EgltestWindow::GetBounds() { | 138 gfx::Rect EglheadlessWindow::GetBounds() { |
| 138 return bounds_; | 139 return bounds_; |
| 139 } | 140 } |
| 140 | 141 |
| 141 void EgltestWindow::SetBounds(const gfx::Rect& bounds) { | 142 void EglheadlessWindow::SetBounds(const gfx::Rect& bounds) { |
| 142 bounds_ = bounds; | 143 bounds_ = bounds; |
| 143 delegate_->OnBoundsChanged(bounds); | 144 delegate_->OnBoundsChanged(bounds); |
| 144 } | 145 } |
| 145 | 146 |
| 146 void EgltestWindow::SetTitle(const base::string16& title) { | 147 void EglheadlessWindow::SetTitle(const base::string16& title) {} |
| 147 } | |
| 148 | 148 |
| 149 void EgltestWindow::Show() { | 149 void EglheadlessWindow::Show() {} |
| 150 } | |
| 151 | 150 |
| 152 void EgltestWindow::Hide() { | 151 void EglheadlessWindow::Hide() {} |
| 153 } | |
| 154 | 152 |
| 155 void EgltestWindow::Close() { | 153 void EglheadlessWindow::Close() {} |
| 156 } | |
| 157 | 154 |
| 158 void EgltestWindow::SetCapture() { | 155 void EglheadlessWindow::SetCapture() {} |
| 159 } | |
| 160 | 156 |
| 161 void EgltestWindow::ReleaseCapture() { | 157 void EglheadlessWindow::ReleaseCapture() {} |
| 162 } | |
| 163 | 158 |
| 164 void EgltestWindow::ToggleFullscreen() { | 159 void EglheadlessWindow::ToggleFullscreen() {} |
| 165 } | |
| 166 | 160 |
| 167 void EgltestWindow::Maximize() { | 161 void EglheadlessWindow::Maximize() {} |
| 168 } | |
| 169 | 162 |
| 170 void EgltestWindow::Minimize() { | 163 void EglheadlessWindow::Minimize() {} |
| 171 } | |
| 172 | 164 |
| 173 void EgltestWindow::Restore() { | 165 void EglheadlessWindow::Restore() {} |
| 174 } | |
| 175 | 166 |
| 176 void EgltestWindow::SetCursor(PlatformCursor cursor) { | 167 void EglheadlessWindow::SetCursor(PlatformCursor cursor) {} |
| 177 } | |
| 178 | 168 |
| 179 void EgltestWindow::MoveCursorTo(const gfx::Point& location) { | 169 void EglheadlessWindow::MoveCursorTo(const gfx::Point& location) { |
| 180 event_factory_->WarpCursorTo(window_id_, location); | 170 event_factory_->WarpCursorTo(window_id_, location); |
| 181 } | 171 } |
| 182 | 172 |
| 183 void EgltestWindow::ConfineCursorToBounds(const gfx::Rect& bounds) { | 173 void EglheadlessWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {} |
| 184 } | |
| 185 | 174 |
| 186 PlatformImeController* EgltestWindow::GetPlatformImeController() { | 175 PlatformImeController* EglheadlessWindow::GetPlatformImeController() { |
| 187 return nullptr; | 176 return nullptr; |
| 188 } | 177 } |
| 189 | 178 |
| 190 bool EgltestWindow::CanDispatchEvent(const ui::PlatformEvent& ne) { | 179 bool EglheadlessWindow::CanDispatchEvent(const ui::PlatformEvent& ne) { |
| 191 return true; | 180 return true; |
| 192 } | 181 } |
| 193 | 182 |
| 194 uint32_t EgltestWindow::DispatchEvent(const ui::PlatformEvent& native_event) { | 183 uint32_t EglheadlessWindow::DispatchEvent( |
| 184 const ui::PlatformEvent& native_event) { |
| 195 DCHECK(native_event); | 185 DCHECK(native_event); |
| 196 Event* event = static_cast<Event*>(native_event); | 186 Event* event = static_cast<Event*>(native_event); |
| 197 if (event->IsTouchEvent()) { | 187 if (event->IsTouchEvent()) { |
| 198 ScaleTouchEvent(static_cast<TouchEvent*>(event), | 188 ScaleTouchEvent(static_cast<TouchEvent*>(event), |
| 199 gfx::SizeF(bounds_.size())); | 189 gfx::SizeF(bounds_.size())); |
| 200 } | 190 } |
| 201 | 191 |
| 202 DispatchEventFromNativeUiEvent( | 192 DispatchEventFromNativeUiEvent( |
| 203 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, | 193 native_event, base::Bind(&PlatformWindowDelegate::DispatchEvent, |
| 204 base::Unretained(delegate_))); | 194 base::Unretained(delegate_))); |
| 205 | 195 |
| 206 return ui::POST_DISPATCH_STOP_PROPAGATION; | 196 return ui::POST_DISPATCH_STOP_PROPAGATION; |
| 207 } | 197 } |
| 208 | 198 |
| 209 // EGL surface wrapper for libeglplatform_shim. | 199 // EGL surface wrapper for libeglplatform_shim. |
| 210 // | 200 // |
| 211 // This just manages the native window lifetime using | 201 // This just manages the native window lifetime using |
| 212 // ShimGetNativeWindow & ShimReleaseNativeWindow. | 202 // ShimGetNativeWindow & ShimReleaseNativeWindow. |
| 213 class SurfaceOzoneEgltest : public SurfaceOzoneEGL { | 203 class SurfaceOzoneEglheadless : public SurfaceOzoneEGL { |
| 214 public: | 204 public: |
| 215 SurfaceOzoneEgltest(ShimNativeWindowId window_id, | 205 SurfaceOzoneEglheadless(ShimNativeWindowId window_id, |
| 216 LibeglplatformShimLoader* eglplatform_shim) | 206 LibeglplatformShimLoader* eglplatform_shim) |
| 217 : eglplatform_shim_(eglplatform_shim) { | 207 : eglplatform_shim_(eglplatform_shim) { |
| 218 native_window_ = eglplatform_shim_->ShimGetNativeWindow(window_id); | 208 native_window_ = eglplatform_shim_->ShimGetNativeWindow(window_id); |
| 219 } | 209 } |
| 220 ~SurfaceOzoneEgltest() override { | 210 ~SurfaceOzoneEglheadless() override { |
| 221 bool ret = eglplatform_shim_->ShimReleaseNativeWindow(native_window_); | 211 bool ret = eglplatform_shim_->ShimReleaseNativeWindow(native_window_); |
| 222 DCHECK(ret); | 212 DCHECK(ret); |
| 223 } | 213 } |
| 224 | 214 |
| 225 intptr_t GetNativeWindow() override { return native_window_; } | 215 intptr_t GetNativeWindow() override { return native_window_; } |
| 226 | 216 |
| 227 bool OnSwapBuffers() override { return true; } | 217 bool OnSwapBuffers() override { return true; } |
| 228 | 218 |
| 229 bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override { | 219 bool OnSwapBuffersAsync(const SwapCompletionCallback& callback) override { |
| 230 callback.Run(gfx::SwapResult::SWAP_ACK); | 220 callback.Run(gfx::SwapResult::SWAP_ACK); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 242 private: | 232 private: |
| 243 LibeglplatformShimLoader* eglplatform_shim_; | 233 LibeglplatformShimLoader* eglplatform_shim_; |
| 244 intptr_t native_window_; | 234 intptr_t native_window_; |
| 245 }; | 235 }; |
| 246 | 236 |
| 247 // EGL surface factory for libeglplatform_shim. | 237 // EGL surface factory for libeglplatform_shim. |
| 248 // | 238 // |
| 249 // This finds the right EGL/GLES2 libraries for loading, and creates | 239 // This finds the right EGL/GLES2 libraries for loading, and creates |
| 250 // a single native window via ShimCreateWindow for drawing | 240 // a single native window via ShimCreateWindow for drawing |
| 251 // into. | 241 // into. |
| 252 class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone { | 242 class SurfaceFactoryEglheadless : public ui::SurfaceFactoryOzone { |
| 253 public: | 243 public: |
| 254 SurfaceFactoryEgltest(LibeglplatformShimLoader* eglplatform_shim) | 244 SurfaceFactoryEglheadless(LibeglplatformShimLoader* eglplatform_shim) |
| 255 : eglplatform_shim_(eglplatform_shim) {} | 245 : eglplatform_shim_(eglplatform_shim) {} |
| 256 ~SurfaceFactoryEgltest() override { | 246 ~SurfaceFactoryEglheadless() override { |
| 257 DCHECK(thread_checker_.CalledOnValidThread()); | 247 DCHECK(thread_checker_.CalledOnValidThread()); |
| 258 } | 248 } |
| 259 | 249 |
| 260 // SurfaceFactoryOzone: | 250 // SurfaceFactoryOzone: |
| 261 intptr_t GetNativeDisplay() override; | 251 intptr_t GetNativeDisplay() override; |
| 262 scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( | 252 scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget( |
| 263 gfx::AcceleratedWidget widget) override; | 253 gfx::AcceleratedWidget widget) override; |
| 264 const int32* GetEGLSurfaceProperties(const int32* desired_list) override; | 254 const int32* GetEGLSurfaceProperties(const int32* desired_list) override; |
| 265 bool LoadEGLGLES2Bindings( | 255 bool LoadEGLGLES2Bindings( |
| 266 AddGLLibraryCallback add_gl_library, | 256 AddGLLibraryCallback add_gl_library, |
| 267 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; | 257 SetGLGetProcAddressProcCallback set_gl_get_proc_address) override; |
| 268 | 258 |
| 269 private: | 259 private: |
| 270 LibeglplatformShimLoader* eglplatform_shim_; | 260 LibeglplatformShimLoader* eglplatform_shim_; |
| 271 base::ThreadChecker thread_checker_; | 261 base::ThreadChecker thread_checker_; |
| 272 }; | 262 }; |
| 273 | 263 |
| 274 intptr_t SurfaceFactoryEgltest::GetNativeDisplay() { | 264 intptr_t SurfaceFactoryEglheadless::GetNativeDisplay() { |
| 275 DCHECK(thread_checker_.CalledOnValidThread()); | 265 DCHECK(thread_checker_.CalledOnValidThread()); |
| 276 return eglplatform_shim_->ShimGetNativeDisplay(); | 266 return eglplatform_shim_->ShimGetNativeDisplay(); |
| 277 } | 267 } |
| 278 | 268 |
| 279 scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryEgltest::CreateEGLSurfaceForWidget( | 269 scoped_ptr<SurfaceOzoneEGL> |
| 270 SurfaceFactoryEglheadless::CreateEGLSurfaceForWidget( |
| 280 gfx::AcceleratedWidget widget) { | 271 gfx::AcceleratedWidget widget) { |
| 281 DCHECK(thread_checker_.CalledOnValidThread()); | 272 DCHECK(thread_checker_.CalledOnValidThread()); |
| 282 return make_scoped_ptr<SurfaceOzoneEGL>( | 273 return make_scoped_ptr<SurfaceOzoneEGL>( |
| 283 new SurfaceOzoneEgltest(widget, eglplatform_shim_)); | 274 new SurfaceOzoneEglheadless(widget, eglplatform_shim_)); |
| 284 } | 275 } |
| 285 | 276 |
| 286 bool SurfaceFactoryEgltest::LoadEGLGLES2Bindings( | 277 bool SurfaceFactoryEglheadless::LoadEGLGLES2Bindings( |
| 287 AddGLLibraryCallback add_gl_library, | 278 AddGLLibraryCallback add_gl_library, |
| 288 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { | 279 SetGLGetProcAddressProcCallback set_gl_get_proc_address) { |
| 289 DCHECK(thread_checker_.CalledOnValidThread()); | 280 DCHECK(thread_checker_.CalledOnValidThread()); |
| 290 const char* egl_soname = eglplatform_shim_->ShimQueryString(SHIM_EGL_LIBRARY); | 281 const char* egl_soname = eglplatform_shim_->ShimQueryString(SHIM_EGL_LIBRARY); |
| 291 const char* gles_soname = | 282 const char* gles_soname = |
| 292 eglplatform_shim_->ShimQueryString(SHIM_GLES_LIBRARY); | 283 eglplatform_shim_->ShimQueryString(SHIM_GLES_LIBRARY); |
| 293 if (!egl_soname) | 284 if (!egl_soname) |
| 294 egl_soname = kDefaultEglSoname; | 285 egl_soname = kDefaultEglSoname; |
| 295 if (!gles_soname) | 286 if (!gles_soname) |
| 296 gles_soname = kDefaultGlesSoname; | 287 gles_soname = kDefaultGlesSoname; |
| 297 | 288 |
| 298 return ::ui::LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address, | 289 return ::ui::LoadEGLGLES2Bindings(add_gl_library, set_gl_get_proc_address, |
| 299 egl_soname, gles_soname); | 290 egl_soname, gles_soname); |
| 300 } | 291 } |
| 301 | 292 |
| 302 const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties( | 293 const int32* SurfaceFactoryEglheadless::GetEGLSurfaceProperties( |
| 303 const int32* desired_list) { | 294 const int32* desired_list) { |
| 304 DCHECK(thread_checker_.CalledOnValidThread()); | 295 DCHECK(thread_checker_.CalledOnValidThread()); |
| 305 static const int32 broken_props[] = { | 296 static const int32 broken_props[] = { |
| 306 EGL_RENDERABLE_TYPE, | 297 EGL_RENDERABLE_TYPE, |
| 307 EGL_OPENGL_ES2_BIT, | 298 EGL_OPENGL_ES2_BIT, |
| 308 EGL_SURFACE_TYPE, | 299 EGL_SURFACE_TYPE, |
| 309 EGL_WINDOW_BIT | EGL_PBUFFER_BIT, | 300 EGL_WINDOW_BIT | EGL_PBUFFER_BIT, |
| 310 EGL_NONE, | 301 EGL_NONE, |
| 311 }; | 302 }; |
| 312 return broken_props; | 303 return broken_props; |
| 313 } | 304 } |
| 314 | 305 |
| 315 // Test platform for EGL. | 306 // Test platform for EGL. |
| 316 // | 307 // |
| 317 // This is a tiny EGL-based platform. Creation of the native window is | 308 // This is a tiny EGL-based platform. Creation of the native window is |
| 318 // handled by a separate library called eglplatform_shim.so.1 because | 309 // handled by a separate library called eglplatform_shim.so.1 because |
| 319 // this itself is platform specific and we want to test out multiple | 310 // this itself is platform specific and we want to test out multiple |
| 320 // hardware platforms. | 311 // hardware platforms. |
| 321 class OzonePlatformEgltest : public OzonePlatform { | 312 class OzonePlatformEglheadless : public OzonePlatform { |
| 322 public: | 313 public: |
| 323 OzonePlatformEgltest() : shim_initialized_(false) {} | 314 OzonePlatformEglheadless() : shim_initialized_(false) {} |
| 324 ~OzonePlatformEgltest() override { | 315 ~OzonePlatformEglheadless() override { |
| 325 if (shim_initialized_) | 316 if (shim_initialized_) |
| 326 eglplatform_shim_.ShimTerminate(); | 317 eglplatform_shim_.ShimTerminate(); |
| 327 } | 318 } |
| 328 | 319 |
| 329 void LoadShim() { | 320 void LoadShim() { |
| 330 std::string library = GetShimLibraryName(); | 321 std::string library = GetShimLibraryName(); |
| 331 | 322 |
| 332 if (eglplatform_shim_.Load(library)) | 323 if (eglplatform_shim_.Load(library)) |
| 333 return; | 324 return; |
| 334 | 325 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 } | 357 } |
| 367 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { | 358 GpuPlatformSupportHost* GetGpuPlatformSupportHost() override { |
| 368 return gpu_platform_support_host_.get(); | 359 return gpu_platform_support_host_.get(); |
| 369 } | 360 } |
| 370 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { | 361 scoped_ptr<SystemInputInjector> CreateSystemInputInjector() override { |
| 371 return nullptr; // no input injection support. | 362 return nullptr; // no input injection support. |
| 372 } | 363 } |
| 373 scoped_ptr<PlatformWindow> CreatePlatformWindow( | 364 scoped_ptr<PlatformWindow> CreatePlatformWindow( |
| 374 PlatformWindowDelegate* delegate, | 365 PlatformWindowDelegate* delegate, |
| 375 const gfx::Rect& bounds) override { | 366 const gfx::Rect& bounds) override { |
| 376 return make_scoped_ptr<PlatformWindow>(new EgltestWindow( | 367 return make_scoped_ptr<PlatformWindow>(new EglheadlessWindow( |
| 377 delegate, &eglplatform_shim_, event_factory_ozone_.get(), bounds)); | 368 delegate, &eglplatform_shim_, event_factory_ozone_.get(), bounds)); |
| 378 } | 369 } |
| 379 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { | 370 scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override { |
| 380 return make_scoped_ptr(new NativeDisplayDelegateOzone()); | 371 return make_scoped_ptr(new NativeDisplayDelegateOzone()); |
| 381 } | 372 } |
| 382 base::ScopedFD OpenClientNativePixmapDevice() const override { | 373 base::ScopedFD OpenClientNativePixmapDevice() const override { |
| 383 return base::ScopedFD(); | 374 return base::ScopedFD(); |
| 384 } | 375 } |
| 385 | 376 |
| 386 void InitializeUI() override { | 377 void InitializeUI() override { |
| 387 device_manager_ = CreateDeviceManager(); | 378 device_manager_ = CreateDeviceManager(); |
| 388 overlay_manager_.reset(new StubOverlayManager()); | 379 overlay_manager_.reset(new StubOverlayManager()); |
| 389 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( | 380 KeyboardLayoutEngineManager::SetKeyboardLayoutEngine( |
| 390 make_scoped_ptr(new StubKeyboardLayoutEngine())); | 381 make_scoped_ptr(new StubKeyboardLayoutEngine())); |
| 391 event_factory_ozone_.reset(new EventFactoryEvdev( | 382 event_factory_ozone_.reset(new EventFactoryEvdev( |
| 392 NULL, device_manager_.get(), | 383 NULL, device_manager_.get(), |
| 393 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); | 384 KeyboardLayoutEngineManager::GetKeyboardLayoutEngine())); |
| 394 cursor_factory_ozone_.reset(new CursorFactoryOzone()); | 385 cursor_factory_ozone_.reset(new CursorFactoryOzone()); |
| 395 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); | 386 gpu_platform_support_host_.reset(CreateStubGpuPlatformSupportHost()); |
| 396 } | 387 } |
| 397 | 388 |
| 398 void InitializeGPU() override { | 389 void InitializeGPU() override { |
| 399 surface_factory_ozone_.reset(new SurfaceFactoryEgltest(&eglplatform_shim_)); | 390 surface_factory_ozone_.reset( |
| 391 new SurfaceFactoryEglheadless(&eglplatform_shim_)); |
| 400 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); | 392 gpu_platform_support_.reset(CreateStubGpuPlatformSupport()); |
| 401 } | 393 } |
| 402 | 394 |
| 403 private: | 395 private: |
| 404 LibeglplatformShimLoader eglplatform_shim_; | 396 LibeglplatformShimLoader eglplatform_shim_; |
| 405 scoped_ptr<DeviceManager> device_manager_; | 397 scoped_ptr<DeviceManager> device_manager_; |
| 406 scoped_ptr<SurfaceFactoryEgltest> surface_factory_ozone_; | 398 scoped_ptr<SurfaceFactoryEglheadless> surface_factory_ozone_; |
| 407 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; | 399 scoped_ptr<EventFactoryEvdev> event_factory_ozone_; |
| 408 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; | 400 scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_; |
| 409 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; | 401 scoped_ptr<GpuPlatformSupport> gpu_platform_support_; |
| 410 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; | 402 scoped_ptr<GpuPlatformSupportHost> gpu_platform_support_host_; |
| 411 scoped_ptr<OverlayManagerOzone> overlay_manager_; | 403 scoped_ptr<OverlayManagerOzone> overlay_manager_; |
| 412 | 404 |
| 413 bool shim_initialized_; | 405 bool shim_initialized_; |
| 414 | 406 |
| 415 DISALLOW_COPY_AND_ASSIGN(OzonePlatformEgltest); | 407 DISALLOW_COPY_AND_ASSIGN(OzonePlatformEglheadless); |
| 416 }; | 408 }; |
| 417 | 409 |
| 418 } // namespace | 410 } // namespace |
| 419 | 411 |
| 420 OzonePlatform* CreateOzonePlatformEgltest() { | 412 OzonePlatform* CreateOzonePlatformEglheadless() { |
| 421 OzonePlatformEgltest* platform = new OzonePlatformEgltest; | 413 OzonePlatformEglheadless* platform = new OzonePlatformEglheadless; |
| 422 platform->Initialize(); | 414 platform->Initialize(); |
| 423 return platform; | 415 return platform; |
| 424 } | 416 } |
| 425 | 417 |
| 426 } // namespace ui | 418 } // namespace ui |
| OLD | NEW |