Force SkMatrix type while recording too.

This switches to a new way of doing this, enforcing the caching with the type
recorded rather than having to do it in SkRecorder.  Should be more foolproof.

Updated SkPath and SkBitmap's equivalents too.  ImmutableBitmap was close,
but using inheritance now makes the rest of the code less weird.

BUG=437511

I'm not sure whether or not this will _fix_ the SkMatrix aspect of that bug.
There may be other SkMatrices that we're racing on.  It does cover the obvious
ones, though, and removing the SkTRacy<> wrapper will allow TSAN to show
us any other races.

It turned out to be easier to turn missing optional matrices into I early rather
than late.  I figure this should be harmless.  Recording and playback perf both
look neutral.

Review URL: https://codereview.chromium.org/773433003
diff --git a/src/core/SkRecorder.cpp b/src/core/SkRecorder.cpp
index 9ca4224..5ba4309 100644
--- a/src/core/SkRecorder.cpp
+++ b/src/core/SkRecorder.cpp
@@ -74,13 +74,6 @@
 template <typename T>
 static Reference<T> delay_copy(const T& x) { return Reference<T>(x); }
 
-// SkPath::getBounds() isn't thread safe unless we precache the bounds in a singlethreaded context.
-// Recording is a convenient time to do this, but we could delay it to between record and playback.
-static Reference<SkPath> force_path_bounds(const SkPath& p) {
-    p.updateBoundsCache();
-    return Reference<SkPath>(p);
-}
-
 // Use copy() only for optional arguments, to be copied if present or skipped if not.
 // (For most types we just pass by value and let copy constructors do their thing.)
 template <typename T>
@@ -165,7 +158,7 @@
 }
 
 void SkRecorder::drawPath(const SkPath& path, const SkPaint& paint) {
-    APPEND(DrawPath, delay_copy(paint), force_path_bounds(path));
+    APPEND(DrawPath, delay_copy(paint), delay_copy(path));
 }
 
 void SkRecorder::drawBitmap(const SkBitmap& bitmap,
@@ -251,8 +244,8 @@
            delay_copy(paint),
            this->copy((const char*)text, byteLength),
            byteLength,
-           force_path_bounds(path),
-           this->copy(matrix));
+           delay_copy(path),
+           matrix ? *matrix : SkMatrix::I());
 }
 
 void SkRecorder::onDrawTextBlob(const SkTextBlob* blob, SkScalar x, SkScalar y,
@@ -261,7 +254,7 @@
 }
 
 void SkRecorder::onDrawPicture(const SkPicture* pic, const SkMatrix* matrix, const SkPaint* paint) {
-    APPEND(DrawPicture, this->copy(paint), pic, this->copy(matrix));
+    APPEND(DrawPicture, this->copy(paint), pic, matrix ? *matrix : SkMatrix::I());
 }
 
 void SkRecorder::drawVertices(VertexMode vmode,
@@ -348,7 +341,7 @@
 void SkRecorder::onClipPath(const SkPath& path, SkRegion::Op op, ClipEdgeStyle edgeStyle) {
     INHERITED(onClipPath, path, op, edgeStyle);
     SkRecords::RegionOpAndAA opAA(op, kSoft_ClipEdgeStyle == edgeStyle);
-    APPEND(ClipPath, this->devBounds(), force_path_bounds(path), opAA);
+    APPEND(ClipPath, this->devBounds(), delay_copy(path), opAA);
 }
 
 void SkRecorder::onClipRegion(const SkRegion& deviceRgn, SkRegion::Op op) {