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

Issue 314053002: Fix comparisons (Closed)

Created:
6 years, 6 months ago by darin (slow to review)
Modified:
6 years, 6 months ago
Reviewers:
jamesr, chrishtr, enne (OOO)
CC:
chromium-reviews, Ian Vollick, sievers+watch_chromium.org, jbauman+watch_chromium.org, kalyank, piman+watch_chromium.org, danakj+watch_chromium.org, cc-bugs_chromium.org, danakj
Visibility:
Public.

Description

Fix comparisons. The type returned cc::Layer::transform_origin() is gfx::Point3F not gfx::PointF. Follow-up from http://crrev.com/274990. TBR=chrishtr@chromium.org Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=275028

Patch Set 1 #

Patch Set 2 : directly compare Point3F objects rather than the output of .ToString #

Unified diffs Side-by-side diffs Delta from patch set Stats (+3 lines, -6 lines) Patch
M ui/compositor/layer_unittest.cc View 1 3 chunks +3 lines, -6 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
darin (slow to review)
6 years, 6 months ago (2014-06-05 06:17:51 UTC) #1
darin (slow to review)
It seems like the string compares were unnecessary and error-prone. Better to just compare gfx::Point3F ...
6 years, 6 months ago (2014-06-05 06:21:56 UTC) #2
darin (slow to review)
Committed patchset #2 manually as r275028 (tree was closed).
6 years, 6 months ago (2014-06-05 06:22:51 UTC) #3
enne (OOO)
String compares have much better output when they fail, which is why they were done ...
6 years, 6 months ago (2014-06-05 16:52:54 UTC) #4
darin (slow to review)
On 2014/06/05 16:52:54, enne wrote: > String compares have much better output when they fail, ...
6 years, 6 months ago (2014-06-09 16:05:04 UTC) #5
jamesr
On 2014/06/09 16:05:04, darin wrote: > On 2014/06/05 16:52:54, enne wrote: > > String compares ...
6 years, 6 months ago (2014-06-09 16:09:50 UTC) #6
darin (slow to review)
inline the function? that should make it test only, right? you can also use the ...
6 years, 6 months ago (2014-06-09 16:10:57 UTC) #7
darin (slow to review)
Also, since operator<< can just be a global function, you could put its definition in ...
6 years, 6 months ago (2014-06-09 16:12:30 UTC) #8
jamesr
An inline function performing ostream operations will be really massive - I'd worry about blowing ...
6 years, 6 months ago (2014-06-09 16:15:30 UTC) #9
darin (slow to review)
On 2014/06/09 16:15:30, jamesr wrote: > An inline function performing ostream operations will be really ...
6 years, 6 months ago (2014-06-09 16:20:12 UTC) #10
jamesr
On 2014/06/09 16:20:12, darin wrote: > On 2014/06/09 16:15:30, jamesr wrote: > > An inline ...
6 years, 6 months ago (2014-06-09 16:59:43 UTC) #11
darin (slow to review)
I see. Well, I guess there are three options: 1) Status-quo string compares. Sometimes encounter ...
6 years, 6 months ago (2014-06-09 17:26:44 UTC) #12
danakj
6 years, 6 months ago (2014-06-09 17:27:33 UTC) #13
On Mon, Jun 9, 2014 at 1:26 PM, Darin Fisher <darin@chromium.org> wrote:

> I see. Well, I guess there are three options:
>
> 1) Status-quo string compares. Sometimes encounter mismatch issues like
> the one I fixed here.
> 2) Define operator<< inline, but guard the include for ostream and the
> operator<< definition with UNIT_TEST #define.
> 3) Create a separate "test_utils" .h and .cc for operator<< that would
> only be included and linked against by tests.
>
> I think you all should decide which way you want to go. I'm a fan of #2 or
> #3 since type safety seems like a good thing, and it allows you to type a
> bit less code.
>

I'd love to see #3.


>
> -Darin
>
>
> On Mon, Jun 9, 2014 at 9:59 AM, <jamesr@chromium.org> wrote:
>
>> On 2014/06/09 16:20:12, darin wrote:
>>
>>> On 2014/06/09 16:15:30, jamesr wrote:
>>> > An inline function performing ostream operations will be really
>>> massive -
>>>
>> I'd
>>
>>> > worry about blowing the linker out.  The test_utils thing might work, I
>>> haven't
>>> > tried.
>>>
>>
>>  Hmm... these classes already have a .ToString() method that does most of
>>> the
>>> work.
>>>
>>
>> Yes, but that's out-of-line and only requires #including <string>, which
>> most
>> translation units will have anyway.  A stream-based operator<< would
>> require
>> including at least <ostream>.  Since the style guide bans streams in
>> general, I
>> doubt most translation units will have it.  On my linux box, just adding
>> #include <ostream> increases the post-preprocessing size of
>> ui/gfx/geometry/point3_f.cc by 34% (17555 lines to 23559 lines).
>>
>> https://codereview.chromium.org/314053002/
>>
>
>

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