GrSkSLFP no longer needs a GrContext

Change-Id: Iee1ea7ee2d545138a8243c373f7a163f7120548d
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/396337
Reviewed-by: Brian Salomon <bsalomon@google.com>
Commit-Queue: Brian Osman <brianosman@google.com>
diff --git a/include/effects/SkRuntimeEffect.h b/include/effects/SkRuntimeEffect.h
index 9ae7374..3df8173 100644
--- a/include/effects/SkRuntimeEffect.h
+++ b/include/effects/SkRuntimeEffect.h
@@ -153,8 +153,7 @@
 
 #if SK_SUPPORT_GPU
     // For internal use.
-    std::unique_ptr<GrFragmentProcessor> makeFP(GrRecordingContext*,
-                                                sk_sp<SkData> uniforms,
+    std::unique_ptr<GrFragmentProcessor> makeFP(sk_sp<SkData> uniforms,
                                                 std::unique_ptr<GrFragmentProcessor> children[],
                                                 size_t childCount) const;
 #endif
diff --git a/src/core/SkRuntimeEffect.cpp b/src/core/SkRuntimeEffect.cpp
index 3f5c2ec..ef22722 100644
--- a/src/core/SkRuntimeEffect.cpp
+++ b/src/core/SkRuntimeEffect.cpp
@@ -517,7 +517,7 @@
             return GrFPFailure(nullptr);
         }
 
