Replace DM:Error with DM::Result.

Initially, Error was written with the intent that an empty string meant
Ok and anything else meant Fatal. This made things simple with implicit
constructors from strings. With the introduction of Nonfatal the state
was now tied up with an additional boolean. Now the empty string meant
Ok and causes the new boolean to be ignored, or at least that is the way
it was used since Error didn't actually enforce that itself. This leads
to GMs which return kSkip but don't set the message to not be skipped.
This could be fixed in several ways.

The first would be for the GMSrc to notice that a GM had returned kSkip
with an empty message and create the Error::Nonfatal with a non-empty
message. This has the downside of being some extra unexpected complexity
and doesn't prevent similar issues from arising in the future.

The second would be to change how DM interprets the Error, and if the
non-fatal bit is set treat that as a sign to skip, even if the message
is empty. This fixes the stated issue, but doesn't fix the issue where a
GM can return kFail but also leave the message empty. This could again
be fixed by either modifying GMSrc::draw or GM::drawContent, but this
also seems a bit brittle in not preventing this from happening again in
the future.

So this replaces Error with Result, which makes the status orthogonal to
the message. It does lose the automatic conversion from string, but by
being able to wrap the many uses of SkStringPrintf the explicit nature
doesn't add much additional noise to the more complex failure reports.

Change-Id: Ibf48b67faa09a91a4a9d792d204bd9810b441c6c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/270362
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Mike Klein <mtklein@google.com>
3 files changed