Add addOnFlushCallbackObject at GrRecordingContext level
The GrRecordingContext will (eventually) hold the drawManager so it is natural that it should accept onFlushCB objects
Change-Id: I48dc876bd18e5d5ebea75c33498e75faba1a0feb
Reviewed-on: https://skia-review.googlesource.com/c/193025
Auto-Submit: Robert Phillips <robertphillips@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
Reviewed-by: Greg Daniel <egdaniel@google.com>
diff --git a/include/private/GrRecordingContext.h b/include/private/GrRecordingContext.h
index f5ea036..1f90b01 100644
--- a/include/private/GrRecordingContext.h
+++ b/include/private/GrRecordingContext.h
@@ -12,6 +12,7 @@
#include "GrImageContext.h"
class GrDrawingManager;
+class GrOnFlushCallbackObject;
class GrOpMemoryPool;
class GrRecordingContextPriv;
@@ -37,6 +38,14 @@
sk_sp<GrOpMemoryPool> refOpMemoryPool();
GrOpMemoryPool* opMemoryPool();
+ /**
+ * Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.)
+ *
+ * NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to
+ * ensure its lifetime is tied to that of the context.
+ */
+ void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
+
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
sk_sp<SkColorSpace> = nullptr,
const SkSurfaceProps* = nullptr);
diff --git a/src/gpu/GrContextPriv.cpp b/src/gpu/GrContextPriv.cpp
index 584c438..81f7dfc 100644
--- a/src/gpu/GrContextPriv.cpp
+++ b/src/gpu/GrContextPriv.cpp
@@ -43,6 +43,10 @@
return fContext->refOpMemoryPool();
}
+void GrContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
+ fContext->addOnFlushCallbackObject(onFlushCBObject);
+}
+
sk_sp<GrSurfaceContext> GrContextPriv::makeWrappedSurfaceContext(
sk_sp<GrSurfaceProxy> proxy,
sk_sp<SkColorSpace> colorSpace,
@@ -193,10 +197,6 @@
fContext->drawingManager()->flush(proxy);
}
-void GrContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
- fContext->drawingManager()->addOnFlushCallbackObject(onFlushCBObject);
-}
-
void GrContextPriv::flushSurfaceWrites(GrSurfaceProxy* proxy) {
ASSERT_SINGLE_OWNER_PRIV
RETURN_IF_ABANDONED_PRIV
diff --git a/src/gpu/GrContextPriv.h b/src/gpu/GrContextPriv.h
index b6da3e8..ddf257f 100644
--- a/src/gpu/GrContextPriv.h
+++ b/src/gpu/GrContextPriv.h
@@ -64,6 +64,14 @@
sk_sp<GrOpMemoryPool> refOpMemoryPool();
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
+ /**
+ * Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.)
+ *
+ * NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to
+ * ensure its lifetime is tied to that of the context.
+ */
+ void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
+
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
sk_sp<SkColorSpace> = nullptr,
const SkSurfaceProps* = nullptr);
@@ -164,14 +172,6 @@
void flush(GrSurfaceProxy*);
/**
- * Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.)
- *
- * NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to
- * ensure its lifetime is tied to that of the context.
- */
- void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
-
- /**
* After this returns any pending writes to the surface will have been issued to the
* backend 3D API.
*/
diff --git a/src/gpu/GrRecordingContext.cpp b/src/gpu/GrRecordingContext.cpp
index 615e0d7..20b857e 100644
--- a/src/gpu/GrRecordingContext.cpp
+++ b/src/gpu/GrRecordingContext.cpp
@@ -57,6 +57,10 @@
return this->refOpMemoryPool().get();
}
+void GrRecordingContext::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
+ this->drawingManager()->addOnFlushCallbackObject(onFlushCBObject);
+}
+
sk_sp<GrSurfaceContext> GrRecordingContext::makeWrappedSurfaceContext(
sk_sp<GrSurfaceProxy> proxy,
sk_sp<SkColorSpace> colorSpace,
@@ -220,6 +224,10 @@
return fContext->refOpMemoryPool();
}
+void GrRecordingContextPriv::addOnFlushCallbackObject(GrOnFlushCallbackObject* onFlushCBObject) {
+ fContext->addOnFlushCallbackObject(onFlushCBObject);
+}
+
sk_sp<GrSurfaceContext> GrRecordingContextPriv::makeWrappedSurfaceContext(
sk_sp<GrSurfaceProxy> proxy,
sk_sp<SkColorSpace> colorSpace,
diff --git a/src/gpu/GrRecordingContextPriv.h b/src/gpu/GrRecordingContextPriv.h
index 3c65496..b00d82f 100644
--- a/src/gpu/GrRecordingContextPriv.h
+++ b/src/gpu/GrRecordingContextPriv.h
@@ -52,6 +52,14 @@
sk_sp<GrOpMemoryPool> refOpMemoryPool();
GrOpMemoryPool* opMemoryPool() { return fContext->opMemoryPool(); }
+ /**
+ * Registers an object for flush-related callbacks. (See GrOnFlushCallbackObject.)
+ *
+ * NOTE: the drawing manager tracks this object as a raw pointer; it is up to the caller to
+ * ensure its lifetime is tied to that of the context.
+ */
+ void addOnFlushCallbackObject(GrOnFlushCallbackObject*);
+
sk_sp<GrSurfaceContext> makeWrappedSurfaceContext(sk_sp<GrSurfaceProxy>,
sk_sp<SkColorSpace> = nullptr,
const SkSurfaceProps* = nullptr);