Trimed from https://chromium.googlesource.com/chromium/src/base