Workers at US retailers Giant Food and Safeway have secured improved four-year contracts.