Convert child FPs from refs to pending executions when parent converts

Review URL: https://codereview.chromium.org/1315923004
diff --git a/src/gpu/GrProcessor.cpp b/src/gpu/GrProcessor.cpp
index 3cbf777..7a3335c 100644
--- a/src/gpu/GrProcessor.cpp
+++ b/src/gpu/GrProcessor.cpp
@@ -131,8 +131,10 @@
 ///////////////////////////////////////////////////////////////////////////////////////////////////
 
 GrFragmentProcessor::~GrFragmentProcessor() {
+    // If we got here then our ref count must have reached zero, so we will have converted refs
+    // to pending executions for all children.
     for (int i = 0; i < fChildProcessors.count(); ++i) {
-        fChildProcessors[i]->unref();
+        fChildProcessors[i]->completedExecution();
     }
 }
 
@@ -218,6 +220,14 @@
     return index;
 }
 
+void GrFragmentProcessor::notifyRefCntIsZero() const {
+    // See comment above GrProgramElement for a detailed explanation of why we do this.
+    for (int i = 0; i < fChildProcessors.count(); ++i) {
+        fChildProcessors[i]->addPendingExecution();
+        fChildProcessors[i]->unref();
+    }
+}
+
 bool GrFragmentProcessor::hasSameTransforms(const GrFragmentProcessor& that) const {
     if (this->numTransforms() != that.numTransforms()) {
         return false;