Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6115)

Unified Diff: chrome_elf/blacklist/blacklist.cc

Issue 500563002: Reorder GenerateStateFromBeaconAndAttemptCount. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_elf/blacklist/blacklist.cc
diff --git a/chrome_elf/blacklist/blacklist.cc b/chrome_elf/blacklist/blacklist.cc
index 824a9e95a87d54df9fcf2fe4bfb0a1e7840844a5..ac7204f34508c7116f337b91587041c64008a998 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) {
robertshield 2014/08/25 13:40:18 previously, BLACKLIST_STATE_FAILED would hit this
+ 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698