The synthesis of the cosmic X-ray background in the Chandra and XMM-Newton era