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

Issue 2267183003: Switch from PrintTo to operator<< for platform printers (Closed)

Created:
4 years, 4 months ago by pdr.
Modified:
4 years, 4 months ago
Reviewers:
danakj, chrishtr
CC:
ajuma+watch_chromium.org, blink-reviews, blink-reviews-platform-graphics_chromium.org, Rik, chromium-reviews, danakj+watch_chromium.org, dshwang, drott+blinkwatch_chromium.org, krit, f(malita), jbroman, Justin Novosad, pdr+graphicswatchlist_chromium.org, rwlbuis, Stephen Chennney
Base URL:
https://chromium.googlesource.com/chromium/src.git@master
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Switch from PrintTo to operator<< for platform printers This patch adds operator<< on all platform datatypes which forwards to the toString() functions added in crbug.com/632096. For example, to print the value of a LayoutRect: LayoutRect overflowRect(1, 2, 3, 4); LOG(INFO) << "overflow: " << overflowRect; Which prints: overflow: "1,2 3x4" gtests will automatically call the operator<< functions so the PrintTo functions have been removed. operator<< is rare but follows https://google.github.io/styleguide/cppguide.html. Binary size difference on linux with is_official_build: 17808b :( BUG=632096

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+120 lines, -303 lines) Patch
M third_party/WebKit/Source/platform/blink_platform.gypi View 2 chunks +0 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/DoublePoint.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/DoublePoint.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/DoubleRect.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/DoubleRect.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/DoubleSize.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/DoubleSize.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatBox.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatBox.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatPoint.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatPoint.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatPoint3D.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatPoint3D.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatQuad.h View 1 chunk +1 line, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatQuad.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatRect.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatRect.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatRoundedRect.h View 1 chunk +2 lines, -4 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp View 1 chunk +9 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatSize.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/FloatSize.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/IntPoint.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/IntPoint.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/IntRect.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/IntRect.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/IntSize.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/IntSize.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/LayoutPoint.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/LayoutPoint.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/LayoutRect.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/LayoutRect.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/LayoutSize.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/geometry/LayoutSize.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
D third_party/WebKit/Source/platform/testing/GeometryPrinters.h View 1 chunk +0 lines, -60 lines 0 comments Download
D third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp View 1 chunk +0 lines, -111 lines 0 comments Download
M third_party/WebKit/Source/platform/testing/PaintPrinters.cpp View 3 chunks +4 lines, -10 lines 0 comments Download
M third_party/WebKit/Source/platform/testing/PictureMatchers.cpp View 3 chunks +3 lines, -7 lines 0 comments Download
D third_party/WebKit/Source/platform/testing/TransformPrinters.h View 1 chunk +0 lines, -31 lines 0 comments Download
D third_party/WebKit/Source/platform/testing/TransformPrinters.cpp View 1 chunk +0 lines, -24 lines 0 comments Download
M third_party/WebKit/Source/platform/transforms/AffineTransform.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/transforms/AffineTransform.cpp View 1 chunk +5 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/platform/transforms/TransformationMatrix.h View 1 chunk +1 line, -3 lines 0 comments Download
M third_party/WebKit/Source/platform/transforms/TransformationMatrix.cpp View 1 chunk +5 lines, -0 lines 0 comments Download

Messages

