Index: cc/test/test_in_process_context_provider.cc |
diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc |
index 03810046b9eac25e3700ee94aa53058f78967208..14d600ad2718e7e6b896fdf68e69731e8fa0583a 100644 |
--- a/cc/test/test_in_process_context_provider.cc |
+++ b/cc/test/test_in_process_context_provider.cc |
@@ -63,30 +63,6 @@ gpu::ContextSupport* TestInProcessContextProvider::ContextSupport() { |
return context_->GetImplementation(); |
} |
-static void BindGrContextCallback(const GrGLInterface* interface) { |
-#if GR_GL_PER_GL_FUNC_CALLBACK |
- reinterpret_cast<TestInProcessContextProvider*>(interface->fCallbackData) |
- ->MakeGrContextCurrent(); |
-#endif // GR_GL_PER_GL_FUNC_CALLBACK |
-} |
- |
-class GrContext* TestInProcessContextProvider::GrContext() { |
- if (gr_context_) |
- return gr_context_.get(); |
- |
- skia::RefPtr<GrGLInterface> interface = |
- skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); |
-#if GR_GL_PER_GL_FUNC_CALLBACK |
- interface->fCallback = BindGrContextCallback; |
- interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); |
-#endif // GR_GL_PER_GL_FUNC_CALLBACK |
- |
- gr_context_ = skia::AdoptRef(GrContext::Create( |
- kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
- |
- return gr_context_.get(); |
-} |
- |
namespace { |
// Singleton used to initialize and terminate the gles2 library. |
@@ -105,11 +81,32 @@ static base::LazyInstance<GLES2Initializer> g_gles2_initializer = |
} // namespace |
-void TestInProcessContextProvider::MakeGrContextCurrent() { |
+static void BindGrContextCallback(const GrGLInterface* interface) { |
+#if GR_GL_PER_GL_FUNC_CALLBACK |
jamesr
2014/01/16 19:31:07
i've seen this #if guard in multiple places, but i
alokp
2014/01/16 22:00:47
Good point. It will be better to remove this guard
|
+ TestInProcessContextProvider* context_provider = |
+ reinterpret_cast<TestInProcessContextProvider*>(interface->fCallbackData); |
+ |
// Make sure the gles2 library is initialized first on exactly one thread. |
g_gles2_initializer.Get(); |
+ gles2::SetGLContext(context_provider->ContextGL()); |
+#endif // GR_GL_PER_GL_FUNC_CALLBACK |
+} |
- gles2::SetGLContext(context_->GetImplementation()); |
+class GrContext* TestInProcessContextProvider::GrContext() { |
+ if (gr_context_) |
+ return gr_context_.get(); |
+ |
+ skia::RefPtr<GrGLInterface> interface = |
+ skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); |
+#if GR_GL_PER_GL_FUNC_CALLBACK |
+ interface->fCallback = BindGrContextCallback; |
+ interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); |
+#endif // GR_GL_PER_GL_FUNC_CALLBACK |
+ |
+ gr_context_ = skia::AdoptRef(GrContext::Create( |
+ kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
+ |
+ return gr_context_.get(); |
} |
ContextProvider::Capabilities |