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

Unified Diff: chrome/renderer/pepper/pepper_uma_host.cc

Issue 141393002: Return a NULL histogram pointer on construction error (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, git cl format Created 6 years, 9 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
Index: chrome/renderer/pepper/pepper_uma_host.cc
diff --git a/chrome/renderer/pepper/pepper_uma_host.cc b/chrome/renderer/pepper/pepper_uma_host.cc
index ca9edc4bae5ce28ac1a7e88605ee270bfb56d102..7ecdcf9f3bac90204d0f52628ac945e1e5ff554c 100644
--- a/chrome/renderer/pepper/pepper_uma_host.cc
+++ b/chrome/renderer/pepper/pepper_uma_host.cc
@@ -112,7 +112,10 @@ int32_t PepperUMAHost::OnHistogramCustomTimes(
base::TimeDelta::FromMilliseconds(max),
bucket_count,
base::HistogramBase::kUmaTargetedHistogramFlag);
- counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
+ // The histogram can be NULL if it is constructed with bad arguments. Ignore
+ // that data for this API. An error message will be logged.
+ if (counter)
+ counter->AddTime(base::TimeDelta::FromMilliseconds(sample));
return PP_OK;
}
@@ -135,7 +138,10 @@ int32_t PepperUMAHost::OnHistogramCustomCounts(
max,
bucket_count,
base::HistogramBase::kUmaTargetedHistogramFlag);
- counter->Add(sample);
+ // The histogram can be NULL if it is constructed with bad arguments. Ignore
+ // that data for this API. An error message will be logged.
+ if (counter)
+ counter->Add(sample);
return PP_OK;
}
@@ -156,7 +162,10 @@ int32_t PepperUMAHost::OnHistogramEnumeration(
boundary_value,
boundary_value + 1,
base::HistogramBase::kUmaTargetedHistogramFlag);
- counter->Add(sample);
+ // The histogram can be NULL if it is constructed with bad arguments. Ignore
+ // that data for this API. An error message will be logged.
+ if (counter)
+ counter->Add(sample);
return PP_OK;
}

Powered by Google App Engine
This is Rietveld 408576698