WTF is a base library for Blink providing a variety of basic functionalities, like containers, string libraries, reference counting mechanisms, functors, threading primitives etc.
WTF's mission is to power and support all other Blink code base by providing fast, reliable, user-friendly and secure generic primitives.
Dependency-wise, WTF cannot depend on any other Blink headers, including files under other platform/ subdirectories, since WTF is a library that can be referred from anywhere in Blink. WTF basically can only depend on base.
Main code base of Blink (core and modules) cannot directly depend on base. The main objective of this is to limit what Blink core can use, so that Blink core code wouldn't use libraries prohibited in Blink accidentally (such as
Our approach here is to make WTF and other platform/ components a gatekeeper of the use of base libraries. platform/ (including WTF) can directly depend on base, and if some of the base functionalities are worth having in Blink, WTF can expose them in a way Blink core code can easily use them. Usually, such a library would be a thin wrapper of the corresponding base functionality.
Also, we are trying to eliminate duplicated functionalities between WTF and base. Historically, WTF was developed as a stand-alone library, so there are still many overlaps. We want to eventually delegate shareable implementation to base as much as possible.
If you find a missing functionality in WTF, regardless of whether it is available in base or not, feel free to file a bug under the component Blink>Internals>WTF.
The below is a list of major libraries. For a complete list, look at the directory listing.
Allocator.h (memory placement macros)
Compile-time switch macros
The name WTF first appeared in 2006, as a replacement of its older name KXMLCore. At that point, there were already plenty of libraries we see today. For example, you can see the initial implementation of
Vector was landed in 2006, replacing several manual array allocations and deallocations(!).
If you dig the repository a bit more, you can find the original version of Assertions.h was committed back in 2002. This is probably the oldest library that we can find from the repository history.
Blink forked WebKit in 2013. In 2017, the directory finally moved to the current location Source/platform/wtf.