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

Unified Diff: ui/gfx/gl/gl_context.cc

Issue 10392068: ui: Move gl/ directory out of gfx/, up to ui/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix mac_rel Created 8 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
« no previous file with comments | « ui/gfx/gl/gl_context.h ('k') | ui/gfx/gl/gl_context_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gfx/gl/gl_context.cc
diff --git a/ui/gfx/gl/gl_context.cc b/ui/gfx/gl/gl_context.cc
deleted file mode 100644
index dc94b044b18e91070489c77645cbf33c5d76f14f..0000000000000000000000000000000000000000
--- a/ui/gfx/gl/gl_context.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (c) 2012 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 <string>
-
-#include "base/command_line.h"
-#include "base/lazy_instance.h"
-#include "base/logging.h"
-#include "base/threading/thread_local.h"
-#include "ui/gfx/gl/gl_context.h"
-#include "ui/gfx/gl/gl_bindings.h"
-#include "ui/gfx/gl/gl_implementation.h"
-#include "ui/gfx/gl/gl_surface.h"
-#include "ui/gfx/gl/gl_switches.h"
-
-namespace gfx {
-
-namespace {
-base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky
- current_context_ = LAZY_INSTANCE_INITIALIZER;
-} // namespace
-
-GLContext::GLContext(GLShareGroup* share_group) : share_group_(share_group) {
- if (!share_group_.get())
- share_group_ = new GLShareGroup;
-
- share_group_->AddContext(this);
-}
-
-GLContext::~GLContext() {
- share_group_->RemoveContext(this);
- if (GetCurrent() == this) {
- SetCurrent(NULL, NULL);
- }
-}
-
-std::string GLContext::GetExtensions() {
- DCHECK(IsCurrent(NULL));
-
- std::string extensions;
- if (GLSurface::GetCurrent()) {
- extensions = GLSurface::GetCurrent()->GetExtensions();
- }
-
- const char* gl_ext = reinterpret_cast<const char*>(
- glGetString(GL_EXTENSIONS));
- if (gl_ext) {
- extensions += (!extensions.empty() && gl_ext[0]) ? " " : "";
- extensions += gl_ext;
- }
-
- return extensions;
-}
-
-bool GLContext::HasExtension(const char* name) {
- std::string extensions = GetExtensions();
- extensions += " ";
-
- std::string delimited_name(name);
- delimited_name += " ";
-
- return extensions.find(delimited_name) != std::string::npos;
-}
-
-GLShareGroup* GLContext::share_group() {
- return share_group_.get();
-}
-
-bool GLContext::LosesAllContextsOnContextLost() {
- switch (GetGLImplementation()) {
- case kGLImplementationDesktopGL:
- return false;
- case kGLImplementationEGLGLES2:
- return true;
- case kGLImplementationOSMesaGL:
- case kGLImplementationAppleGL:
- return false;
- case kGLImplementationMockGL:
- return false;
- default:
- NOTREACHED();
- return true;
- }
-}
-
-GLContext* GLContext::GetCurrent() {
- return current_context_.Pointer()->Get();
-}
-
-void GLContext::SetCurrent(GLContext* context, GLSurface* surface) {
- current_context_.Pointer()->Set(context);
- GLSurface::SetCurrent(surface);
-}
-
-bool GLContext::WasAllocatedUsingARBRobustness() {
- return false;
-}
-
-bool GLContext::InitializeExtensionBindings() {
- DCHECK(IsCurrent(NULL));
- static bool initialized = false;
- if (initialized)
- return initialized;
- initialized = InitializeGLExtensionBindings(GetGLImplementation(), this);
- if (!initialized)
- LOG(ERROR) << "Could not initialize extension bindings.";
- return initialized;
-}
-
-} // namespace gfx
« no previous file with comments | « ui/gfx/gl/gl_context.h ('k') | ui/gfx/gl/gl_context_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698