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..268daa93d5d6f8d1b7d42a744b6dcb2d49fd523c |
--- /dev/null |
+++ b/ui/gl/init/ozone_util.h |
@@ -0,0 +1,43 @@ |
+// 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 { |
+ |
+inline ui::SurfaceFactoryOzone* GetSurfaceFactory() { |
piman
2016/08/31 20:05:09
nit: gl::GetSurfaceFactory doesn't make it clear t
kylechar
2016/09/01 13:57:21
Done.
|
+ return ui::OzonePlatform::GetInstance()->GetSurfaceFactoryOzone(); |
+} |
+ |
+// Returns true if there is an GLOzone for the specified GL implementation. |
+inline bool HasGLOzone(GLImplementation impl) { |
+ return GetSurfaceFactory()->GetGLOzone(impl) != nullptr; |
piman
2016/08/31 20:05:09
Is the plan to have this always be true? If not, c
kylechar
2016/09/01 13:57:21
I think that yes, it would always be true. I could
piman
2016/09/01 17:43:04
Right, I would like that in the end state we don't
|
+} |
+ |
+// 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 GetSurfaceFactory()->GetGLOzone(impl); |
+} |
+ |
+// Returns the GLOzone for the set GL implementation or null if none exists. |
+inline ui::GLOzone* GetGLOzone() { |
+ return GetGLOzone(GetGLImplementation()); |
+} |
+ |
+} // namespace gl |
+ |
+#endif // UI_GL_INIT_OZONE_UTIL_H_ |