  We investigate the properties of the galaxies that reionized the Universe and
the history of cosmic reionization using the "Evolution and Assembly of
GaLaxies and their environments" (EAGLE) cosmological hydrodynamical
simulations. We obtain the evolution of the escape fraction of ionizing photons
in galaxies assuming that galactic winds create channels through which
20~percent of photons escape when the local surface density of star formation
is greater than $0.1$ M$_\odot$ yr$^{-1}$ kpc$^{-2}$. Such threshold behaviour
for the generation of winds is observed, and the rare local objects which have
such high star formation surface densities exhibit high escape fractions of
$\sim 10$ percent. In our model the luminosity-weighted mean escape fraction
increases with redshift as $\bar f_{\rm esc}=0.045~((1+z)/4)^{1.1}$ at $z>3$,
and the galaxy number weighted mean as $\langle f_{\rm esc}
\rangle=2.2\times10^{-3}~((1+z)/4)^4$, and becomes constant $\approx0.2$ at
redshift $z>10$. The escape fraction evolves as an increasingly large fraction
of stars forms above the critical surface density of star formation at earlier
times. This evolution of the escape fraction, combined with that of the star
formation rate density from EAGLE, reproduces the inferred evolution of the
filling factor of ionized regions during the reionization epoch ($6<z<8$), the
evolution of the post-reionization ($0\leq z<6$) hydrogen photoionisation rate,
and the optical depth due to Thomson scattering of the cosmic microwave
background photons measured by the Planck satellite.
