[canvaskit] Add Path2D to Canvas API

This moves the shared logic into path2d.js from
canvas2dcontext.js.

Bug: skia:
Change-Id: Id63bc52a190109f7cbc4e17ddb5603e6e87d5dc0
Reviewed-on: https://skia-review.googlesource.com/c/178268
Reviewed-by: Joe Gregorio <jcgregorio@google.com>
diff --git a/experimental/canvaskit/htmlcanvas/htmlcanvas.js b/experimental/canvaskit/htmlcanvas/htmlcanvas.js
index 6f118e5..de9794f 100644
--- a/experimental/canvaskit/htmlcanvas/htmlcanvas.js
+++ b/experimental/canvaskit/htmlcanvas/htmlcanvas.js
@@ -32,6 +32,12 @@
     addToFontCache(newFont, descriptors);
   }
 
+  this.makePath2D = function(path) {
+    var p2d = new Path2D(path);
+    this._toCleanup.push(p2d._getPath());
+    return p2d;
+  }
+
   // A normal <canvas> requires that clients call getContext
   this.getContext = function(type) {
     if (type === '2d') {