Copy on write for wrapped backend texture surfaces.

Makes SkImage_Gpu backed by two proxies, an original and a copy. The
image uses the original until a new render task is bound to it at which
point further uses of the image will use the copy. If the image is ever
used off a GrDirectContext we fall over to the copy. If the copy is
never used and never can be used by the next flush then the render
task that populates it is marked "skipped" and we don't perform the
copy.

Bug: skia:11208

Change-Id: Id255f4a733acc608c8a53c1a5633207aeafc404b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/366282
Commit-Queue: Brian Salomon <bsalomon@google.com>
Reviewed-by: Robert Phillips <robertphillips@google.com>
diff --git a/gn/tests.gni b/gn/tests.gni
index 1e37928..ab3834d 100644
--- a/gn/tests.gni
+++ b/gn/tests.gni
@@ -325,6 +325,7 @@
   "$_tests/VptrTest.cpp",
   "$_tests/WebpTest.cpp",
   "$_tests/WindowRectanglesTest.cpp",
+  "$_tests/WrappedSurfaceCopyOnWriteTest.cpp",
   "$_tests/WritePixelsTest.cpp",
   "$_tests/Writer32Test.cpp",
   "$_tests/YUVCacheTest.cpp",