Only compute pref hashes when about to serialize preferences to disk.

This is expected to help a perf regression reported in http://crbug.com/331273.

Previously, a new hash would be computed and updated in memory every time a pref's value changes. Computing the hash is expensive as it requires serializing the pref's value to a string. This is particularly bad for the extensions dictionary which is big and can update often in a short time span. The hash is only really needed when writing the file to disk, this change makes sure to only compute the hash at that point.

The hashes are still stored in local_state though, so for now this means we're going from a world in which a crash after updating pref1 in memory could result in either:
1) New pref1 in Preferences, new hash for pref1 in local_state
2) New pref1 in Preferences, old hash for pref1 in local_state
3) Old pref1 in Preferences, new hash for pref1 in local_state
4) Old pref1 in Preferences, old hash for pref1 in local_state

Depending on which file was flushed to disk.

We only want (1) and (4) to be possible; with this CL we remove (3).

We still always get (1) on clean shutdowns as local_state is always last flushed after all profiles have been flushed/shutdown.

We will later need to move the hashes to the same file as the prefs' values to get rid of (2) as well.

BUG=331273

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@246052 0039d316-1c4b-4281-b951-d872f2087c98
SVN changes up to revision 246052