Optimize GrOpsTask::onIsUsed

Before this CL, the render task clustering algorithm was taking
a ton more CPU time than needed by visiting proxies every
time it needed to check for surface usage.

Note also, the fSampledProxies does indeed usually contain many
duplicates in our SKPs. Sometimes 3 or 4x. I may experiment with
using a hash set as suggested by a comment.

Bug: skia:10877
Change-Id: Iae01ed16d7b4c7cda343d37ab8fd6147ae6c65e7
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/409416
Reviewed-by: Robert Phillips <robertphillips@google.com>
Auto-Submit: Adlai Holler <adlai@google.com>
Commit-Queue: Adlai Holler <adlai@google.com>
diff --git a/src/gpu/GrRenderTaskCluster.cpp b/src/gpu/GrRenderTaskCluster.cpp
index 0cf2ea1..b563647 100644
--- a/src/gpu/GrRenderTaskCluster.cpp
+++ b/src/gpu/GrRenderTaskCluster.cpp
@@ -77,13 +77,11 @@
         }
     }
     // Check for a formal dependency.
-    for (GrRenderTask* t : depender->dependencies()) {
-        if (dependee == t) {
-            CLUSTER_DEBUGF("Cluster: Bail, %s depends on %s.\n",
-                           describe_task(depender).c_str(),
-                           describe_task(dependee).c_str());
-            return true;
-        }
+    if (depender->dependsOn(dependee)) {
+        CLUSTER_DEBUGF("Cluster: Bail, %s depends on %s.\n",
+                       describe_task(depender).c_str(),
+                       describe_task(dependee).c_str());
+        return true;
     }
     return false;
 }