Skip to content

Commit 9b7a4fb

Browse files
Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
https://bugs.webkit.org/show_bug.cgi?id=180318 Reviewed by JF Bastien. Source/WTF: * WTF.xcodeproj/project.pbxproj: Added Hasher.h. * wtf/CMakeLists.txt: Ditto. * wtf/Forward.h: Added Hasher and TextStream. * wtf/Hasher.h: Moved StringHasher into a separate header. Added Hasher. Marked IntegerHasher deprecated. * wtf/text/CString.cpp: Include StringHasher.h instead of Hasher.h. * wtf/text/StringHash.h: Ditto. * wtf/text/StringHasher.h: Added. Moved StringHasher here from Hasher.h. * wtf/text/StringImpl.h: Include StringHasher.h instead of Hasher.h. * wtf/text/WTFString.h: Added a hash function. This was useful in some adoption I was doing in WebCore, not included in this patch. * wtf/unicode/UTF8.cpp: Include StringHasher.h instead of Hasher.h. Tools: * TestWebKitAPI/CMakeLists.txt: Added Hasher.cpp. * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Ditto. * TestWebKitAPI/Tests/WTF/Hasher.cpp: Added. Contains tests of the new WTF::Hasher class. * TestWebKitAPI/Tests/WTF/StringHasher.cpp: Include StringHasher.h instead of Hasher.h. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@225463 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 538d16a commit 9b7a4fb

File tree

16 files changed

+799
-351
lines changed

16 files changed

+799
-351
lines changed

Source/WTF/ChangeLog

+27
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
1+
2017-12-03 Darin Adler <[email protected]>
2+
3+
Add WTF::Hasher, an easier to use replacement for WTF::IntegerHasher
4+
https://bugs.webkit.org/show_bug.cgi?id=180318
5+
6+
Reviewed by JF Bastien.
7+
8+
* WTF.xcodeproj/project.pbxproj: Added Hasher.h.
9+
* wtf/CMakeLists.txt: Ditto.
10+
11+
* wtf/Forward.h: Added Hasher and TextStream.
12+
13+
* wtf/Hasher.h: Moved StringHasher into a separate header. Added Hasher.
14+
Marked IntegerHasher deprecated.
15+
16+
* wtf/text/CString.cpp: Include StringHasher.h instead of Hasher.h.
17+
* wtf/text/StringHash.h: Ditto.
18+
19+
* wtf/text/StringHasher.h: Added. Moved StringHasher here from Hasher.h.
20+
21+
* wtf/text/StringImpl.h: Include StringHasher.h instead of Hasher.h.
22+
23+
* wtf/text/WTFString.h: Added a hash function. This was useful in some
24+
adoption I was doing in WebCore, not included in this patch.
25+
26+
* wtf/unicode/UTF8.cpp: Include StringHasher.h instead of Hasher.h.
27+
128
2017-12-02 Brady Eidson <[email protected]>
229

330
Factor out the "databaseTaskQueue" parts of IDBServer into something reusable.

Source/WTF/WTF.xcodeproj/project.pbxproj

+2
Original file line numberDiff line numberDiff line change
@@ -378,6 +378,7 @@
378378
83F2BADE1CF9524E003E99C3 /* Function.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Function.h; sourceTree = "<group>"; };
379379
83FBA93119DF459700F30ADB /* TypeCasts.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TypeCasts.h; sourceTree = "<group>"; };
380380
86F46F5F1A2840EE00CCBF22 /* RefCounter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RefCounter.h; sourceTree = "<group>"; };
381+
933D63191FCB6AB90032ECD6 /* StringHasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringHasher.h; sourceTree = "<group>"; };
381382
93934BD218A1E8C300D0D6A1 /* StringViewObjC.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = StringViewObjC.mm; path = mac/StringViewObjC.mm; sourceTree = "<group>"; };
382383
93934BD418A1F16900D0D6A1 /* StringViewCF.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringViewCF.cpp; path = cf/StringViewCF.cpp; sourceTree = "<group>"; };
383384
93AC91A718942FC400244939 /* LChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LChar.h; sourceTree = "<group>"; };
@@ -1141,6 +1142,7 @@
11411142
A8A47326151A825B004123FF /* StringConcatenate.h */,
11421143
7CD4C26F1E2C82B900929470 /* StringConcatenateNumbers.h */,
11431144
A8A47327151A825B004123FF /* StringHash.h */,
1145+
933D63191FCB6AB90032ECD6 /* StringHasher.h */,
11441146
A8A47328151A825B004123FF /* StringImpl.cpp */,
11451147
A8A47329151A825B004123FF /* StringImpl.h */,
11461148
0F0F52691F421FF8004A452C /* StringMalloc.cpp */,

Source/WTF/wtf/CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,7 @@ set(WTF_HEADERS
186186
text/StringBuffer.h
187187
text/StringCommon.h
188188
text/StringHash.h
189+
text/StringHasher.h
189190
text/StringImpl.h
190191
text/StringMalloc.h
191192
text/StringVector.h

Source/WTF/wtf/Forward.h

+6-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (C) 2006, 2009, 2011 Apple Inc. All rights reserved.
2+
* Copyright (C) 2006-2017 Apple Inc. All rights reserved.
33
*
44
* This library is free software; you can redistribute it and/or
55
* modify it under the terms of the GNU Library General Public
@@ -34,6 +34,7 @@ class BinarySemaphore;
3434
class CString;
3535
class CrashOnOverflow;
3636
class FunctionDispatcher;
37+
class Hasher;
3738
class OrdinalNumber;
3839
class PrintStream;
3940
class SHA1;
@@ -42,6 +43,7 @@ class StringBuilder;
4243
class StringImpl;
4344
class StringView;
4445
class TextPosition;
46+
class TextStream;
4547

4648
struct FastMalloc;
4749

@@ -69,14 +71,15 @@ template<typename ValueArg, typename = typename DefaultHash<ValueArg>::Hash, typ
6971
using WTF::AtomicString;
7072
using WTF::AtomicStringImpl;
7173
using WTF::BinarySemaphore;
72-
using WTF::CompletionHandler;
7374
using WTF::CString;
75+
using WTF::CompletionHandler;
7476
using WTF::Expected;
7577
using WTF::Function;
7678
using WTF::FunctionDispatcher;
7779
using WTF::HashCountedSet;
7880
using WTF::HashMap;
7981
using WTF::HashSet;
82+
using WTF::Hasher;
8083
using WTF::LazyNeverDestroyed;
8184
using WTF::NeverDestroyed;
8285
using WTF::OptionSet;
@@ -91,5 +94,6 @@ using WTF::StringBuilder;
9194
using WTF::StringImpl;
9295
using WTF::StringView;
9396
using WTF::TextPosition;
97+
using WTF::TextStream;
9498
using WTF::Variant;
9599
using WTF::Vector;

0 commit comments

Comments
 (0)