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

Side by Side Diff: chrome/browser/chrome_elf_init_win.cc

Issue 343613003: Report when blacklist.cc fails to setup the blacklisting thunk. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Update comment in blacklist.cc Created 6 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome_elf/blacklist/blacklist.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/bind.h" 5 #include "base/bind.h"
6 #include "base/metrics/field_trial.h" 6 #include "base/metrics/field_trial.h"
7 #include "base/metrics/histogram.h" 7 #include "base/metrics/histogram.h"
8 #include "base/metrics/sparse_histogram.h" 8 #include "base/metrics/sparse_histogram.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/win/registry.h" 10 #include "base/win/registry.h"
(...skipping 22 matching lines...) Expand all
33 enum BlacklistSetupEventType { 33 enum BlacklistSetupEventType {
34 // The blacklist beacon has placed to enable the browser blacklisting. 34 // The blacklist beacon has placed to enable the browser blacklisting.
35 BLACKLIST_SETUP_ENABLED = 0, 35 BLACKLIST_SETUP_ENABLED = 0,
36 36
37 // The blacklist was successfully enabled. 37 // The blacklist was successfully enabled.
38 BLACKLIST_SETUP_RAN_SUCCESSFULLY, 38 BLACKLIST_SETUP_RAN_SUCCESSFULLY,
39 39
40 // The blacklist setup code failed to execute. 40 // The blacklist setup code failed to execute.
41 BLACKLIST_SETUP_FAILED, 41 BLACKLIST_SETUP_FAILED,
42 42
43 // Deprecated. The blacklist thunk setup code failed to execute. 43 // The blacklist thunk setup code failed. This is probably an indication
44 // that something else patched that code first.
44 BLACKLIST_THUNK_SETUP_FAILED, 45 BLACKLIST_THUNK_SETUP_FAILED,
45 46
46 // Deprecated. The blacklist interception code failed to execute. 47 // Deprecated. The blacklist interception code failed to execute.
47 BLACKLIST_INTERCEPTION_FAILED, 48 BLACKLIST_INTERCEPTION_FAILED,
48 49
49 // The blacklist was disabled for this run (after it failed too many times). 50 // The blacklist was disabled for this run (after it failed too many times).
50 BLACKLIST_SETUP_DISABLED, 51 BLACKLIST_SETUP_DISABLED,
51 52
52 // Always keep this at the end. 53 // Always keep this at the end.
53 BLACKLIST_SETUP_EVENT_MAX, 54 BLACKLIST_SETUP_EVENT_MAX,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 137
137 // No point in trying to continue if the registry key isn't valid. 138 // No point in trying to continue if the registry key isn't valid.
138 if (!blacklist_registry_key.Valid()) 139 if (!blacklist_registry_key.Valid())
139 return; 140 return;
140 141
141 // Record the results of the last blacklist setup. 142 // Record the results of the last blacklist setup.
142 DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX; 143 DWORD blacklist_state = blacklist::BLACKLIST_STATE_MAX;
143 blacklist_registry_key.ReadValueDW(blacklist::kBeaconState, &blacklist_state); 144 blacklist_registry_key.ReadValueDW(blacklist::kBeaconState, &blacklist_state);
144 145
145 if (blacklist_state == blacklist::BLACKLIST_ENABLED) { 146 if (blacklist_state == blacklist::BLACKLIST_ENABLED) {
146 // The blacklist was enabled successfully so we record the event (along with 147 // The blacklist setup didn't crash, so we report if it was enabled or not.
147 // the number of failed previous attempts). 148 if (blacklist::IsBlacklistInitialized()) {
148 RecordBlacklistSetupEvent(BLACKLIST_SETUP_RAN_SUCCESSFULLY); 149 RecordBlacklistSetupEvent(BLACKLIST_SETUP_RAN_SUCCESSFULLY);
150 } else {
151 // The only way for the blacklist to be enabled, but not fully
152 // initialized is if the thunk setup failed. See blacklist.cc
153 // for more details.
154 RecordBlacklistSetupEvent(BLACKLIST_THUNK_SETUP_FAILED);
155 }
156
157 // Regardless of if the blacklist was fully enabled or not, report how many
158 // times we had to try to set it up.
149 DWORD attempt_count = 0; 159 DWORD attempt_count = 0;
150 blacklist_registry_key.ReadValueDW(blacklist::kBeaconAttemptCount, 160 blacklist_registry_key.ReadValueDW(blacklist::kBeaconAttemptCount,
151 &attempt_count); 161 &attempt_count);
152 UMA_HISTOGRAM_COUNTS_100("Blacklist.RetryAttempts.Success", attempt_count); 162 UMA_HISTOGRAM_COUNTS_100("Blacklist.RetryAttempts.Success", attempt_count);
153 } else if (blacklist_state == blacklist::BLACKLIST_SETUP_FAILED) { 163 } else if (blacklist_state == blacklist::BLACKLIST_SETUP_FAILED) {
154 // We can set the state to disabled without checking that the maximum number 164 // We can set the state to disabled without checking that the maximum number
155 // of attempts was exceeded because blacklist.cc has already done this. 165 // of attempts was exceeded because blacklist.cc has already done this.
156 RecordBlacklistSetupEvent(BLACKLIST_SETUP_FAILED); 166 RecordBlacklistSetupEvent(BLACKLIST_SETUP_FAILED);
157 blacklist_registry_key.WriteValue(blacklist::kBeaconState, 167 blacklist_registry_key.WriteValue(blacklist::kBeaconState,
158 blacklist::BLACKLIST_DISABLED); 168 blacklist::BLACKLIST_DISABLED);
(...skipping 19 matching lines...) Expand all
178 188
179 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount, 189 blacklist_registry_key.WriteValue(blacklist::kBeaconAttemptCount,
180 static_cast<DWORD>(0)); 190 static_cast<DWORD>(0));
181 191
182 // Only report the blacklist as getting setup when both registry writes 192 // Only report the blacklist as getting setup when both registry writes
183 // succeed, since otherwise the blacklist wasn't properly setup. 193 // succeed, since otherwise the blacklist wasn't properly setup.
184 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS) 194 if (set_version == ERROR_SUCCESS && set_state == ERROR_SUCCESS)
185 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED); 195 RecordBlacklistSetupEvent(BLACKLIST_SETUP_ENABLED);
186 } 196 }
187 } 197 }
OLDNEW
« no previous file with comments | « no previous file | chrome_elf/blacklist/blacklist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698