Total messages: 7 (2 generated)
pdr.
Unfortunately this had a huge effect on binary size :( Do either of you know ...
4 years, 4 months ago (2016-08-24 18:48:02 UTC) #3
danakj
On Wed, Aug 24, 2016 at 11:48 AM, <pdr@chromium.org> wrote: > Reviewers: chrishtr, danakj > ...
4 years, 4 months ago (2016-08-24 19:01:37 UTC) #4
danakj
On Wed, Aug 24, 2016 at 11:53 AM, <danakj@chromium.org> wrote: > On Wed, Aug 24, ...
4 years, 4 months ago (2016-08-24 19:01:54 UTC) #5
danakj
On Wed, Aug 24, 2016 at 11:48 AM, <pdr@chromium.org> wrote: > Reviewers: chrishtr, danakj > ...
4 years, 4 months ago (2016-08-24 19:01:59 UTC) #6
danakj
4 years, 4 months ago (2016-08-24 19:02:31 UTC) #7
Message was sent while issue was closed.
On Wed, Aug 24, 2016 at 11:53 AM, <danakj@chromium.org> wrote:

> On Wed, Aug 24, 2016 at 11:48 AM, <pdr@chromium.org> wrote:
>
>> Reviewers: chrishtr, danakj
>> CL: https://codereview.chromium.org/2267183003/
>>
>> Message:
>> Unfortunately this had a huge effect on binary size :(
>>
>> Do either of you know why?
>>
>
> Newp. But http://arstechnica.com/civis/viewtopic.php?f=20&t=179042 says:
"what
> we get in return is a '#include <iostream>' that doubles your compile times
> and adds 100K to your binary size" due to horrible templates.
>

And https://lists.webkit.org/pipermail/webkit-dev/2012-July/021525.html
says:

"Now consider the stream form:

thingy << "foo " << a << " bar " << someWeirdNonsenseToEnableHex << b << "
baz " << c << endl;

This is 8 procedure calls and three string constants. This code will be
somewhere around 8 times fatter. Hence, you will be less likely to want to
enable such debug statements in release builds both due to fears concerning
unnecessary increases in binary size, and unnecessary increases in compile
times."

But I don't know that it explains operator<<(std::string) vs
operator<<(IntRect).


>
>
>>
>> Description:
>> Switch from PrintTo to operator<< for platform printers
>>
>> This patch adds operator<< on all platform datatypes which forwards
>> to the toString() functions added in crbug.com/632096.
>>
>> For example, to print the value of a LayoutRect:
>> LayoutRect overflowRect(1, 2, 3, 4);
>> LOG(INFO) << "overflow: " << overflowRect;
>> Which prints:
>> overflow: "1,2 3x4"
>>
>> gtests will automatically call the operator<< functions so the PrintTo
>> functions have been removed. operator<< is rare but follows
>> https://google.github.io/styleguide/cppguide.html.
>>
>> Binary size difference on linux with is_official_build: 17808b :(
>>
>> BUG=632096
>>
>> Base URL: https://chromium.googlesource.com/chromium/src.git@master
>>
>> Affected files (+120, -303 lines):
>> M third_party/WebKit/Source/platform/blink_platform.gypi
>> M third_party/WebKit/Source/platform/geometry/DoublePoint.h
>> M third_party/WebKit/Source/platform/geometry/DoublePoint.cpp
>> M third_party/WebKit/Source/platform/geometry/DoubleRect.h
>> M third_party/WebKit/Source/platform/geometry/DoubleRect.cpp
>> M third_party/WebKit/Source/platform/geometry/DoubleSize.h
>> M third_party/WebKit/Source/platform/geometry/DoubleSize.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatBox.h
>> M third_party/WebKit/Source/platform/geometry/FloatBox.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatPoint.h
>> M third_party/WebKit/Source/platform/geometry/FloatPoint.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatPoint3D.h
>> M third_party/WebKit/Source/platform/geometry/FloatPoint3D.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatQuad.h
>> M third_party/WebKit/Source/platform/geometry/FloatQuad.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatRect.h
>> M third_party/WebKit/Source/platform/geometry/FloatRect.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatRoundedRect.h
>> M third_party/WebKit/Source/platform/geometry/FloatRoundedRect.cpp
>> M third_party/WebKit/Source/platform/geometry/FloatSize.h
>> M third_party/WebKit/Source/platform/geometry/FloatSize.cpp
>> M third_party/WebKit/Source/platform/geometry/IntPoint.h
>> M third_party/WebKit/Source/platform/geometry/IntPoint.cpp
>> M third_party/WebKit/Source/platform/geometry/IntRect.h
>> M third_party/WebKit/Source/platform/geometry/IntRect.cpp
>> M third_party/WebKit/Source/platform/geometry/IntSize.h
>> M third_party/WebKit/Source/platform/geometry/IntSize.cpp
>> M third_party/WebKit/Source/platform/geometry/LayoutPoint.h
>> M third_party/WebKit/Source/platform/geometry/LayoutPoint.cpp
>> M third_party/WebKit/Source/platform/geometry/LayoutRect.h
>> M third_party/WebKit/Source/platform/geometry/LayoutRect.cpp
>> M third_party/WebKit/Source/platform/geometry/LayoutSize.h
>> M third_party/WebKit/Source/platform/geometry/LayoutSize.cpp
>> D third_party/WebKit/Source/platform/testing/GeometryPrinters.h
>> D third_party/WebKit/Source/platform/testing/GeometryPrinters.cpp
>> M third_party/WebKit/Source/platform/testing/PaintPrinters.cpp
>> M third_party/WebKit/Source/platform/testing/PictureMatchers.cpp
>> D third_party/WebKit/Source/platform/testing/TransformPrinters.h
>> D third_party/WebKit/Source/platform/testing/TransformPrinters.cpp
>> M third_party/WebKit/Source/platform/transforms/AffineTransform.h
>> M third_party/WebKit/Source/platform/transforms/AffineTransform.cpp
>> M third_party/WebKit/Source/platform/transforms/TransformationMatrix.h
>> M third_party/WebKit/Source/platform/transforms/TransformationMatrix.cpp
>>
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups
"Chromium-reviews" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to chromium-reviews+unsubscribe@chromium.org.

Powered by Google App Engine
This is Rietveld 408576698