[CacheStorage] Simpler way to wrap callbacks to run pending operation completions

CacheStorage (and BackgroundSync) wrap callbacks in order to ensure that the scheduler
is bumped after running the callback. This resulted in lots of helper functions. This
CL cleans up the helper functions with the help of template magic.

BUG=629592

Review-Url: https://codereview.chromium.org/2167483002
Cr-Commit-Position: refs/heads/master@{#406668}
8 files changed