Commit f9ec939b authored by Chris Davis's avatar Chris Davis Committed by Commit Bot

Fix comment and dead code for handling error in prefs serialization

A previous change added error handling for when prefs serialization
fails.  The check call will result in a crash so I am updating the
comment above it to reflect that and remove the unreachable code
below it.

Change-Id: If16aff75e100c3a92e27344203ccad6d292caf5d
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1856878
Commit-Queue: Chris Davis <chrdavis@microsoft.com>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#705242}
parent 8549a00e
...@@ -482,12 +482,11 @@ bool JsonPrefStore::SerializeData(std::string* output) { ...@@ -482,12 +482,11 @@ bool JsonPrefStore::SerializeData(std::string* output) {
const bool success = serializer.Serialize(*prefs_); const bool success = serializer.Serialize(*prefs_);
if (!success) { if (!success) {
// Failed to serialize prefs file. Backup the existing prefs file and // Failed to serialize prefs file. Backup the existing prefs file and
// reset our existing prefs. // crash.
BackupPrefsFile(path_); BackupPrefsFile(path_);
CHECK(false) << "Failed to serialize preferences : " << path_ CHECK(false) << "Failed to serialize preferences : " << path_
<< "\nBacked up under " << "\nBacked up under "
<< path_.ReplaceExtension(kBadExtension); << path_.ReplaceExtension(kBadExtension);
prefs_.reset(new base::DictionaryValue());
} }
return success; return success;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment