SkXPS:  Begin refactoring SkXPSDevice

A later CL will move all document-level fields  and methods into
SkXPSDocument.

  * SkXPSDocument cnstructor requires a xps factory ptr.

  * All device layers share ownership of a single factory.

  * renames SkDocument_XPS to the easier-to-say SkXPSDocument.

  * Moves autocoinitialize to DM.

TODO: pipe the IXpsOMObjectFactory* into the SkDocument api.

No change in rendered documents.

Change-Id: I8a4680a3603951b1ce5f6c1de48714d4902061a9
Reviewed-on: https://skia-review.googlesource.com/7998
Reviewed-by: Ben Wagner <bungeman@google.com>
Commit-Queue: Hal Canary <halcanary@google.com>
diff --git a/dm/DMSrcSink.cpp b/dm/DMSrcSink.cpp
index 16ec5ca..75f5973 100644
--- a/dm/DMSrcSink.cpp
+++ b/dm/DMSrcSink.cpp
@@ -1333,6 +1333,12 @@
 XPSSink::XPSSink() {}
 
 Error XPSSink::draw(const Src& src, SkBitmap*, SkWStream* dst, SkString*) const {
+#ifdef SK_BUILD_FOR_WIN
+    SkAutoCoInitialize com;
+    if (!com.succeeded()) {
+        return "Could not initialize COM.";
+    }
+#endif
     sk_sp<SkDocument> doc(SkDocument::MakeXPS(dst));
     if (!doc) {
         return "SkDocument::MakeXPS() returned nullptr";