Add support for non-mappable vert buffers to tessellating path renderer.

Use malloc-ed memory and the updateData() call instead.

BUG=skia:4215

Review URL: https://codereview.chromium.org/1288683004
diff --git a/src/gpu/GrTessellatingPathRenderer.cpp b/src/gpu/GrTessellatingPathRenderer.cpp
index 6a70a90..9fe5278 100644
--- a/src/gpu/GrTessellatingPathRenderer.cpp
+++ b/src/gpu/GrTessellatingPathRenderer.cpp
@@ -1417,7 +1417,8 @@
 
     int tessellate(GrUniqueKey* key,
                    GrResourceProvider* resourceProvider,
-                   SkAutoTUnref<GrVertexBuffer>& vertexBuffer) {
+                   SkAutoTUnref<GrVertexBuffer>& vertexBuffer,
+                   bool canMapVB) {
         SkPath path;
         GrStrokeInfo stroke(fStroke);
         if (stroke.isDashed()) {
@@ -1490,13 +1491,23 @@
             SkDebugf("Could not allocate vertices\n");
             return 0;
         }
-        SkPoint* verts = static_cast<SkPoint*>(vertexBuffer->map());
-        LOG("emitting %d verts\n", count);
+        SkPoint* verts;
+        if (canMapVB) {
+            verts = static_cast<SkPoint*>(vertexBuffer->map());
+        } else {
+            verts = SkNEW_ARRAY(SkPoint, count);
+        }
         SkPoint* end = polys_to_triangles(polys, fillType, verts);
-        vertexBuffer->unmap();
         int actualCount = static_cast<int>(end - verts);
         LOG("actual count: %d\n", actualCount);
         SkASSERT(actualCount <= count);
+        if (canMapVB) {
+            vertexBuffer->unmap();
+        } else {
+            vertexBuffer->updateData(verts, actualCount * sizeof(SkPoint));
+            SkDELETE_ARRAY(verts);
+        }
+
 
         if (!fPath.isVolatile()) {
             TessInfo info;
@@ -1533,7 +1544,8 @@
         SkScalar tol = GrPathUtils::scaleToleranceToSrc(
             screenSpaceTol, fViewMatrix, fPath.getBounds());
         if (!cache_match(vertexBuffer.get(), tol, &actualCount)) {
-            actualCount = tessellate(&key, rp, vertexBuffer);
+            bool canMapVB = GrCaps::kNone_MapFlags != target->caps().mapBufferFlags();
+            actualCount = tessellate(&key, rp, vertexBuffer, canMapVB);
         }
 
         if (actualCount == 0) {