Static Initializers

Some background on the original decision to ban static initializers:

How Static Initializers are Checked

Removing Static Initializers

Common fixes include:

  • Add constexpr,
  • Use LazyInstance<>,
  • Move global variable to be a static variable within a function that returns it.

Listing Static Initializers

For Linux:

tools/linux/ out/Release/chrome

For Android:

build/android/ --chromium-output-directory out/Release --dump-static-initializers out/Release/apks/MonochromePublic.apk
tools/binary_size/ HEAD

For more information about, refer to its