From 5844ad129d3a308f4cfb11ff607faab2baf821ca Mon Sep 17 00:00:00 2001 From: "alokp@chromium.org" Date: Fri, 17 Jan 2014 10:02:55 +0000 Subject: cc: Delete ContextProvider::MakeGrContextCurrent. It is not necessary to explicitly make the GrContext current. The underlying GL context is automatically made current via a callback setup by all implementations of cc::ContextProvider. Ganesh calls this callback before issuing any GL command, which ensures the the appropriate GL context is current. BUG=334886 Review URL: https://codereview.chromium.org/135753006 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@245475 0039d316-1c4b-4281-b951-d872f2087c98 --- cc/test/test_in_process_context_provider.cc | 45 ++++++++++++----------------- 1 file changed, 19 insertions(+), 26 deletions(-) (limited to '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 0381004..579a2e8 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(interface->fCallbackData) - ->MakeGrContextCurrent(); -#endif // GR_GL_PER_GL_FUNC_CALLBACK -} - -class GrContext* TestInProcessContextProvider::GrContext() { - if (gr_context_) - return gr_context_.get(); - - skia::RefPtr interface = - skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); -#if GR_GL_PER_GL_FUNC_CALLBACK - interface->fCallback = BindGrContextCallback; - interface->fCallbackData = reinterpret_cast(this); -#endif // GR_GL_PER_GL_FUNC_CALLBACK - - gr_context_ = skia::AdoptRef(GrContext::Create( - kOpenGL_GrBackend, reinterpret_cast(interface.get()))); - - return gr_context_.get(); -} - namespace { // Singleton used to initialize and terminate the gles2 library. @@ -105,11 +81,28 @@ static base::LazyInstance g_gles2_initializer = } // namespace -void TestInProcessContextProvider::MakeGrContextCurrent() { +static void BindGrContextCallback(const GrGLInterface* interface) { + TestInProcessContextProvider* context_provider = + reinterpret_cast(interface->fCallbackData); + // Make sure the gles2 library is initialized first on exactly one thread. g_gles2_initializer.Get(); + gles2::SetGLContext(context_provider->ContextGL()); +} - gles2::SetGLContext(context_->GetImplementation()); +class GrContext* TestInProcessContextProvider::GrContext() { + if (gr_context_) + return gr_context_.get(); + + skia::RefPtr interface = + skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding()); + interface->fCallback = BindGrContextCallback; + interface->fCallbackData = reinterpret_cast(this); + + gr_context_ = skia::AdoptRef(GrContext::Create( + kOpenGL_GrBackend, reinterpret_cast(interface.get()))); + + return gr_context_.get(); } ContextProvider::Capabilities -- cgit v1.1