<commit_before>// Copyright (c) 2011 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 "base/basictypes.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/memory/scoped_generic_obj.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/mesa/MesaLib/include/GL/osmesa.h"
#include "ui/gfx/gl/gl_bindings.h"
#include "ui/gfx/gl/gl_context_cgl.h"
#include "ui/gfx/gl/gl_context_osmesa.h"
#include "ui/gfx/gl/gl_context_stub.h"
#include "ui/gfx/gl/gl_implementation.h"
#include "ui/gfx/gl/gl_surface.h"

#if defined(USE_AURA)
#include "ui/gfx/gl/gl_context_nsview.h"
#endif

namespace {

// ScopedGenericObj functor for CGLDestroyRendererInfo().
class ScopedDestroyRendererInfo {
 public:
  void operator()(CGLRendererInfoObj x) const {
    CGLDestroyRendererInfo(x);
  }
};

}  // namespace

namespace gfx {

class GLShareGroup;

scoped_refptr<GLContext> GLContext::CreateGLContext(
    GLShareGroup* share_group,
    GLSurface* compatible_surface,
    GpuPreference gpu_preference) {
  switch (GetGLImplementation()) {
    case kGLImplementationDesktopGL: {
      scoped_refptr<GLContext> context;
      if (compatible_surface->IsOffscreen()) {
        context = new GLContextCGL(share_group);
        if (!context->Initialize(compatible_surface, gpu_preference))
          return NULL;
      } else {
#if defined(USE_AURA)
        context = new GLContextNSView(share_group);
        if (!context->Initialize(compatible_surface, gpu_preference))
          return NULL;
#endif
      }

      return context;
    }
    case kGLImplementationOSMesaGL: {<commit_msg>GPU compositing on OSX canary broken<commit_after>// Copyright (c) 2011 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 "base/basictypes.h"
#include "base/logging.h"
#include "base/mac/mac_util.h"
#include "base/memory/scoped_generic_obj.h"
#include "base/memory/scoped_ptr.h"
#include "third_party/mesa/MesaLib/include/GL/osmesa.h"
#include "ui/gfx/gl/gl_bindings.h"
#include "ui/gfx/gl/gl_context_cgl.h"
#include "ui/gfx/gl/gl_context_osmesa.h"
#include "ui/gfx/gl/gl_context_stub.h"
#include "ui/gfx/gl/gl_implementation.h"
#include "ui/gfx/gl/gl_surface.h"

#if defined(USE_AURA)
#include "ui/gfx/gl/gl_context_nsview.h"
#endif

namespace {

// ScopedGenericObj functor for CGLDestroyRendererInfo().
class ScopedDestroyRendererInfo {
 public:
  void operator()(CGLRendererInfoObj x) const {
    CGLDestroyRendererInfo(x);
  }
};

}  // namespace

namespace gfx {

class GLShareGroup;

scoped_refptr<GLContext> GLContext::CreateGLContext(
    GLShareGroup* share_group,
    GLSurface* compatible_surface,
    GpuPreference gpu_preference) {
  switch (GetGLImplementation()) {
    case kGLImplementationDesktopGL: {
      scoped_refptr<GLContext> context;
#if defined(USE_AURA)
      DCHECK(!compatible_surface->IsOffscreen());
      context = new GLContextNSView(share_group);
      if (!context->Initialize(compatible_surface, gpu_preference))
        return NULL;
#else
      context = new GLContextCGL(share_group);
      if (!context->Initialize(compatible_surface, gpu_preference))
        return NULL;
#endif // USE_AURA

      return context;
    }
    case kGLImplementationOSMesaGL: {
{'fraction_non_alphanumeric': 0.1143781240811526, 'fraction_numerical': 0.0023522493384298734, 'mean_word_length': 4.323943661971831, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6584383', 'n_tokens_mistral': 1183, 'n_tokens_neox': 1179, 'n_words': 237}