2. Precise-width integer types in //Blink
Why should we use the precise-width integer type?
- The c++ standards don’t specify the specific size of each
integer type.
- The sizes of integral types in C++ can vary based on
compiler and architecture.
https://crbug.com/929940
3. Precise-width integer types in //Blink
What was changed in //Blink?
short int16_t, uint16_t, int32_t, float
unsigned short uint16_t, int32_t, uint8_t
long int32_t, uint32_t, int64_t, uint64_t
unsigned long uint32_t, int64_t, uint64_t, size_t, wtf_size_t
long long int64_t, uint64_t, uint32_t
unsigned long long uint64_t
4. WTF containers in //Blink
Why should we use WTF containers?
- “WTF's mission is to power and support all other Blink
code base by providing fast, reliable, user-friendly and
secure generic primitives.”
- Oilpan
https://crbug.com/952716
5. WTF containers in //Blink
std::map WTF::HashMap, WTF::HeapHashMap, WTF::HashCountedSet
std::vector WTF::Vector, WTF::HeapVector, Blink::WebVector
std::set WTF::HashSet
std::deque WTF::Deque
std::unordered_set WTF::HashSet
std::unordered_map WTF::HashMap
std::multimap -
What was changed in //Blink?
6. Policies in //Blink
PRESUBMIT Check
- Make sure not to introduce additional imprecise-width
integer types and std containers.
7. Policies in //Blink
Exception
- For the boundary layer needing to use them between Blink
and Chromium.
- Use --bypass-hook
- Add the exception rule
- For imprecise-width integer types in cpp.py
- For std containers in audit_non_blink_usage.py.