diff options
author | csharp <csharp@chromium.org> | 2014-08-25 07:37:52 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-08-25 14:38:46 +0000 |
commit | 619b85aaed93f95207dc9c06fa85fe14cb91c101 (patch) | |
tree | 29eb447cea86e49209fbb71c6070299d02f8653a /chrome_elf | |
parent | f1e33461737736db4ccd9a79ff768cd54b4418a1 (diff) | |
download | chromium_src-619b85aaed93f95207dc9c06fa85fe14cb91c101.zip chromium_src-619b85aaed93f95207dc9c06fa85fe14cb91c101.tar.gz chromium_src-619b85aaed93f95207dc9c06fa85fe14cb91c101.tar.bz2 |
Reorder GenerateStateFromBeaconAndAttemptCount.
I think the older order could result in incorrect behavior if Chrome
crashed during startup. This might help with the bug as well.
BUG=406475
Review URL: https://codereview.chromium.org/500563002
Cr-Commit-Position: refs/heads/master@{#291679}
Diffstat (limited to 'chrome_elf')
-rw-r--r-- | chrome_elf/blacklist/blacklist.cc | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc index 824a9e9..ac7204f 100644 --- a/chrome_elf/blacklist/blacklist.cc +++ b/chrome_elf/blacklist/blacklist.cc @@ -87,7 +87,13 @@ DWORD SetDWValue(HKEY* key, const wchar_t* property, DWORD value) { bool GenerateStateFromBeaconAndAttemptCount(HKEY* key, DWORD blacklist_state) { LONG result = 0; - if (blacklist_state == blacklist::BLACKLIST_SETUP_RUNNING) { + if (blacklist_state == blacklist::BLACKLIST_ENABLED) { + // If the blacklist succeeded on the previous run reset the failure + // counter. + return (SetDWValue(key, + blacklist::kBeaconAttemptCount, + static_cast<DWORD>(0)) == ERROR_SUCCESS); + } else { // Some part of the blacklist setup failed last time. If this has occured // blacklist::kBeaconMaxAttempts times in a row we switch the state to // failed and skip setting up the blacklist. @@ -111,18 +117,10 @@ bool GenerateStateFromBeaconAndAttemptCount(HKEY* key, DWORD blacklist_state) { if (attempt_count >= blacklist::kBeaconMaxAttempts) { blacklist_state = blacklist::BLACKLIST_SETUP_FAILED; SetDWValue(key, blacklist::kBeaconState, blacklist_state); - return false; - } - } else if (blacklist_state == blacklist::BLACKLIST_ENABLED) { - // If the blacklist succeeded on the previous run reset the failure - // counter. - result = - SetDWValue(key, blacklist::kBeaconAttemptCount, static_cast<DWORD>(0)); - if (result != ERROR_SUCCESS) { - return false; } + + return false; } - return true; } } // namespace |