skia2/include/core
Mike Klein 48e08aa973 <ostream> -> <iosfwd>
<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>
2019-08-27 13:08:56 +00:00
..
SkAnnotation.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkBBHFactory.h simplify rtree loops in Skia too 2019-05-15 15:42:10 +00:00
SkBitmap.h Fix SkPixmap and SkBitmap dox for computeByteSize 2019-07-10 19:43:59 +00:00
SkBlendMode.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkBlurTypes.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkCanvas.h note that drawAtlas does nothing if atlas is null 2019-08-07 15:27:02 +00:00
SkCanvasVirtualEnforcer.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkClipOp.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkColor.h Move SkColorChannel into SkColor 2019-07-26 15:50:12 +00:00
SkColorFilter.h Reland: SkColorfilters::HSLAMatrix 2019-08-01 23:04:22 +00:00
SkColorPriv.h cut SK_SAMPLES_FOR_X, simplify SK_?32_SHIFT 2019-04-24 20:58:58 +00:00
SkColorSpace.h add SkNamedTransferFn::kRec2020 2019-05-24 16:03:03 +00:00
SkContourMeasure.h More classes no longer inherit from SkNoncopyable 2019-06-10 18:15:18 +00:00
SkCoverageMode.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkCubicMap.h [skottie] De-dupe sequential cubic mappers 2019-07-17 17:14:46 +00:00
SkData.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkDataTable.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkDeferredDisplayListRecorder.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkDeque.h More classes no longer inherit from SkNoncopyable 2019-06-10 18:15:18 +00:00
SkDocument.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkDrawable.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkDrawLooper.h Return translate info from looper, rather than moding a canvas 2019-07-25 20:39:13 +00:00
SkEncodedImageFormat.h
SkExecutor.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFilterQuality.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFlattenable.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFont.h Rename SkStrikeSpecStorage -> SkStrikeSpec 2019-06-06 18:01:02 +00:00
SkFontArguments.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFontLCDConfig.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFontMetrics.h Restore SkFontMetrics documentation. 2019-08-15 18:11:39 +00:00
SkFontMgr.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFontParameters.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFontStyle.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkFontTypes.h Remove SkTextEncoding and SkFontHinting macros. 2019-05-22 20:44:28 +00:00
SkGraphics.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkICC.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkImage.h Reland "Remove old version of MakeCrossContextFromPixmap" 2019-08-20 14:49:59 +00:00
SkImageEncoder.h Revert "add runtime registration for encoders" 2019-05-15 22:02:39 +00:00
SkImageFilter.h Move SkImageFilter functionality into private SkImageFilter_Base 2019-08-02 18:56:39 +00:00
SkImageGenerator.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkImageInfo.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkMallocPixelRef.h SkMallocPixelRef: remove MakeDirect and MakeWithProc from API. 2019-08-15 19:01:13 +00:00
SkMaskFilter.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkMath.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkMatrix44.h SkVector4 as ctype for half4 2019-06-02 18:32:45 +00:00
SkMatrix.h Change SkMatrix::decomposeScale to use preScale 2019-07-19 15:41:11 +00:00
SkMilestone.h Update Skia milestone to 78 2019-07-25 11:05:37 +00:00
SkMultiPictureDraw.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkOverdrawCanvas.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPaint.h remove code now that loopers are dead (w.r.t. canvas and paint) 2019-07-30 12:49:28 +00:00
SkPath.h Revert "Temporary Lua hook to measure impact of conservative convexity" 2019-08-22 15:07:20 +00:00
SkPathEffect.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPathMeasure.h More classes no longer inherit from SkNoncopyable 2019-06-10 18:15:18 +00:00
SkPicture.h move all picture version crap into single header 2019-07-30 20:15:07 +00:00
SkPictureRecorder.h More classes no longer inherit from SkNoncopyable 2019-06-10 18:15:18 +00:00
SkPixelRef.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPixmap.h Fix SkPixmap and SkBitmap dox for computeByteSize 2019-07-10 19:43:59 +00:00
SkPngChunkReader.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPoint3.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPoint.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkPostConfig.h Add SkUNREACHABLE to definition of SK_ABORT. 2019-08-09 20:43:39 +00:00
SkPreConfig.h Revert "simplify and centralize SK_API" 2019-04-22 18:09:45 +00:00
SkPromiseImageTexture.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkRasterHandleAllocator.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkRect.h remove unneeded noemptycheck variants of intersect 2019-08-26 15:03:44 +00:00
SkRefCnt.h <ostream> -> <iosfwd> 2019-08-27 13:08:56 +00:00
SkRegion.h more rect api simplifications 2019-08-25 10:12:57 +00:00
SkRRect.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkRSXform.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkRWBuffer.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkScalar.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkSerialProcs.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkShader.h Optional local matrix for SkShaders factories 2019-07-09 18:09:14 +00:00
SkSize.h Pass GrBackendFormat to GrResourceProvider and GrGpu texture create 2019-08-05 17:33:17 +00:00
SkStream.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkString.h Don't mark inline functions in SkString.h as static. 2019-06-04 11:40:02 +00:00
SkStrokeRec.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkSurface.h Add bridge between GrContext::createBackendTexture and SkSurface::MakeFromBackendTexture 2019-07-03 12:31:12 +00:00
SkSurfaceCharacterization.h Add protected status to SkSurfaceCharacterization 2019-07-10 16:30:35 +00:00
SkSurfaceProps.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkSwizzle.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTextBlob.h Use SkTextEncoding enum instead of macros. 2019-05-07 20:54:16 +00:00
SkTileMode.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTime.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTraceMemoryDump.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkTypeface.h add copytable method to typefaces 2019-07-24 19:20:46 +00:00
SkTypes.h remove default looper flag, rely on clients to opt-in 2019-07-23 14:20:09 +00:00
SkUnPreMultiply.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkVertices.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00
SkYUVAIndex.h Move SkColorChannel into SkColor 2019-07-26 15:50:12 +00:00
SkYUVASizeInfo.h rewrite includes to not need so much -Ifoo 2019-04-24 16:27:11 +00:00