Fix destruction order of PromoResourceService and NTPResourceCache
commit0a8d9a6cb29caf11ee23d8d3bc0a72bb6d0ab998
authordroger <droger@chromium.org>
Fri, 6 Mar 2015 20:39:20 +0000 (6 12:39 -0800)
committerCommit bot <commit-bot@chromium.org>
Fri, 6 Mar 2015 20:40:09 +0000 (6 20:40 +0000)
tree70ee7523176f46c60fe691bcf1ffab80c88fe1eb
parentdce2e0b5d89ebcc00482fe95494c9c2163d2f463
Fix destruction order of PromoResourceService and NTPResourceCache

The existing code was leading to a crash:
- NTPResourceCache has a callback subscription on PromoResourceService
- PromoResourceService was deleted before NTPResourceCache
- When the NTPResourceCache was destroyed, it tried to remove itself
  from the callback list, which no longer exists and crashes.

The bug was introduced by
https://codereview.chromium.org/926633002

This CL changes the destruction order so that the PromoResourceService
is deleted after NTPResourceCache (which is a keyed service and thus is
tied to the profile).

BUG=464391

Review URL: https://codereview.chromium.org/988433002

Cr-Commit-Position: refs/heads/master@{#319491}
chrome/browser/browser_process_impl.cc
chrome/browser/browser_process_impl_unittest.cc [new file with mode: 0644]
chrome/chrome_tests_unit.gypi
components/update_client/update_query_params.cc