Make abandonment state of context thread-safe
The plan going forward is to centralize all thread-safe data in GrContextThreadSafeProxy, make it not derive from GrContext_Base, and have all the GrContext-derived classes share a pointer to a context group's shared GrContextThreadSafeProxy. And probably rename the proxy class after retracting it from public API (GrContextFamily?)
Bug: skia:10295
Change-Id: I9807ad0926f9b2d69a8694db974a3bcac9fd66b0
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/292853
Reviewed-by: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrContextThreadSafeProxy.cpp b/src/gpu/GrContextThreadSafeProxy.cpp
index fb27ba1..af92057 100644
--- a/src/gpu/GrContextThreadSafeProxy.cpp
+++ b/src/gpu/GrContextThreadSafeProxy.cpp
@@ -101,6 +101,14 @@
surfaceProps);
}
+void GrContextThreadSafeProxy::abandonContext() {
+ fAbandoned.store(true, std::memory_order_relaxed);
+}
+
+bool GrContextThreadSafeProxy::abandoned() const {
+ return fAbandoned.load(std::memory_order_relaxed);
+}
+
////////////////////////////////////////////////////////////////////////////////
sk_sp<GrContextThreadSafeProxy> GrContextThreadSafeProxyPriv::Make(
GrBackendApi backend,