Chrome Now notificationGroups Storage Race Condition Fix

Updating cards involves updating the notificationGroups in rapid succession,
leading to race conditions between storage.get and storage.set. The queued
up storage.gets may dispatch all at once before each storage.set, meaning that
the storage.set will set stale values.

In other words, we get
storage.get
storage.get
storage.set
storage.set

instead of
storage.get
storage.set
storage.get
storage.set

The fix here is to move the requests outside of the for loop, adding
arguments to functions where necessary to work around this gotcha.

BUG=164227

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240798 0039d316-1c4b-4281-b951-d872f2087c98
2 files changed