Commit c90eb80f authored by spang@chromium.org's avatar spang@chromium.org

ozone: Remove GetAcceleratedWidget from SurfaceFactoryOzone

This API is no longer necessary with the PlatformWindow interface.

TEST=built & ran on link_freon
BUG=392280
TBR=danakj
NOTRY=true

Review URL: https://codereview.chromium.org/406093002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@284768 0039d316-1c4b-4281-b951-d872f2087c98
parent bd60defe
......@@ -53,7 +53,6 @@ class MockSurfaceFactoryOzone : public ui::SurfaceFactoryOzone {
}
virtual void ShutdownHardware() OVERRIDE {}
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE { return 1; }
virtual bool LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE {
......@@ -105,9 +104,9 @@ void SoftwareOutputDeviceOzoneTest::SetUp() {
surface_factory_.reset(new MockSurfaceFactoryOzone());
const gfx::Size size(500, 400);
compositor_.reset(new ui::Compositor(
ui::SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget(),
context_factory));
const gfx::AcceleratedWidget kTestAcceleratedWidget = 1;
compositor_.reset(
new ui::Compositor(kTestAcceleratedWidget, context_factory));
compositor_->SetScaleAndSize(1.0f, size);
output_device_.reset(new content::SoftwareOutputDeviceOzone(
......
......@@ -128,11 +128,6 @@ ui::SurfaceFactoryOzone::HardwareState CacaWindowManager::InitializeHardware() {
void CacaWindowManager::ShutdownHardware() {
}
gfx::AcceleratedWidget CacaWindowManager::GetAcceleratedWidget() {
NOTREACHED();
return gfx::kNullAcceleratedWidget;
}
bool CacaWindowManager::LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) {
......
......@@ -31,7 +31,6 @@ class CacaWindowManager : public SurfaceFactoryOzone {
// ui::SurfaceFactoryOzone overrides:
virtual HardwareState InitializeHardware() OVERRIDE;
virtual void ShutdownHardware() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual bool LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE;
......
......@@ -91,14 +91,6 @@ void DriSurfaceFactory::ShutdownHardware() {
state_ = UNINITIALIZED;
}
gfx::AcceleratedWidget DriSurfaceFactory::GetAcceleratedWidget() {
CHECK(state_ != FAILED);
// We're not using 0 since other code assumes that a 0 AcceleratedWidget is an
// invalid widget.
return ++allocated_widgets_;
}
scoped_ptr<ui::SurfaceOzoneCanvas> DriSurfaceFactory::CreateCanvasForWidget(
gfx::AcceleratedWidget w) {
CHECK(state_ == INITIALIZED);
......@@ -115,6 +107,14 @@ bool DriSurfaceFactory::LoadEGLGLES2Bindings(
return false;
}
gfx::AcceleratedWidget DriSurfaceFactory::GetAcceleratedWidget() {
CHECK(state_ != FAILED);
// We're not using 0 since other code assumes that a 0 AcceleratedWidget is an
// invalid widget.
return ++allocated_widgets_;
}
gfx::Size DriSurfaceFactory::GetWidgetSize(gfx::AcceleratedWidget w) {
base::WeakPtr<HardwareDisplayController> controller =
screen_manager_->GetDisplayController(w);
......
......@@ -33,16 +33,16 @@ class DriSurfaceFactory : public ui::SurfaceFactoryOzone,
// SurfaceFactoryOzone overrides:
virtual HardwareState InitializeHardware() OVERRIDE;
virtual void ShutdownHardware() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual scoped_ptr<ui::SurfaceOzoneCanvas> CreateCanvasForWidget(
gfx::AcceleratedWidget w) OVERRIDE;
virtual bool LoadEGLGLES2Bindings(
AddGLLibraryCallback add_gl_library,
SetGLGetProcAddressProcCallback set_gl_get_proc_address) OVERRIDE;
// Create a new window/surface/widget identifier.
gfx::AcceleratedWidget GetAcceleratedWidget();
// Determine dimensions of a widget.
gfx::Size GetWidgetSize(gfx::AcceleratedWidget w);
// HardwareCursorDelegate:
......
......@@ -6,6 +6,7 @@
#include "ui/events/event.h"
#include "ui/events/platform/platform_event_source.h"
#include "ui/ozone/platform/dri/dri_surface_factory.h"
#include "ui/ozone/public/cursor_factory_ozone.h"
#include "ui/ozone/public/surface_factory_ozone.h"
#include "ui/platform_window/platform_window_delegate.h"
......@@ -13,9 +14,10 @@
namespace ui {
DriWindow::DriWindow(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds)
const gfx::Rect& bounds,
DriSurfaceFactory* surface_factory)
: delegate_(delegate), bounds_(bounds) {
widget_ = SurfaceFactoryOzone::GetInstance()->GetAcceleratedWidget();
widget_ = surface_factory->GetAcceleratedWidget();
delegate_->OnAcceleratedWidgetAvailable(widget_);
PlatformEventSource::GetInstance()->AddPlatformEventDispatcher(this);
}
......
......@@ -12,11 +12,14 @@
namespace ui {
class DriSurfaceFactory;
class DriWindow : public PlatformWindow,
public PlatformEventDispatcher {
public:
DriWindow(PlatformWindowDelegate* delegate,
const gfx::Rect& bounds);
const gfx::Rect& bounds,
DriSurfaceFactory* surface_factory);
virtual ~DriWindow();
// PlatformWindow:
......
......@@ -65,7 +65,8 @@ class OzonePlatformDri : public OzonePlatform {
virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
const gfx::Rect& bounds) OVERRIDE {
return scoped_ptr<PlatformWindow>(new DriWindow(delegate, bounds));
return scoped_ptr<PlatformWindow>(
new DriWindow(delegate, bounds, surface_factory_ozone_.get()));
}
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
......
......@@ -97,7 +97,8 @@ class OzonePlatformGbm : public OzonePlatform {
virtual scoped_ptr<PlatformWindow> CreatePlatformWindow(
PlatformWindowDelegate* delegate,
const gfx::Rect& bounds) OVERRIDE {
return scoped_ptr<PlatformWindow>(new DriWindow(delegate, bounds));
return scoped_ptr<PlatformWindow>(
new DriWindow(delegate, bounds, surface_factory_ozone_.get()));
}
#if defined(OS_CHROMEOS)
virtual scoped_ptr<NativeDisplayDelegate> CreateNativeDisplayDelegate()
......
......@@ -200,7 +200,6 @@ class SurfaceFactoryEgltest : public ui::SurfaceFactoryOzone {
virtual HardwareState InitializeHardware() OVERRIDE;
virtual void ShutdownHardware() OVERRIDE;
virtual intptr_t GetNativeDisplay() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual scoped_ptr<SurfaceOzoneEGL> CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) OVERRIDE;
virtual const int32* GetEGLSurfaceProperties(
......@@ -225,11 +224,6 @@ intptr_t SurfaceFactoryEgltest::GetNativeDisplay() {
return eglplatform_shim_->ShimGetNativeDisplay();
}
gfx::AcceleratedWidget SurfaceFactoryEgltest::GetAcceleratedWidget() {
NOTREACHED();
return gfx::kNullAcceleratedWidget;
}
scoped_ptr<SurfaceOzoneEGL> SurfaceFactoryEgltest::CreateEGLSurfaceForWidget(
gfx::AcceleratedWidget widget) {
return make_scoped_ptr<SurfaceOzoneEGL>(
......
......@@ -98,11 +98,6 @@ SurfaceFactoryOzone::HardwareState TestWindowManager::InitializeHardware() {
void TestWindowManager::ShutdownHardware() {
}
gfx::AcceleratedWidget TestWindowManager::GetAcceleratedWidget() {
NOTREACHED();
return -1;
}
scoped_ptr<SurfaceOzoneCanvas> TestWindowManager::CreateCanvasForWidget(
gfx::AcceleratedWidget widget) {
TestWindow* window = windows_.Lookup(widget);
......
......@@ -34,7 +34,6 @@ class TestWindowManager : public SurfaceFactoryOzone {
// SurfaceFactoryOzone:
virtual HardwareState InitializeHardware() OVERRIDE;
virtual void ShutdownHardware() OVERRIDE;
virtual gfx::AcceleratedWidget GetAcceleratedWidget() OVERRIDE;
virtual scoped_ptr<SurfaceOzoneCanvas> CreateCanvasForWidget(
gfx::AcceleratedWidget w) OVERRIDE;
virtual bool LoadEGLGLES2Bindings(
......
......@@ -97,11 +97,6 @@ class OZONE_BASE_EXPORT SurfaceFactoryOzone {
// display connection for the native display.
virtual intptr_t GetNativeDisplay();
// Obtains an AcceleratedWidget backed by a native Linux framebuffer.
// The returned AcceleratedWidget is an opaque token that must realized
// before it can be used to create a GL surface.
virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
// Create SurfaceOzoneEGL for the specified gfx::AcceleratedWidget.
//
// Note: When used from content, this is called in the GPU process. The
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment