I must admit I’ve never heard the term “a barrel of gasoline” before.
In oilman terms, a barrel is 42 gallons.
(as opposed to the classic 55 gallon drum used for chemicals)
In most of the US petroleum industry, all the refined products are measured in barrels. It is only pricing that typical goes to the gallon for gasoline.
http://www.eia.gov/dnav/pet/pet_move_wkly_dc_NUS-Z00_mbblpd_w.htm
http://www.eia.gov/dnav/pet/pet_pnp_wprodrb_dcu_nus_w.htm
http://www.eia.gov/dnav/pet/pet_stoc_wstk_dcu_nus_w.htm
In this case, the barrel is just a unit of volume. A barrel of crude may contain more than one barrel of refined gasoline because it is more dense.