Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(453)

Unified Diff: dm/DMSrcSink.h

Issue 980333002: DM: support non-fatal errors (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dm/DMSrcSink.h
diff --git a/dm/DMSrcSink.h b/dm/DMSrcSink.h
index faa333392282294faa413c8c8efc17b6320d8c0a..dcd169e32283977beabfb2655a821374370be0e8 100644
--- a/dm/DMSrcSink.h
+++ b/dm/DMSrcSink.h
@@ -18,10 +18,33 @@ struct ImplicitString : public SkString {
template <typename T>
ImplicitString(const T& s) : SkString(s) {}
};
-typedef ImplicitString Error;
typedef ImplicitString Name;
typedef ImplicitString Path;
+class Error {
+public:
+ Error(const SkString& s) : fMsg(s), fFatal(!this->isEmpty()) {}
+ Error(const char* s) : fMsg(s), fFatal(!this->isEmpty()) {}
+
+ Error(const Error&) = default;
+ Error& operator=(const Error&) = default;
+
+ static Error Nonfatal(const SkString& s) { return Nonfatal(s.c_str()); }
+ static Error Nonfatal(const char* s) {
+ Error e(s);
+ e.fFatal = false;
+ return e;
+ }
+
+ const char* c_str() const { return fMsg.c_str(); }
+ bool isEmpty() const { return fMsg.isEmpty(); }
+ bool isFatal() const { return fFatal; }
+
+private:
+ SkString fMsg;
+ bool fFatal;
+};
+
struct Src {
// All Srcs must be thread safe.
virtual ~Src() {}
« no previous file with comments | « dm/DM.cpp ('k') | dm/DMSrcSink.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698