Introduce ResourceFinishObserver

I'm planning to make RawResource has single [Raw]ResourceClient, but actually
(possible multiple) link elements need to watch a Resource for the load finished
event. Fortunately, only the load finished event is needed, and it is dispatched
asynchronously. Hence this CL introduces a separate client interface,
ResourceFinishObserver, for the use-case. RawResource will have multiple
ResourceFinishObserver, but it's OK because when the load finished event is
dispatched, the client cannot mutate the loading related states.

Unlike ResourceClient, ResourceFinishObserver is not expected to have
sub-interfaces such as ImageResourceClient which complicate the situation.

This CL also makes LinkLoader use ResourceFinishObserver instead of
ResourceClient.

Bug: 652228
Change-Id: I50e1c6ecd5c2f45349974f949946c0f05a6a1131
Reviewed-on: https://chromium-review.googlesource.com/522185
Reviewed-by: Kinuko Yasuda <kinuko@chromium.org>
Reviewed-by: Kouhei Ueno <kouhei@chromium.org>
Reviewed-by: Hiroshige Hayashizaki <hiroshige@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#479233}
15 files changed