Import Cobalt 25.master.0.1033734
diff --git a/third_party/skia/tools/gpu/FlushFinishTracker.cpp b/third_party/skia/tools/gpu/FlushFinishTracker.cpp
new file mode 100644
index 0000000..b536701
--- /dev/null
+++ b/third_party/skia/tools/gpu/FlushFinishTracker.cpp
@@ -0,0 +1,30 @@
+/*
+ * Copyright 2020 Google LLC
+ *
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+#include "tools/gpu/FlushFinishTracker.h"
+
+#include "include/gpu/GrDirectContext.h"
+#include "src/core/SkTraceEvent.h"
+
+#include <chrono>
+
+namespace sk_gpu_test {
+
+void FlushFinishTracker::waitTillFinished() {
+    TRACE_EVENT0("skia.gpu", TRACE_FUNC);
+    auto begin = std::chrono::steady_clock::now();
+    auto end = begin;
+    while (!fIsFinished && (end - begin) < std::chrono::seconds(2)) {
+        fContext->checkAsyncWorkCompletion();
+        end = std::chrono::steady_clock::now();
+    }
+    if (!fIsFinished) {
+        SkDebugf("WARNING: Wait failed for flush sync. Timings might not be accurate.\n");
+    }
+}
+
+} //namespace sk_gpu_test