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

Unified Diff: include/gpu/GrContext.h

Issue 1852733002: Add GrContext::releaseAndAbandonContext() (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix no-gpu build, add null check, add unit test" Created 4 years, 9 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 | « dm/DMSrcSink.cpp ('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/GrContext.h
diff --git a/include/gpu/GrContext.h b/include/gpu/GrContext.h
index 6d67d3ebb3acc2b57094fb3fc858c246d5816fab..d59b2a28f0c7c98be5029f1cca0ab02f8183d8b9 100644
--- a/include/gpu/GrContext.h
+++ b/include/gpu/GrContext.h
@@ -93,21 +93,29 @@ public:
}
/**
- * Abandons all GPU resources and assumes the underlying backend 3D API
- * context is not longer usable. Call this if you have lost the associated
- * GPU context, and thus internal texture, buffer, etc. references/IDs are
- * now invalid. Should be called even when GrContext is no longer going to
- * be used for two reasons:
- * 1) ~GrContext will not try to free the objects in the 3D API.
- * 2) Any GrGpuResources created by this GrContext that outlive
- * will be marked as invalid (GrGpuResource::wasDestroyed()) and
- * when they're destroyed no 3D API calls will be made.
- * Content drawn since the last GrContext::flush() may be lost. After this
- * function is called the only valid action on the GrContext or
- * GrGpuResources it created is to destroy them.
+ * Abandons all GPU resources and assumes the underlying backend 3D API context is not longer
+ * usable. Call this if you have lost the associated GPU context, and thus internal texture,
+ * buffer, etc. references/IDs are now invalid. Calling this ensures that the destructors of the
+ * GrContext and any of its created resource objects will not make backend 3D API calls. Content
+ * rendered but not previously flushed may be lost. After this function is called all subsequent
+ * calls on the GrContext will fail or be no-ops.
+ *
+ * The typical use case for this function is that the underlying 3D context was lost and further
+ * API calls may crash.
*/
void abandonContext();
+ /**
+ * This is similar to abandonContext() however the underlying 3D context is not yet lost and
+ * the GrContext will cleanup all allocated resources before returning. After returning it will
+ * assume that the underlying context may no longer be valid.
+ *
+ * The typical use case for this function is that the client is going to destroy the 3D context
+ * but can't guarantee that GrContext will be destroyed first (perhaps because it may be ref'ed
+ * elsewhere by either the client or Skia objects).
+ */
+ void releaseResourcesAndAbandonContext();
+
///////////////////////////////////////////////////////////////////////////
// Resource Cache
« no previous file with comments | « dm/DMSrcSink.cpp ('k') | src/gpu/GrContext.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698