The common medical understanding is that cardiac arrest victims become unconscious within 20 seconds of the loss of blood flow (heart stops). That's not quite the same thing as losing "all brain activity." It just means the brain is incapable of keeping you awake.
All brain activity is thought to be over by about 3-4 minutes from the moment the heart stops, which is one reason why we want to start CPR as quickly as possible. It's also why hands-only CPR is good for victims of sudden cardiac arrest. It's easy: push on the chest fast and hard while someone else calls 911.
If you're by yourself, call 911 first then start pumping. Make it quick, though. Not only does the brain stop working as it runs out of oxygen and sugar (brought to the brain by blood flow supplied by the heart), blood gets trapped in the brain until it starts flowing again. That stale blood is accumulating acids, free radical oxygen molecules and other toxins while it sits there.
As soon as you start pumping on the chest and pushing the stale blood around, you're going to bathe the brain in those toxins. The less time those toxins have to build up, the better. It's almost as important to flush those toxins out as it is to bring fresh nutrients and oxygen in.
No matter how you look at it, the quicker you start CPR, the better.
Source:
Safar P, Behringer W. "Brain resuscitation after cardiac arrest." Textbook of Neurointensive Care. Edited by Layon AJ, Gabrielli A, Friedman WA. Philadelphia. WB Saunders. 2003:457–498