-        auto fp = GrSkSLFP::Make(context, fEffect, "Runtime_Color_Filter", std::move(uniforms));
+        auto fp = GrSkSLFP::Make(fEffect, "Runtime_Color_Filter", std::move(uniforms));
         for (const auto& child : fChildren) {
             std::unique_ptr<GrFragmentProcessor> childFP;
             if (child) {
@@ -687,7 +687,7 @@
             return nullptr;
         }
 
-        auto fp = GrSkSLFP::Make(args.fContext, fEffect, "runtime_shader", std::move(uniforms));
+        auto fp = GrSkSLFP::Make(fEffect, "runtime_shader", std::move(uniforms));
         for (const auto& child : fChildren) {
             auto childFP = child ? as_SB(child)->asFragmentProcessor(args) : nullptr;
             fp->addChild(std::move(childFP));
@@ -837,14 +837,13 @@
 
 #if SK_SUPPORT_GPU
 std::unique_ptr<GrFragmentProcessor> SkRuntimeEffect::makeFP(
-        GrRecordingContext* recordingContext,
         sk_sp<SkData> uniforms,
         std::unique_ptr<GrFragmentProcessor> children[],
         size_t childCount) const {
     if (!uniforms) {
         uniforms = SkData::MakeEmpty();
     }
-    auto fp = GrSkSLFP::Make(recordingContext, sk_ref_sp(this), "make_fp", std::move(uniforms));
+    auto fp = GrSkSLFP::Make(sk_ref_sp(this), "make_fp", std::move(uniforms));
     for (size_t i = 0; i < childCount; ++i) {
         fp->addChild(std::move(children[i]));
     }
@@ -895,8 +894,7 @@
             return nullptr;
         }
 
-        auto fp = GrSkSLFP::Make(recordingContext,
-                                 sk_ref_sp(this),
+        auto fp = GrSkSLFP::Make(sk_ref_sp(this),
                                  "runtime_image",
                                  std::move(uniforms));
         GrColorInfo colorInfo(resultInfo.colorInfo());
diff --git a/src/gpu/effects/GrSkSLFP.cpp b/src/gpu/effects/GrSkSLFP.cpp
index 1cd90a0..dd8f7c9 100644
--- a/src/gpu/effects/GrSkSLFP.cpp
+++ b/src/gpu/effects/GrSkSLFP.cpp
@@ -161,23 +161,21 @@
     std::vector<UniformHandle> fUniformHandles;
 };
 
-std::unique_ptr<GrSkSLFP> GrSkSLFP::Make(GrContext_Base* context, sk_sp<SkRuntimeEffect> effect,
-                                         const char* name, sk_sp<SkData> uniforms) {
+std::unique_ptr<GrSkSLFP> GrSkSLFP::Make(sk_sp<SkRuntimeEffect> effect,
+                                         const char* name,
+                                         sk_sp<SkData> uniforms) {
     if (uniforms->size() != effect->uniformSize()) {
         return nullptr;
     }
-    return std::unique_ptr<GrSkSLFP>(new GrSkSLFP(context->priv().getShaderErrorHandler(),
-                                                  std::move(effect), name, std::move(uniforms)));
+    return std::unique_ptr<GrSkSLFP>(new GrSkSLFP(std::move(effect), name, std::move(uniforms)));
 }
 
-GrSkSLFP::GrSkSLFP(ShaderErrorHandler* shaderErrorHandler,
-                   sk_sp<SkRuntimeEffect> effect,
+GrSkSLFP::GrSkSLFP(sk_sp<SkRuntimeEffect> effect,
                    const char* name,
                    sk_sp<SkData> uniforms)
         : INHERITED(kGrSkSLFP_ClassID,
                     effect->fAllowColorFilter ? kConstantOutputForConstantInput_OptimizationFlag
                                               : kNone_OptimizationFlags)
-        , fShaderErrorHandler(shaderErrorHandler)
         , fEffect(std::move(effect))
         , fName(name)
         , fUniforms(std::move(uniforms)) {
@@ -188,7 +186,6 @@
 
 GrSkSLFP::GrSkSLFP(const GrSkSLFP& other)
         : INHERITED(kGrSkSLFP_ClassID, other.optimizationFlags())
-        , fShaderErrorHandler(other.fShaderErrorHandler)
         , fEffect(other.fEffect)
         , fName(other.fName)
         , fUniforms(other.fUniforms) {
@@ -278,10 +275,8 @@
 
 GrRuntimeFPBuilder::~GrRuntimeFPBuilder() = default;
 
-std::unique_ptr<GrFragmentProcessor> GrRuntimeFPBuilder::makeFP(
-        GrRecordingContext* recordingContext) {
-    return this->effect()->makeFP(recordingContext,
-                                  this->uniforms(),
+std::unique_ptr<GrFragmentProcessor> GrRuntimeFPBuilder::makeFP() {
+    return this->effect()->makeFP(this->uniforms(),
                                   this->children(),
                                   this->numChildren());
 }
diff --git a/src/gpu/effects/GrSkSLFP.h b/src/gpu/effects/GrSkSLFP.h
index a1b0bba..e24d738 100644
--- a/src/gpu/effects/GrSkSLFP.h
+++ b/src/gpu/effects/GrSkSLFP.h
@@ -14,7 +14,6 @@
 #include "src/gpu/GrFragmentProcessor.h"
 #include <atomic>
 
-class GrContext_Base;
 class GrShaderCaps;
 class SkData;
 class SkRuntimeEffect;
@@ -26,8 +25,7 @@
      * for all of the 'uniform' variables in the SkSL source. The layout of the uniforms blob is
      * dictated by the SkRuntimeEffect.
      */
-    static std::unique_ptr<GrSkSLFP> Make(GrContext_Base* context,
-                                          sk_sp<SkRuntimeEffect> effect,
+    static std::unique_ptr<GrSkSLFP> Make(sk_sp<SkRuntimeEffect> effect,
                                           const char* name,
                                           sk_sp<SkData> uniforms);
 
@@ -38,10 +36,7 @@
     std::unique_ptr<GrFragmentProcessor> clone() const override;
 
 private:
-    using ShaderErrorHandler = GrContextOptions::ShaderErrorHandler;
-
-    GrSkSLFP(ShaderErrorHandler* shaderErrorHandler, sk_sp<SkRuntimeEffect> effect,
-             const char* name, sk_sp<SkData> uniforms);
+    GrSkSLFP(sk_sp<SkRuntimeEffect> effect, const char* name, sk_sp<SkData> uniforms);
 
     GrSkSLFP(const GrSkSLFP& other);
 
@@ -53,8 +48,6 @@
 
     SkPMColor4f constantOutputForConstantInput(const SkPMColor4f&) const override;
 
-    ShaderErrorHandler*       fShaderErrorHandler;
-
     sk_sp<SkRuntimeEffect> fEffect;
     const char*            fName;
     sk_sp<SkData>          fUniforms;
@@ -82,7 +75,7 @@
         return GrRuntimeFPBuilder(gResult.effect);
     }
 
-    std::unique_ptr<GrFragmentProcessor> makeFP(GrRecordingContext*);
+    std::unique_ptr<GrFragmentProcessor> makeFP();
 
 private:
     explicit GrRuntimeFPBuilder(sk_sp<SkRuntimeEffect>);
diff --git a/src/shaders/SkComposeShader.cpp b/src/shaders/SkComposeShader.cpp
index 0bc012d..a2ed52f 100644
--- a/src/shaders/SkComposeShader.cpp
+++ b/src/shaders/SkComposeShader.cpp
@@ -234,6 +234,6 @@
     builder.uniform("w") = fWeight;
     builder.child("a") = std::move(fpA);
     builder.child("b") = std::move(fpB);
-    return builder.makeFP(args.fContext);
+    return builder.makeFP();
 }
 #endif