IDL compiler: Filter files during pre-caching of templates

code_generator_v8.py dies on build bots because it tries to cache '.svn',
and is fragile to other files being added (e.g., subdirectories).
This fixes it by filtering to only cache .cpp and .h files.

BUG=239771
TBR=haraken
NOTRY=true

Review URL: https://codereview.chromium.org/182573002

git-svn-id: svn://svn.chromium.org/blink/trunk@167955 bbb929c8-8fbe-4397-9dbb-9b2b20218538