Bug 47063 - Fix broken C++ in PODInterval and PODIntervalTree
Summary: Fix broken C++ in PODInterval and PODIntervalTree
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Other OS X 10.5
: P2 Normal
Assignee: Nico Weber
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-10-03 12:13 PDT by Nico Weber
Modified: 2010-10-04 23:10 PDT (History)
6 users (show)

See Also:


Attachments
Patch (6.73 KB, patch)
2010-10-03 12:50 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch (11.75 KB, patch)
2010-10-04 09:55 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch (12.01 KB, patch)
2010-10-04 12:16 PDT, Nico Weber
no flags Details | Formatted Diff | Diff
Patch (12.03 KB, patch)
2010-10-04 13:43 PDT, Nico Weber
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nico Weber 2010-10-03 12:13:02 PDT
Fix broken C++ in PODInterval and PODIntervalTree
Comment 1 Nico Weber 2010-10-03 12:50:37 PDT
Created attachment 69592 [details]
Patch
Comment 2 Nico Weber 2010-10-03 12:52:28 PDT
kbr: Please review.

evan, hans: fyi
Comment 3 WebKit Review Bot 2010-10-03 13:12:46 PDT
Attachment 69592 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/4162058
Comment 4 Nico Weber 2010-10-03 13:21:53 PDT
dglazkov: Which gcc version is cr-linux running? Builds fine for me locally with 4.0.1 and 4.2.1.
Comment 5 Nico Weber 2010-10-04 08:45:31 PDT
Turns out function templates can't be partially specialized. Please refrain from reviewing…
Comment 6 Nico Weber 2010-10-04 09:07:00 PDT
Thinking about this, the options seem to be:

1. Convert the function template into a class template, which can then use partial specialization like this:
template <class T>
struct ValueToString {
    static String value(const T& t);
};
template <>
struct<int> ValueToString {
    static String value(const int& t) { return intToStr(t); }
};

etc.


2. Use argument-dependent lookup for the function. ADL only works for class types, so I'd need to declare the function for all basic types, and could then use ADL for the rest.


3. Just delete this code. It's only used for debugging and probably isn't worth all the complexity.


I think we should go with 3. Comments?
Comment 7 Kenneth Russell 2010-10-04 09:09:29 PDT
(In reply to comment #6)
> Thinking about this, the options seem to be:
> 
> 1. Convert the function template into a class template, which can then use partial specialization like this:
> template <class T>
> struct ValueToString {
>     static String value(const T& t);
> };
> template <>
> struct<int> ValueToString {
>     static String value(const int& t) { return intToStr(t); }
> };
> 
> etc.
> 
> 
> 2. Use argument-dependent lookup for the function. ADL only works for class types, so I'd need to declare the function for all basic types, and could then use ADL for the rest.
> 
> 
> 3. Just delete this code. It's only used for debugging and probably isn't worth all the complexity.
> 
> 
> I think we should go with 3. Comments?

I do not support simply deleting this code. It has occasionally proven essential for debugging purposes. The original code used iostreams and overloaded operator<< to provide printing functionality. Either option (1) or (2) sounds fine. I'm happy to make the change to (1) if you want.
Comment 8 Nico Weber 2010-10-04 09:55:27 PDT
Created attachment 69644 [details]
Patch
Comment 9 Nico Weber 2010-10-04 09:56:07 PDT
Approach 1 it is.
Comment 10 WebKit Review Bot 2010-10-04 11:08:27 PDT
Attachment 69644 [details] did not build on chromium:
Build output: http://queues.webkit.org/results/4173065
Comment 11 Nico Weber 2010-10-04 12:16:57 PDT
Created attachment 69664 [details]
Patch
Comment 12 Kenneth Russell 2010-10-04 13:39:59 PDT
Comment on attachment 69664 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=69664&action=review

Code changes look fine; please note minor documentation changes needed.

> WebCore/platform/graphics/gpu/PODInterval.h:64
> +//       String string(const T& t);

This should be documented as being static, as is used in the code.

> WebCore/platform/graphics/gpu/PODInterval.h:67
> +//       String string(const UserData& t);

static.

> WebCore/platform/graphics/gpu/PODRedBlackTree.h:48
> +//       String string(const T& t);

static.
Comment 13 Nico Weber 2010-10-04 13:43:44 PDT
Created attachment 69677 [details]
Patch
Comment 14 Kenneth Russell 2010-10-04 14:07:25 PDT
Comment on attachment 69677 [details]
Patch

Looks fine. I think you need to wait for the r+ before marking it cq+, though.
Comment 15 WebKit Commit Bot 2010-10-04 23:10:16 PDT
Comment on attachment 69677 [details]
Patch

Clearing flags on attachment: 69677

Committed r69081: <http://trac.webkit.org/changeset/69081>
Comment 16 WebKit Commit Bot 2010-10-04 23:10:23 PDT
All reviewed patches have been landed.  Closing bug.