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

Unified Diff: include/gpu/GrContextFactory.h

Issue 422903002: Test abandoning GL context in dm/nanobench. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix build Created 6 years, 5 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
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/gpu/GrContextFactory.h
diff --git a/include/gpu/GrContextFactory.h b/include/gpu/GrContextFactory.h
index 1f1f89df14d1995f5751f15b13c4508ce968539f..01e0239b1a16d966587994263c1f4290bf246e94 100644
--- a/include/gpu/GrContextFactory.h
+++ b/include/gpu/GrContextFactory.h
@@ -94,13 +94,24 @@ public:
void destroyContexts() {
for (int i = 0; i < fContexts.count(); ++i) {
- fContexts[i].fGLContext->makeCurrent();
+ if (NULL != fContexts[i].fGLContext) { // could be abandoned.
+ fContexts[i].fGLContext->makeCurrent();
+ }
fContexts[i].fGrContext->unref();
- fContexts[i].fGLContext->unref();
+ if (NULL != fContexts[i].fGLContext) {
+ fContexts[i].fGLContext->unref();
+ }
}
fContexts.reset();
}
+ void abandonContexts() {
+ for (int i = 0; i < fContexts.count(); ++i) {
+ SkSafeSetNull(fContexts[i].fGLContext);
+ fContexts[i].fGrContext->abandonContext();
+ }
+ }
+
/**
* Get a GrContext initialized with a type of GL context. It also makes the GL context current.
*/
« no previous file with comments | « include/gpu/GrContext.h ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698