[canvaskit] Expose releaseResourcesAndAbandonContext on GrContext

Bug: skia:9910
Change-Id: If0a6aa106d42c680f1f0f3092c4a4dbd0f04c937
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270936
Reviewed-by: Nathaniel Nifong <nifong@google.com>
This commit is contained in:
Kevin Lubick 2020-02-24 10:00:20 -05:00
parent cc08d9fabf
commit 9279798022
3 changed files with 3 additions and 0 deletions

View File

@ -20,6 +20,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Experimental 4x4 matrices added in `SkM44`.
- Vector math functions added in `SkVector`.
- `SkRuntimeEffect.makeShaderWithChildren`, which can take in other shaders as fragmentProcessors.
- `GrContext.releaseResourcesAndAbandonContext` to free up WebGL contexts.
### Changed
- We now compile/ship with Emscripten v1.39.6.

View File

@ -900,6 +900,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
self.getResourceCacheUsage(&usedResources, &currUsage);
return currUsage;
}))
.function("releaseResourcesAndAbandonContext", &GrContext::releaseResourcesAndAbandonContext)
.function("setResourceCacheLimitBytes", optional_override([](GrContext& self, size_t maxResourceBytes)->void {
int maxResources = 0;
size_t currMax = 0; // ignored

View File

@ -105,6 +105,7 @@ var CanvasKit = {
// public API (from C++ bindings)
getResourceCacheLimitBytes: function() {},
getResourceCacheUsageBytes: function() {},
releaseResourcesAndAbandonContext: function() {},
setResourceCacheLimitBytes: function() {},
},