Changeset 141588 in webkit


Ignore:
Timestamp:
Feb 1, 2013 7:01:34 AM (11 years ago)
Author:
ggaren@apple.com
Message:

Added TriState to WTF and started using it in one place
https://bugs.webkit.org/show_bug.cgi?id=108628

Reviewed by Beth Dakin.

../JavaScriptCore:

  • runtime/PrototypeMap.h:

(JSC::PrototypeMap::isPrototype): Use TriState instead of boolean. In
response to review feedback, this is an attempt to clarify that our
'true' condition is actually just a 'maybe'.

  • runtime/PrototypeMap.h:

(PrototypeMap):
(JSC::PrototypeMap::isPrototype):

../WebCore:

  • editing/EditingStyle.h:

(WebCore): Moved TriState to WTF so it can be used in more places.

../WTF:

Useful for expressing "maybe" conditions in a boolean context.

  • WTF.xcodeproj/project.pbxproj:
  • wtf/TriState.h: Added.

(WTF):

Location:
trunk/Source
Files:
1 added
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r141578 r141588  
     12013-02-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added TriState to WTF and started using it in one place
     4        https://bugs.webkit.org/show_bug.cgi?id=108628
     5
     6        Reviewed by Beth Dakin.
     7
     8        * runtime/PrototypeMap.h:
     9        (JSC::PrototypeMap::isPrototype): Use TriState instead of boolean. In
     10        response to review feedback, this is an attempt to clarify that our
     11        'true' condition is actually just a 'maybe'.
     12
     13        * runtime/PrototypeMap.h:
     14        (PrototypeMap):
     15        (JSC::PrototypeMap::isPrototype):
     16
    1172013-02-01  Alexis Menard  <alexis@webkit.org>
    218
  • trunk/Source/JavaScriptCore/runtime/PrototypeMap.h

    r141050 r141588  
    2828
    2929#include "WeakGCMap.h"
     30#include <wtf/TriState.h>
    3031
    3132namespace JSC {
     
    4041    void clearEmptyObjectStructureForPrototype(JSObject*, unsigned inlineCapacity);
    4142    void addPrototype(JSObject*);
    42     bool isPrototype(JSObject*); // Returns a conservative estimate.
     43    TriState isPrototype(JSObject*) const; // Returns a conservative estimate.
    4344
    4445private:
     
    4849};
    4950
    50 inline bool PrototypeMap::isPrototype(JSObject* object)
     51inline TriState PrototypeMap::isPrototype(JSObject* object) const
    5152{
    52     return m_prototypes.contains(object);
     53    if (!m_prototypes.contains(object))
     54        return FalseTriState;
     55
     56    // We know that 'object' was used as a prototype at one time, so be
     57    // conservative and say that it might still be so. (It would be expensive
     58    // to find out for sure, and we don't know of any cases where being precise
     59    // would improve performance.)
     60    return MixedTriState;
    5361}
    5462
  • trunk/Source/WTF/ChangeLog

    r141586 r141588  
     12013-02-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added TriState to WTF and started using it in one place
     4        https://bugs.webkit.org/show_bug.cgi?id=108628
     5
     6        Reviewed by Beth Dakin.
     7
     8        Useful for expressing "maybe" conditions in a boolean context.
     9
     10        * WTF.xcodeproj/project.pbxproj:
     11        * wtf/TriState.h: Added.
     12        (WTF):
     13
    1142013-02-01  Patrick Gansterer  <paroga@webkit.org>
    215
  • trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r141308 r141588  
    3333                143F611F1565F0F900DB514A /* RAMSize.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 143F611D1565F0F900DB514A /* RAMSize.cpp */; };
    3434                143F61201565F0F900DB514A /* RAMSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 143F611E1565F0F900DB514A /* RAMSize.h */; settings = {ATTRIBUTES = (); }; };
     35                149EF16316BBFE0D000A4331 /* TriState.h in Headers */ = {isa = PBXBuildFile; fileRef = 149EF16216BBFE0D000A4331 /* TriState.h */; settings = {ATTRIBUTES = (Private, ); }; };
    3536                14F3B0F715E45E4600210069 /* SaturatedArithmetic.h in Headers */ = {isa = PBXBuildFile; fileRef = 14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */; settings = {ATTRIBUTES = (); }; };
    3637                1A6BB769162F300500DD16DB /* StreamBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 1A6BB768162F300500DD16DB /* StreamBuffer.h */; };
     
    311312                FEDACD3D1630F83F00C69634 /* StackStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FEDACD3B1630F83F00C69634 /* StackStats.cpp */; };
    312313                FEDACD3E1630F83F00C69634 /* StackStats.h in Headers */ = {isa = PBXBuildFile; fileRef = FEDACD3C1630F83F00C69634 /* StackStats.h */; };
    313                 FE43302716A7ADC300D1585D /* TypeSafeEnum.h in Headers */ = {isa = PBXBuildFile; fileRef = FE43302616A7ADC300D1585D /* TypeSafeEnum.h */; };
    314314/* End PBXBuildFile section */
    315315
     
    336336                143F611D1565F0F900DB514A /* RAMSize.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RAMSize.cpp; sourceTree = "<group>"; };
    337337                143F611E1565F0F900DB514A /* RAMSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RAMSize.h; sourceTree = "<group>"; };
     338                149EF16216BBFE0D000A4331 /* TriState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TriState.h; sourceTree = "<group>"; };
    338339                14F3B0F615E45E4600210069 /* SaturatedArithmetic.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SaturatedArithmetic.h; sourceTree = "<group>"; };
    339340                1A6BB768162F300500DD16DB /* StreamBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StreamBuffer.h; sourceTree = "<group>"; };
     
    624625                FEDACD3B1630F83F00C69634 /* StackStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackStats.cpp; sourceTree = "<group>"; };
    625626                FEDACD3C1630F83F00C69634 /* StackStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackStats.h; sourceTree = "<group>"; };
    626                 FE43302616A7ADC300D1585D /* TypeSafeEnum.h */ = {isa = PBXFileReference; fileEncoding = 4; path = TypeSafeEnum.h; sourceTree = "<group>"; };
    627627/* End PBXFileReference section */
    628628
     
    870870                                A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */,
    871871                                A8A4733F151A825B004123FF /* ThreadSpecific.h */,
     872                                149EF16216BBFE0D000A4331 /* TriState.h */,
    872873                                A8A47341151A825B004123FF /* TypedArrayBase.h */,
    873                                 FE43302616A7ADC300D1585D /* TypeSafeEnum.h */,
    874874                                A8A47342151A825B004123FF /* TypeTraits.cpp */,
    875875                                A8A47343151A825B004123FF /* TypeTraits.h */,
     
    12301230                                A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */,
    12311231                                A8A47457151A825B004123FF /* TypedArrayBase.h in Headers */,
    1232                                 FE43302716A7ADC300D1585D /* TypeSafeEnum.h in Headers */,
    12331232                                A8A47459151A825B004123FF /* TypeTraits.h in Headers */,
    12341233                                A8A4745C151A825B004123FF /* Uint16Array.h in Headers */,
     
    12631262                                A8A47446151A825B004123FF /* WTFString.h in Headers */,
    12641263                                A8A47487151A825B004123FF /* WTFThreadData.h in Headers */,
     1264                                149EF16316BBFE0D000A4331 /* TriState.h in Headers */,
    12651265                        );
    12661266                        runOnlyForDeploymentPostprocessing = 0;
  • trunk/Source/WebCore/ChangeLog

    r141579 r141588  
     12013-02-01  Geoffrey Garen  <ggaren@apple.com>
     2
     3        Added TriState to WTF and started using it in one place
     4        https://bugs.webkit.org/show_bug.cgi?id=108628
     5
     6        Reviewed by Beth Dakin.
     7
     8        * editing/EditingStyle.h:
     9        (WebCore): Moved TriState to WTF so it can be used in more places.
     10
    1112013-02-01  Pavel Feldman  <pfeldman@chromium.org>
    212
  • trunk/Source/WebCore/editing/EditingStyle.h

    r137370 r141588  
    11/*
    22 * Copyright (C) 2010 Google Inc. All rights reserved.
     3 * Copyright (C) 2013 Apple Inc. All rights reserved.
    34 *
    45 * Redistribution and use in source and binary forms, with or without
     
    3738#include <wtf/RefCounted.h>
    3839#include <wtf/RefPtr.h>
     40#include <wtf/TriState.h>
    3941#include <wtf/Vector.h>
    4042#include <wtf/text/WTFString.h>
     
    5658class StyledElement;
    5759class VisibleSelection;
    58 
    59 enum TriState { FalseTriState, TrueTriState, MixedTriState };
    6060
    6161class EditingStyle : public RefCounted<EditingStyle> {
Note: See TracChangeset for help on using the changeset viewer.