(M56) service worker: Attempt to send WorkerStopped before ProviderDestroyed.

Previously in IPC when a worker stops, the renderer sends the browser a
WorkerStopped message followed by a ProviderDestroyed message. This
ordering got reversed in https://crrev.com/6ea839368fd4dbf, causing an
unexpected case where a ServiceWorkerProviderHost is destroyed,
releasing a ServiceWorkerVersion before OnStopped can be invoked on it.
This patch returns to the previous ordering.

However even with this patch, for Mojo the ordering is still not
guaranteed, since the pipes are different. Since the IPC land is no
longer the default, the real fix is to figure out how to do this in
Mojo. This patch is just a mitigation, so no tests are added yet.

BUG=629701,676526

Review-Url: https://codereview.chromium.org/2596153002
Cr-Commit-Position: refs/heads/master@{#440356}
(cherry picked from commit af96c9a9e8d491929f32f2e693fd61fd1b93557d)

Review-Url: https://codereview.chromium.org/2605593002 .
Cr-Commit-Position: refs/branch-heads/2924@{#618}
Cr-Branched-From: 3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a-refs/heads/master@{#433059}
2 files changed