ResponseCspSubscriber probably has more code to deal with parsing libraries for required domains than actually altering the response. This code should be separated out to it's own service.
It may also be beneficial to break out the library parsing into a couple layers
a) A mapping of individual library's policy directive requirements
b) Per-theme aggregate for each policy directive
Comments
Comment #3
gappleCaching for each individual library creates a lot of cache items. Will open a followup to use a CacheCollector so that all libraries under each extension only receive one cache item.