Revert "Revert "Add a new GrResourceCache purging mechanism for purging unused resources.""

This reverts commit 20c322ef0cd04cf8e2592879d05d9f4e6cb19596.

Change-Id: I6df9a8594484837672308dc2c21c7c29b76ffa2c
Reviewed-on: https://skia-review.googlesource.com/10013
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/include/gpu/GrTypesPriv.h b/include/gpu/GrTypesPriv.h
index 28c3335..5db1c24 100644
--- a/include/gpu/GrTypesPriv.h
+++ b/include/gpu/GrTypesPriv.h
@@ -8,9 +8,19 @@
 #ifndef GrTypesPriv_DEFINED
 #define GrTypesPriv_DEFINED
 
+#include <chrono>
 #include "GrTypes.h"
 #include "SkRefCnt.h"
 
+// The old libstdc++ uses the draft name "monotonic_clock" rather than "steady_clock". This might
+// not actually be monotonic, depending on how libstdc++ was built. However, this is only currently
+// used for idle resource purging so it shouldn't cause a correctness problem.
+#if defined(__GLIBCXX__) && (__GLIBCXX__ < 20130000)
+using GrStdSteadyClock = std::chrono::monotonic_clock;
+#else
+using GrStdSteadyClock = std::chrono::steady_clock;
+#endif
+
 /** This enum indicates the type of antialiasing to be performed. */
 enum class GrAAType : unsigned {
     /** No antialiasing */