Ensure at most one AppCacheBackend per RenderProcessHost.

AppCacheService maintains a map from RenderProcessHost id to the
corresponding AppCacheBackend. The id can be reused if the renderer
process is shutdown and a new renderer process is created using
the same RenderProcessHost. This may lead to a race where the old
backend is not yet unregistered and a new backend is trying to
register for the same process id.

This patch fixed the race by eagerly unregistering the previous
backend before the new backend is registered.

Bug: 850921

Change-Id: Ie3c7576e17697ad87968b84a1e438a6f3c55a13e
Reviewed-on: https://chromium-review.googlesource.com/1135545
Reviewed-by: Joshua Bell <jsbell@chromium.org>
Commit-Queue: Ulan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#575238}
5 files changed