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

Unified Diff: components/browser_watcher/watcher_metrics_provider_win.cc

Issue 811483006: Don't report exit funnels for live processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years 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
Index: components/browser_watcher/watcher_metrics_provider_win.cc
diff --git a/components/browser_watcher/watcher_metrics_provider_win.cc b/components/browser_watcher/watcher_metrics_provider_win.cc
index 9ef6e6c53d2d81ca981f12e6a414dc2d1633566a..53fb44f22c1efaac3cdb3c93087b9348087be71c 100644
--- a/components/browser_watcher/watcher_metrics_provider_win.cc
+++ b/components/browser_watcher/watcher_metrics_provider_win.cc
@@ -32,15 +32,15 @@ void CompileAsserts() {
// with the given PID is not the same process the data was recorded for.
// This doesn't matter for the purpose, as eventually the data will be
// scavenged and reported.
-bool IsDeadProcess(base::StringPiece16 key_name) {
+bool IsDeadProcess(base::StringPiece16 key_or_value_name) {
// Truncate the input string to the first occurrence of '-', if one exists.
- size_t num_end = key_name.find(L'-');
+ size_t num_end = key_or_value_name.find(L'-');
if (num_end != base::StringPiece16::npos)
- key_name = key_name.substr(0, num_end);
+ key_or_value_name = key_or_value_name.substr(0, num_end);
// Convert to the numeric PID.
int pid = 0;
- if (!base::StringToInt(key_name, &pid) || pid == 0)
+ if (!base::StringToInt(key_or_value_name, &pid) || pid == 0)
return true;
// This is a very inexpensive check for the common case of our own PID.
@@ -194,8 +194,11 @@ void RecordExitFunnels(const base::string16& registry_path) {
std::vector<base::string16> to_delete;
for (; it.Valid(); ++it) {
- RecordSingleExitFunnel(&key, it.Name());
- to_delete.push_back(it.Name());
+ // Defer reporting on still-live processes.
+ if (IsDeadProcess(it.Name())) {
+ RecordSingleExitFunnel(&key, it.Name());
+ to_delete.push_back(it.Name());
+ }
}
for (size_t i = 0; i < to_delete.size(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698