| Index: ui/ozone/platform/eglheadless/ozone_platform_eglheadless.cc
|
| diff --git a/ui/ozone/platform/egltest/ozone_platform_egltest.cc b/ui/ozone/platform/eglheadless/ozone_platform_eglheadless.cc
|
| similarity index 78%
|
| rename from ui/ozone/platform/egltest/ozone_platform_egltest.cc
|
| rename to ui/ozone/platform/eglheadless/ozone_platform_eglheadless.cc
|
| index 371ba339e323b24303e981fb98aca9e2bc7d5c75..47c5baa060dd8f3609f9cf25c31dbf61765e21ef 100644
|
| --- a/ui/ozone/platform/egltest/ozone_platform_egltest.cc
|
| +++ b/ui/ozone/platform/eglheadless/ozone_platform_eglheadless.cc
|
| @@ -2,7 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| -#include "ui/ozone/platform/egltest/ozone_platform_egltest.h"
|
| +#include "ui/ozone/platform/eglheadless/ozone_platform_eglheadless.h"
|
|
|
| #include "base/bind.h"
|
| #include "base/command_line.h"
|
| @@ -74,13 +74,14 @@ void ScaleTouchEvent(TouchEvent* event, const gfx::SizeF& size) {
|
| }
|
| }
|
|
|
| -class EgltestWindow : public PlatformWindow, public PlatformEventDispatcher {
|
| +class EglheadlessWindow : public PlatformWindow,
|
| + public PlatformEventDispatcher {
|
| public:
|
| - EgltestWindow(PlatformWindowDelegate* delegate,
|
| - LibeglplatformShimLoader* eglplatform_shim,
|
| - EventFactoryEvdev* event_factory,
|
| - const gfx::Rect& bounds);
|
| - ~EgltestWindow() override;
|
| + EglheadlessWindow(PlatformWindowDelegate* delegate,
|
| + LibeglplatformShimLoader* eglplatform_shim,
|
| + EventFactoryEvdev* event_factory,
|
| + const gfx::Rect& bounds);
|
| + ~EglheadlessWindow() override;
|
|
|
| // PlatformWindow:
|
| gfx::Rect GetBounds() override;
|
| @@ -111,13 +112,13 @@ class EgltestWindow : public PlatformWindow, public PlatformEventDispatcher {
|
| gfx::Rect bounds_;
|
| ShimNativeWindowId window_id_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(EgltestWindow);
|
| + DISALLOW_COPY_AND_ASSIGN(EglheadlessWindow);
|
| };
|
|
|
| -EgltestWindow::EgltestWindow(PlatformWindowDelegate* delegate,
|
| - LibeglplatformShimLoader* eglplatform_shim,
|
| - EventFactoryEvdev* event_factory,
|
| - const gfx::Rect& bounds)
|
| +EglheadlessWindow::EglheadlessWindow(PlatformWindowDelegate* delegate,
|
| + LibeglplatformShimLoader* eglplatform_shim,
|
| + EventFactoryEvdev* event_factory,
|
| + const gfx::Rect& bounds)
|
| : delegate_(delegate),
|
| eglplatform_shim_(eglplatform_shim),
|
| event_factory_(event_factory),
|
| @@ -128,70 +129,59 @@ EgltestWindow::EgltestWindow(PlatformWindowDelegate* delegate,
|
| ui::PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
|
| }
|
|
|
| -EgltestWindow::~EgltestWindow() {
|
| +EglheadlessWindow::~EglheadlessWindow() {
|
| ui::PlatformEventSource::GetInstance()->RemovePlatformEventDispatcher(this);
|
| if (window_id_ != SHIM_NO_WINDOW_ID)
|
| eglplatform_shim_->ShimDestroyWindow(window_id_);
|
| }
|
|
|
| -gfx::Rect EgltestWindow::GetBounds() {
|
| +gfx::Rect EglheadlessWindow::GetBounds() {
|
| return bounds_;
|
| }
|
|
|
| -void EgltestWindow::SetBounds(const gfx::Rect& bounds) {
|
| +void EglheadlessWindow::SetBounds(const gfx::Rect& bounds) {
|
| bounds_ = bounds;
|
| delegate_->OnBoundsChanged(bounds);
|
| }
|
|
|
| -void EgltestWindow::SetTitle(const base::string16& title) {
|
| -}
|
| +void EglheadlessWindow::SetTitle(const base::string16& title) {}
|
|
|
| -void EgltestWindow::Show() {
|
| -}
|
| +void EglheadlessWindow::Show() {}
|
|
|
| -void EgltestWindow::Hide() {
|
| -}
|
| +void EglheadlessWindow::Hide() {}
|
|
|
| -void EgltestWindow::Close() {
|
| -}
|
| +void EglheadlessWindow::Close() {}
|
|
|
| -void EgltestWindow::SetCapture() {
|
| -}
|
| +void EglheadlessWindow::SetCapture() {}
|
|
|
| -void EgltestWindow::ReleaseCapture() {
|
| -}
|
| +void EglheadlessWindow::ReleaseCapture() {}
|
|
|
| -void EgltestWindow::ToggleFullscreen() {
|
| -}
|
| +void EglheadlessWindow::ToggleFullscreen() {}
|
|
|
| -void EgltestWindow::Maximize() {
|
| -}
|
| +void EglheadlessWindow::Maximize() {}
|
|
|
| -void EgltestWindow::Minimize() {
|
| -}
|
| +void EglheadlessWindow::Minimize() {}
|
|
|
| -void EgltestWindow::Restore() {
|
| -}
|
| +void EglheadlessWindow::Restore() {}
|
|
|
| -void EgltestWindow::SetCursor(PlatformCursor cursor) {
|
| -}
|
| +void EglheadlessWindow::SetCursor(PlatformCursor cursor) {}
|
|
|
| -void EgltestWindow::MoveCursorTo(const gfx::Point& location) {
|
| +void EglheadlessWindow::MoveCursorTo(const gfx::Point& location) {
|
| event_factory_->WarpCursorTo(window_id_, location);
|
| }
|
|
|
| -void EgltestWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {
|
| -}
|
| +void EglheadlessWindow::ConfineCursorToBounds(const gfx::Rect& bounds) {}
|
|
|
| -PlatformImeController* EgltestWindow::GetPlatformImeController() {
|
| +PlatformImeController* EglheadlessWindow::GetPlatformImeController() {
|
| return nullptr;
|
| }
|
|
|
| -bool EgltestWindow::CanDispatchEvent(const ui::PlatformEvent& ne) {
|
| +bool EglheadlessWindow::CanDispatchEvent(const ui::PlatformEvent& ne) {
|
| return true;
|
| }
|
|
|
| -uint32_t EgltestWindow::DispatchEvent(const ui::PlatformEvent& native_event) {
|
| +uint32_t EglheadlessWindow::DispatchEvent(
|
| + const ui::PlatformEvent& native_event) {
|
| DCHECK(native_event);
|
| Event* event = static_cast<Event*>(native_event);
|
| if (event->IsTouchEvent()) {
|
| @@ -210,14 +200,14 @@ uint32_t EgltestWindow::DispatchEvent(const ui::PlatformEvent& native_event) {
|
| //
|
| // This just manages the native window lifetime using
|
| // ShimGetNativeWindow & ShimReleaseNativeWindow.
|
| -class SurfaceOzoneEgltest : public SurfaceOzoneEGL {
|
| +class SurfaceOzoneEglheadless : public SurfaceOzoneEGL {
|
| public:
|
| - SurfaceOzoneEgltest(ShimNativeWindowId window_id,
|
| - LibeglplatformShimLoader* eglplatform_shim)
|
| + SurfaceOzoneEglheadless(ShimNativeWindowId window_id,
|
| + LibeglplatformShimLoader* eglplatform_shim)
|
| : eglplatform_shim_(eglplatform_shim) {
|
| native_window_ = eglplatform_shim_->ShimGetNativeWindow(window_id);
|
| }
|
| - ~SurfaceOzoneEgltest() override {
|
| + ~SurfaceOzoneEglheadless() override {
|
| bool ret = eglplatform_shim_->ShimReleaseNativeWindow(native_window_);
|
| DCHECK(ret);
|
| }
|
| @@ -249,11 +239,11 @@ class SurfaceOzoneEgltest : public SurfaceOzoneEGL {
|
| // This finds the right EGL/GLES2 libraries for loading, and creates
|
| // a single native window via ShimCreateWindow for drawing
|
| // into.
|
| -class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone {
|
| +class SurfaceFactoryEglheadless : public ui::SurfaceFactoryOzone {
|
| public:
|
| - SurfaceFactoryEgltest(LibeglplatformShimLoader* eglplatform_shim)
|
| + SurfaceFactoryEglheadless(LibeglplatformShimLoader* eglplatform_shim)
|
| : eglplatform_shim_(eglplatform_shim) {}
|
| - ~SurfaceFactoryEgltest() override {
|
| + ~SurfaceFactoryEglheadless() override {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| }
|
|
|
| @@ -271,19 +261,20 @@ class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone {
|
| base::ThreadChecker thread_checker_;
|
| };
|
|
|
| -intptr_t SurfaceFactoryEgltest::GetNativeDisplay() {
|
| +intptr_t SurfaceFactoryEglheadless::GetNativeDisplay() {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| return eglplatform_shim_->ShimGetNativeDisplay();
|
| }
|
|
|
| -scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryEgltest::CreateEGLSurfaceForWidget(
|
| +scoped_ptr<SurfaceOzoneEGL>
|
| +SurfaceFactoryEglheadless::CreateEGLSurfaceForWidget(
|
| gfx::AcceleratedWidget widget) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| return make_scoped_ptr<SurfaceOzoneEGL>(
|
| - new SurfaceOzoneEgltest(widget, eglplatform_shim_));
|
| + new SurfaceOzoneEglheadless(widget, eglplatform_shim_));
|
| }
|
|
|
| -bool SurfaceFactoryEgltest::LoadEGLGLES2Bindings(
|
| +bool SurfaceFactoryEglheadless::LoadEGLGLES2Bindings(
|
| AddGLLibraryCallback add_gl_library,
|
| SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| @@ -299,7 +290,7 @@ bool SurfaceFactoryEgltest::LoadEGLGLES2Bindings(
|
| egl_soname, gles_soname);
|
| }
|
|
|
| -const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties(
|
| +const int32* SurfaceFactoryEglheadless::GetEGLSurfaceProperties(
|
| const int32* desired_list) {
|
| DCHECK(thread_checker_.CalledOnValidThread());
|
| static const int32 broken_props[] = {
|
| @@ -318,10 +309,10 @@ const int32* SurfaceFactoryEgltest::GetEGLSurfaceProperties(
|
| // handled by a separate library called eglplatform_shim.so.1 because
|
| // this itself is platform specific and we want to test out multiple
|
| // hardware platforms.
|
| -class OzonePlatformEgltest : public OzonePlatform {
|
| +class OzonePlatformEglheadless : public OzonePlatform {
|
| public:
|
| - OzonePlatformEgltest() : shim_initialized_(false) {}
|
| - ~OzonePlatformEgltest() override {
|
| + OzonePlatformEglheadless() : shim_initialized_(false) {}
|
| + ~OzonePlatformEglheadless() override {
|
| if (shim_initialized_)
|
| eglplatform_shim_.ShimTerminate();
|
| }
|
| @@ -373,7 +364,7 @@ class OzonePlatformEgltest : public OzonePlatform {
|
| scoped_ptr<PlatformWindow> CreatePlatformWindow(
|
| PlatformWindowDelegate* delegate,
|
| const gfx::Rect& bounds) override {
|
| - return make_scoped_ptr<PlatformWindow>(new EgltestWindow(
|
| + return make_scoped_ptr<PlatformWindow>(new EglheadlessWindow(
|
| delegate, &eglplatform_shim_, event_factory_ozone_.get(), bounds));
|
| }
|
| scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate() override {
|
| @@ -396,14 +387,15 @@ class OzonePlatformEgltest : public OzonePlatform {
|
| }
|
|
|
| void InitializeGPU() override {
|
| - surface_factory_ozone_.reset(new SurfaceFactoryEgltest(&eglplatform_shim_));
|
| + surface_factory_ozone_.reset(
|
| + new SurfaceFactoryEglheadless(&eglplatform_shim_));
|
| gpu_platform_support_.reset(CreateStubGpuPlatformSupport());
|
| }
|
|
|
| private:
|
| LibeglplatformShimLoader eglplatform_shim_;
|
| scoped_ptr<DeviceManager> device_manager_;
|
| - scoped_ptr<SurfaceFactoryEgltest> surface_factory_ozone_;
|
| + scoped_ptr<SurfaceFactoryEglheadless> surface_factory_ozone_;
|
| scoped_ptr<EventFactoryEvdev> event_factory_ozone_;
|
| scoped_ptr<CursorFactoryOzone> cursor_factory_ozone_;
|
| scoped_ptr<GpuPlatformSupport> gpu_platform_support_;
|
| @@ -412,13 +404,13 @@ class OzonePlatformEgltest : public OzonePlatform {
|
|
|
| bool shim_initialized_;
|
|
|
| - DISALLOW_COPY_AND_ASSIGN(OzonePlatformEgltest);
|
| + DISALLOW_COPY_AND_ASSIGN(OzonePlatformEglheadless);
|
| };
|
|
|
| } // namespace
|
|
|
| -OzonePlatform* CreateOzonePlatformEgltest() {
|
| - OzonePlatformEgltest* platform = new OzonePlatformEgltest;
|
| +OzonePlatform* CreateOzonePlatformEglheadless() {
|
| + OzonePlatformEglheadless* platform = new OzonePlatformEglheadless;
|
| platform->Initialize();
|
| return platform;
|
| }
|
|
|