He stopped there to enjoy the effect of these words. He could almost see the cogs working under Uncle Vernon's thick, dark, neatly parted hair. If he tried to stop Harry writing to Sirius, Sirius would think Harry was being mistreated. If he told Harry he couldn't go to the Quidditch World Cup, Harry would write and tell Sirius, who would know Harry was being mistreated. There was only one thing for Uncle Vernon to do. ...
Cog, as defined in dictionaries, means One of a series of teeth, as on the rim of a wheel or gear, whose engagement transmits successive motive force to a corresponding wheel or gear.
But I reckon it's used figuratively in this context. How should we understand it in this context? Are 'cogs' referring to Uncle Vernon's eyes or something else?