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

Unified Diff: ui/gl/init/ozone_util.h

Issue 2270463002: Add OzoneGLImpl interface. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/gl/init/gl_initializer_ozone.cc ('k') | ui/gl/test/DEPS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/init/ozone_util.h
diff --git a/ui/gl/init/ozone_util.h b/ui/gl/init/ozone_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..02360ee291fdf844317354793e5633035bb48201
--- /dev/null
+++ b/ui/gl/init/ozone_util.h
@@ -0,0 +1,45 @@
+// Copyright 2016 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.
+
+#ifndef UI_GL_INIT_OZONE_UTIL_H_
+#define UI_GL_INIT_OZONE_UTIL_H_
+
+#include "base/macros.h"
+#include "ui/gl/gl_implementation.h"
+#include "ui/ozone/public/gl_ozone.h"
+#include "ui/ozone/public/ozone_platform.h"
+#include "ui/ozone/public/surface_factory_ozone.h"
+
+namespace gl {
+namespace init {
+
+inline ui::SurfaceFactoryOzone* GetSurfaceFactoryOzone() {
+ return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone();
+}
+
+// Returns true if there is an GLOzone for the specified GL implementation.
+inline bool HasGLOzone(GLImplementation impl) {
+ return GetSurfaceFactoryOzone()->GetGLOzone(impl) != nullptr;
+}
+
+// Returns true if there is an GLOzone for the set GL implementation.
+inline bool HasGLOzone() {
+ return HasGLOzone(GetGLImplementation());
+}
+
+// Returns the GLOzone for the specified GL implementation or null if none
+// exists.
+inline ui::GLOzone* GetGLOzone(GLImplementation impl) {
+ return GetSurfaceFactoryOzone()->GetGLOzone(impl);
+}
+
+// Returns the GLOzone for the set GL implementation or null if none exists.
+inline ui::GLOzone* GetGLOzone() {
+ return GetGLOzone(GetGLImplementation());
+}
+
+} // namespace init
+} // namespace gl
+
+#endif // UI_GL_INIT_OZONE_UTIL_H_
« no previous file with comments | « ui/gl/init/gl_initializer_ozone.cc ('k') | ui/gl/test/DEPS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698