OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/lazy_instance.h" | 8 #include "base/lazy_instance.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/threading/thread_local.h" | 10 #include "base/threading/thread_local.h" |
11 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
12 #include "ui/gl/gl_context.h" | 12 #include "ui/gl/gl_context.h" |
| 13 #include "ui/gl/gl_gl_api_implementation.h" |
13 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
14 #include "ui/gl/gl_surface.h" | 15 #include "ui/gl/gl_surface.h" |
15 #include "ui/gl/gl_switches.h" | 16 #include "ui/gl/gl_switches.h" |
16 | 17 |
17 namespace gfx { | 18 namespace gfx { |
18 | 19 |
19 namespace { | 20 namespace { |
20 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky | 21 base::LazyInstance<base::ThreadLocalPointer<GLContext> >::Leaky |
21 current_context_ = LAZY_INSTANCE_INITIALIZER; | 22 current_context_ = LAZY_INSTANCE_INITIALIZER; |
22 } // namespace | 23 } // namespace |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 | 81 |
81 GLContext* GLContext::GetCurrent() { | 82 GLContext* GLContext::GetCurrent() { |
82 return current_context_.Pointer()->Get(); | 83 return current_context_.Pointer()->Get(); |
83 } | 84 } |
84 | 85 |
85 void GLContext::SetCurrent(GLContext* context, GLSurface* surface) { | 86 void GLContext::SetCurrent(GLContext* context, GLSurface* surface) { |
86 current_context_.Pointer()->Set(context); | 87 current_context_.Pointer()->Set(context); |
87 GLSurface::SetCurrent(surface); | 88 GLSurface::SetCurrent(surface); |
88 } | 89 } |
89 | 90 |
| 91 const gpu::gles2::GLES2Decoder* GLContext::GetDecoder() { |
| 92 return NULL; |
| 93 } |
| 94 |
90 bool GLContext::WasAllocatedUsingRobustnessExtension() { | 95 bool GLContext::WasAllocatedUsingRobustnessExtension() { |
91 return false; | 96 return false; |
92 } | 97 } |
93 | 98 |
94 bool GLContext::InitializeExtensionBindings() { | 99 bool GLContext::InitializeExtensionBindings() { |
95 DCHECK(IsCurrent(NULL)); | 100 DCHECK(IsCurrent(NULL)); |
96 static bool initialized = false; | 101 static bool initialized = false; |
97 if (initialized) | 102 if (initialized) |
98 return initialized; | 103 return initialized; |
99 initialized = InitializeGLExtensionBindings(GetGLImplementation(), this); | 104 initialized = InitializeGLExtensionBindings(GetGLImplementation(), this); |
100 if (!initialized) | 105 if (!initialized) |
101 LOG(ERROR) << "Could not initialize extension bindings."; | 106 LOG(ERROR) << "Could not initialize extension bindings."; |
102 return initialized; | 107 return initialized; |
103 } | 108 } |
104 | 109 |
| 110 void GLContext::SetupForVirtualization() { |
| 111 if (!virtual_gl_api_) { |
| 112 virtual_gl_api_.reset(new VirtualGLApi()); |
| 113 virtual_gl_api_->Initialize(&g_driver_gl, this); |
| 114 } |
| 115 } |
| 116 |
| 117 bool GLContext::MakeVirtuallyCurrent( |
| 118 GLContext* virtual_context, GLSurface* surface) { |
| 119 DCHECK(virtual_gl_api_); |
| 120 return virtual_gl_api_->MakeCurrent(virtual_context, surface); |
| 121 } |
| 122 |
| 123 void GLContext::SetRealGLApi() { |
| 124 SetGLToRealGLApi(); |
| 125 } |
| 126 |
105 } // namespace gfx | 127 } // namespace gfx |
OLD | NEW |