Bug 108628 - Added TriState to WTF and started using it in one place
Summary: Added TriState to WTF and started using it in one place
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Geoffrey Garen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-01 06:12 PST by Geoffrey Garen
Modified: 2013-02-01 13:33 PST (History)
7 users (show)

See Also:


Attachments
Patch (11.61 KB, patch)
2013-02-01 06:17 PST, Geoffrey Garen
bdakin: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Geoffrey Garen 2013-02-01 06:12:49 PST
Added TriState to WTF and started using it in one place
Comment 1 Geoffrey Garen 2013-02-01 06:17:22 PST
Created attachment 186030 [details]
Patch
Comment 2 Geoffrey Garen 2013-02-01 07:02:59 PST
Committed r141588: <http://trac.webkit.org/changeset/141588>
Comment 3 Mark Lam 2013-02-01 10:09:17 PST
Comment on attachment 186030 [details]
Patch

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

> Source/WTF/wtf/TriState.h:35
> +};

If you use the new EnumClass.h, you can make this:

ENUM_CLASS_BEGIN(TriState) {
    False,
    True,
    Mixed
} ENUM_CLASS_END(TriState);

And everywhere you use TriState::False, TriState::True, and TriState::Mixed.  Not sure that that is better, but fyi for your consideration.
Comment 4 Benjamin Poulain 2013-02-01 13:33:30 PST
Comment on attachment 186030 [details]
Patch

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

> Source/WTF/WTF.xcodeproj/project.pbxproj:-313
>  		FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
> -		FE43302716A7ADC300D1585D /* TypeSafeEnum.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43302616A7ADC300D1585D /* TypeSafeEnum.h */; };

Why are you removing the TypeSafeEnum?

> Source/WTF/WTF.xcodeproj/project.pbxproj:1264
>  				A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
> +				149EF16316BBFE0D000A4331 /* TriState.h in Headers */,

Build section unsorted :(

>> Source/WTF/wtf/TriState.h:35
>> +enum TriState {
>> +    FalseTriState,
>> +    TrueTriState,
>> +    MixedTriState
>> +};
> 
> If you use the new EnumClass.h, you can make this:
> 
> ENUM_CLASS_BEGIN(TriState) {
>     False,
>     True,
>     Mixed
> } ENUM_CLASS_END(TriState);
> 
> And everywhere you use TriState::False, TriState::True, and TriState::Mixed.  Not sure that that is better, but fyi for your consideration.

Instead of an enum, I wonder if this would not benefit from a class with the logic function explicitly defined?

If you plan to use the TriState in logic operations, it would be beneficial to define and, or and not.