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> |
||
---|---|---|
animations | ||
bench | ||
bin | ||
build_overrides | ||
dm | ||
docker | ||
docs/examples | ||
example | ||
experimental | ||
fuzz | ||
gm | ||
gn | ||
include | ||
infra | ||
modules | ||
platform_tools | ||
resources | ||
samplecode | ||
site | ||
specs | ||
src | ||
tests | ||
third_party | ||
tools | ||
.clang-format | ||
.clang-tidy | ||
.gitignore | ||
.gn | ||
AUTHORS | ||
BUILD.gn | ||
codereview.settings | ||
CONTRIBUTING | ||
CQ_COMMITTERS | ||
DEPS | ||
go.mod | ||
go.sum | ||
LICENSE | ||
OWNERS | ||
PRESUBMIT.py | ||
public.bzl | ||
README | ||
README.chromium | ||
RELEASE_NOTES.txt | ||
whitespace.txt |
Skia is a complete 2D graphic library for drawing Text, Geometries, and Images. See full details, and build instructions, at https://skia.org.