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

Unified Diff: cc/test/test_in_process_context_provider.cc

Issue 135753006: cc: Delete ContextProvider::MakeGrContextCurrent. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 11 months 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 side-by-side diff with in-line comments
Download patch
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
« no previous file with comments | « cc/test/test_in_process_context_provider.h ('k') | content/common/gpu/client/context_provider_command_buffer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698