summaryrefslogtreecommitdiffstats
path: root/cc/test/test_in_process_context_provider.cc
diff options
context:
space:
mode:
authoralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 10:02:55 +0000
committeralokp@chromium.org <alokp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-01-17 10:02:55 +0000
commit5844ad129d3a308f4cfb11ff607faab2baf821ca (patch)
treebdca1a76834e9dbdb98c22cb66b71ce955117223 /cc/test/test_in_process_context_provider.cc
parent27b63409118ffb337df1f75a0f8d89d27f389ec0 (diff)
downloadchromium_src-5844ad129d3a308f4cfb11ff607faab2baf821ca.zip
chromium_src-5844ad129d3a308f4cfb11ff607faab2baf821ca.tar.gz
chromium_src-5844ad129d3a308f4cfb11ff607faab2baf821ca.tar.bz2
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
Diffstat (limited to 'cc/test/test_in_process_context_provider.cc')
-rw-r--r--cc/test/test_in_process_context_provider.cc45
1 files changed, 19 insertions, 26 deletions
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<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,28 @@ static base::LazyInstance<GLES2Initializer> g_gles2_initializer =
} // namespace
-void TestInProcessContextProvider::MakeGrContextCurrent() {
+static void BindGrContextCallback(const GrGLInterface* interface) {
+ 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());
+}
- gles2::SetGLContext(context_->GetImplementation());
+class GrContext* TestInProcessContextProvider::GrContext() {
+ if (gr_context_)
+ return gr_context_.get();
+
+ skia::RefPtr<GrGLInterface> interface =
+ skia::AdoptRef(skia_bindings::CreateCommandBufferSkiaGLBinding());
+ interface->fCallback = BindGrContextCallback;
+ interface->fCallbackData = reinterpret_cast<GrGLInterfaceCallbackData>(this);
+
+ gr_context_ = skia::AdoptRef(GrContext::Create(
+ kOpenGL_GrBackend, reinterpret_cast<GrBackendContext>(interface.get())));
+
+ return gr_context_.get();
}
ContextProvider::Capabilities