48e08aa973
<ostream> is one of the more expensive headers to include and that's amplified by SkRefCnt.h's popularity. We've been including <ostream> for sk_sp's operator<<. That's only used by Chromium and while we could just sprinkle in a bunch of .get() calls and remove operator<<, when I started going through and actually doing that I got the feeling I was making things pointlessly harder to read and write, and wanted to find a way to make it actually work. My next instinct was to template it without mentioning ostreams, template <typename OS, typename T> auto operator<<(OS& os, const sk_sp<T>& sp) -> decltype(os << sp.get()) { return os << sp.get(); } but that makes this operator<< ambiguous with some other templated operator<< in GTest. They got in first, so they win... So ultimately, switch <ostream> to <iosfwd>. Anyone using our operator<<() presumably has <ostream> included already, and the #include cost for <iosfwd> is small enough that I don't think we'll mind keeping this around indefinitely. To repro, look at before/after of -ftime-trace: ~/chromium/src/third_party/llvm-build/Release+Asserts/bin/clang++ -I. -Os -c src/core/SkCanvas.cpp -ftime-trace I have tested locally that Chromium builds with this change. Change-Id: I9decc2e65b5cc8fd07d8106a5eff81901aedd7d5 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/237190 Commit-Queue: Mike Klein <mtklein@google.com> Reviewed-by: Brian Osman <brianosman@google.com> |
||
---|---|---|
.. | ||
android | ||
atlastext | ||
c | ||
codec | ||
config | ||
core | ||
docs | ||
effects | ||
encode | ||
gpu | ||
pathops | ||
ports | ||
private | ||
svg | ||
third_party | ||
utils |