Control making of GrSemaphore objects inside of GrResourceProvider
This change will help us get to the point of not needing access to the GrGpu
object from GrContext.
BUG=skia:
Change-Id: Icff9815c73f1791d2ce34a4d27c57898a36f2b8f
Reviewed-on: https://skia-review.googlesource.com/9391
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Greg Daniel <egdaniel@google.com>
diff --git a/src/gpu/GrResourceProvider.cpp b/src/gpu/GrResourceProvider.cpp
index 636f16c..ea3486a 100644
--- a/src/gpu/GrResourceProvider.cpp
+++ b/src/gpu/GrResourceProvider.cpp
@@ -15,6 +15,7 @@
#include "GrRenderTargetPriv.h"
#include "GrResourceCache.h"
#include "GrResourceKey.h"
+#include "GrSemaphore.h"
#include "GrStencilAttachment.h"
#include "GrTexturePriv.h"
#include "../private/GrSingleOwner.h"
@@ -372,3 +373,17 @@
}
return this->gpu()->wrapBackendTextureAsRenderTarget(desc);
}
+
+sk_sp<GrSemaphore> SK_WARN_UNUSED_RESULT GrResourceProvider::makeSemaphore() {
+ return fGpu->makeSemaphore();
+}
+
+void GrResourceProvider::takeOwnershipOfSemaphore(sk_sp<GrSemaphore> semaphore) {
+ semaphore->resetGpu(fGpu);
+}
+
+void GrResourceProvider::releaseOwnershipOfSemaphore(sk_sp<GrSemaphore> semaphore) {
+ semaphore->resetGpu(nullptr);
+}
+
+