diff options
Diffstat (limited to 'cc/test/test_in_process_context_provider.cc')
| -rw-r--r-- | cc/test/test_in_process_context_provider.cc | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/cc/test/test_in_process_context_provider.cc b/cc/test/test_in_process_context_provider.cc index fd1745e..d3989df 100644 --- a/cc/test/test_in_process_context_provider.cc +++ b/cc/test/test_in_process_context_provider.cc @@ -83,44 +83,12 @@ gpu::ContextSupport* TestInProcessContextProvider::ContextSupport() { return context_->GetImplementation(); } -namespace { - -// Singleton used to initialize and terminate the gles2 library. -class GLES2Initializer { - public: - GLES2Initializer() { ::gles2::Initialize(); } - - ~GLES2Initializer() { ::gles2::Terminate(); } - - private: - DISALLOW_COPY_AND_ASSIGN(GLES2Initializer); -}; - -static base::LazyInstance<GLES2Initializer> g_gles2_initializer = - LAZY_INSTANCE_INITIALIZER; - -} // namespace - -static void BindGrContextCallback(const GrGLInterface* interface) { - TestInProcessContextProvider* context_provider = - reinterpret_cast<TestInProcessContextProvider*>(interface->fCallbackData); - - gles2::SetGLContext(context_provider->ContextGL()); -} - class GrContext* TestInProcessContextProvider::GrContext() { if (gr_context_) return gr_context_.get(); - // The GrGLInterface factory will make GL calls using the C GLES2 interface. - // Make sure the gles2 library is initialized first on exactly one thread. - g_gles2_initializer.Get(); - gles2::SetGLContext(ContextGL()); - skia::RefPtr<GrGLInterface> interface = skia::AdoptRef(new GrGLInterface); - skia_bindings::InitCommandBufferSkiaGLBinding(interface.get()); - interface->fCallback = BindGrContextCallback; - interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this); + skia_bindings::InitGLES2InterfaceBindings(interface.get(), ContextGL()); gr_context_ = skia::AdoptRef(GrContext::Create( kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get()))); |
