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

Unified Diff: ui/base/ozone/surface_factory_ozone.cc

Issue 13886018: Add a factory and defines for native Linux surfaces. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: vsync provider, better transport_dib, etc. Created 7 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: ui/base/ozone/surface_factory_ozone.cc
diff --git a/ui/base/ozone/surface_factory_ozone.cc b/ui/base/ozone/surface_factory_ozone.cc
new file mode 100644
index 0000000000000000000000000000000000000000..b50291349080acf1f036d687712c7c0ec82d7a04
--- /dev/null
+++ b/ui/base/ozone/surface_factory_ozone.cc
@@ -0,0 +1,74 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "ui/base/ozone/surface_factory_ozone.h"
+
+#include "base/memory/singleton.h"
+#include "ui/base/ozone/surface_factory_delegate_ozone.h"
+
+namespace ui {
+
+SurfaceFactory::SurfaceFactory() {
+}
+
+SurfaceFactory::~SurfaceFactory() {
+}
+
+SurfaceFactory* SurfaceFactory::GetInstance() {
+ return Singleton<SurfaceFactory>::get();
+ }
+
+void SurfaceFactory::SetDelegate(
+ SurfaceFactoryDelegate* delegate) {
+ delegate_.reset(delegate);
+}
+
+const char* SurfaceFactory::DefaultDisplaySpec() {
+ return getenv("ASH_DISPLAY_SPEC") ?: "720x1280*2";
+}
+
+void SurfaceFactory::InitializeHardware() {
+ if (delegate_)
+ delegate_->InitializeHardware();
+}
+
+void SurfaceFactory::ShutdownHardware() {
+ if (delegate_)
+ delegate_->ShutdownHardware();
+}
+
+gfx::AcceleratedWidget SurfaceFactory::GetAcceleratedWidget(
+ const gfx::GLSurfaceHandle& handle) {
+ if (delegate_) {
+ return delegate_->GetAcceleratedWidget(handle);
+ } else {
+ // TODO(rjkroege): Return appropriate AccleratedWidget for a
+ // KMS/DRM-backed native accelerated widget.
+ NOTIMPLEMENTED();
+ return (gfx::AcceleratedWidget)0;
piman 2013/05/18 01:47:19 nit: no c-style cast
rjkroege 2013/05/21 17:36:28 Removed in implementation of other suggestion. :-)
+ }
+}
+
+bool SurfaceFactory::LoadEGLGLES2Bindings() {
+ if (delegate_)
+ return delegate_->LoadEGLGLES2Bindings();
+ // TODO(rjkroege): Setup bindings for KMS/DRM GLES/EGL.
+ return false;
+}
+
+bool SurfaceFactory::AcceleratedWidgetCanBeResized(
+ gfx::AcceleratedWidget w) {
+ if (delegate_)
+ return delegate_->AcceleratedWidgetCanBeResized(w);
+ return false;
+}
+
+gfx::VSyncProvider*
+SurfaceFactory::GetVSyncProvider(gfx::AcceleratedWidget w) {
+ if (delegate_)
+ return delegate_->GetVSyncProvider(w);
+ return NULL;
+}
+
+} // namespace ui

Powered by Google App Engine
This is Rietveld 408576698