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

Side by Side Diff: ui/gfx/gl/gl_context_mac.mm

Issue 8486020: compositor_unittests target is unimplmented on Mac (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and nit. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/logging.h" 6 #include "base/logging.h"
7 #include "base/mac/mac_util.h" 7 #include "base/mac/mac_util.h"
8 #include "base/memory/scoped_generic_obj.h" 8 #include "base/memory/scoped_generic_obj.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "third_party/mesa/MesaLib/include/GL/osmesa.h" 10 #include "third_party/mesa/MesaLib/include/GL/osmesa.h"
11 #include "ui/gfx/gl/gl_bindings.h" 11 #include "ui/gfx/gl/gl_bindings.h"
12 #include "ui/gfx/gl/gl_context_cgl.h" 12 #include "ui/gfx/gl/gl_context_cgl.h"
13 #include "ui/gfx/gl/gl_context_osmesa.h" 13 #include "ui/gfx/gl/gl_context_osmesa.h"
14 #include "ui/gfx/gl/gl_context_stub.h" 14 #include "ui/gfx/gl/gl_context_stub.h"
15 #include "ui/gfx/gl/gl_implementation.h" 15 #include "ui/gfx/gl/gl_implementation.h"
16 #include "ui/gfx/gl/gl_surface_cgl.h" 16 #include "ui/gfx/gl/gl_surface.h"
17 #include "ui/gfx/gl/gl_surface_osmesa.h" 17
18 #if defined(USE_AURA)
19 #include "ui/gfx/gl/gl_context_nsview.h"
20 #endif
18 21
19 namespace { 22 namespace {
20 23
21 // ScopedGenericObj functor for CGLDestroyRendererInfo(). 24 // ScopedGenericObj functor for CGLDestroyRendererInfo().
22 class ScopedDestroyRendererInfo { 25 class ScopedDestroyRendererInfo {
23 public: 26 public:
24 void operator()(CGLRendererInfoObj x) const { 27 void operator()(CGLRendererInfoObj x) const {
25 CGLDestroyRendererInfo(x); 28 CGLDestroyRendererInfo(x);
26 } 29 }
27 }; 30 };
28 31
29 } // namespace 32 } // namespace
30 33
31 namespace gfx { 34 namespace gfx {
32 35
33 class GLShareGroup; 36 class GLShareGroup;
34 37
35 scoped_refptr<GLContext> GLContext::CreateGLContext( 38 scoped_refptr<GLContext> GLContext::CreateGLContext(
36 GLShareGroup* share_group, 39 GLShareGroup* share_group,
37 GLSurface* compatible_surface, 40 GLSurface* compatible_surface,
38 GpuPreference gpu_preference) { 41 GpuPreference gpu_preference) {
39 switch (GetGLImplementation()) { 42 switch (GetGLImplementation()) {
40 case kGLImplementationDesktopGL: { 43 case kGLImplementationDesktopGL: {
41 scoped_refptr<GLContext> context(new GLContextCGL(share_group)); 44 scoped_refptr<GLContext> context;
42 if (!context->Initialize(compatible_surface, gpu_preference)) 45 if (compatible_surface->IsOffscreen()) {
43 return NULL; 46 context = new GLContextCGL(share_group);
47 if (!context->Initialize(compatible_surface, gpu_preference))
48 return NULL;
49 } else {
50 #if defined(USE_AURA)
51 context = new GLContextNSView(share_group);
52 if (!context->Initialize(compatible_surface, gpu_preference))
53 return NULL;
54 #endif
55 }
44 56
45 return context; 57 return context;
46 } 58 }
47 case kGLImplementationOSMesaGL: { 59 case kGLImplementationOSMesaGL: {
48 scoped_refptr<GLContext> context(new GLContextOSMesa(share_group)); 60 scoped_refptr<GLContext> context(new GLContextOSMesa(share_group));
49 if (!context->Initialize(compatible_surface, gpu_preference)) 61 if (!context->Initialize(compatible_surface, gpu_preference))
50 return NULL; 62 return NULL;
51 63
52 return context; 64 return context;
53 } 65 }
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 146 }
135 147
136 if (found_online && found_offline) { 148 if (found_online && found_offline) {
137 supports_dual_gpus = true; 149 supports_dual_gpus = true;
138 } 150 }
139 151
140 return supports_dual_gpus; 152 return supports_dual_gpus;
141 } 153 }
142 154
143 } // namespace gfx 155 } // namespace gfx
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698