Remove references to and implementation of GetHistogramName().
The method prototype is being changed to returning a const char*, we don't rely on it in webrtc and the point of the DCHECK that previously referenced it, was to avoid usage of std::string for histogram names. Bug: webrtc:8472 Change-Id: I69b588d4a8f339911a051fd232d63ea5bb1f9a45 Reviewed-on: https://webrtc-review.googlesource.com/16940 Commit-Queue: Tommi <tommi@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20484}
This commit is contained in:
@ -164,9 +164,6 @@
|
||||
prev_pointer == histogram_pointer); \
|
||||
} \
|
||||
if (histogram_pointer) { \
|
||||
RTC_DCHECK_EQ(constant_name, \
|
||||
webrtc::metrics::GetHistogramName(histogram_pointer)) \
|
||||
<< "The name should not vary."; \
|
||||
webrtc::metrics::HistogramAdd(histogram_pointer, sample); \
|
||||
} \
|
||||
} while (0)
|
||||
@ -262,9 +259,6 @@ Histogram* HistogramFactoryGetCountsLinear(const std::string& name,
|
||||
Histogram* HistogramFactoryGetEnumeration(
|
||||
const std::string& name, int boundary);
|
||||
|
||||
// Returns name of the histogram.
|
||||
const std::string& GetHistogramName(Histogram* histogram_pointer);
|
||||
|
||||
// Function for adding a |sample| to a histogram.
|
||||
void HistogramAdd(Histogram* histogram_pointer, int sample);
|
||||
|
||||
|
@ -247,11 +247,6 @@ Histogram* HistogramFactoryGetEnumeration(const std::string& name,
|
||||
return map->GetEnumerationHistogram(name, boundary);
|
||||
}
|
||||
|
||||
const std::string& GetHistogramName(Histogram* histogram_pointer) {
|
||||
RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer);
|
||||
return ptr->name();
|
||||
}
|
||||
|
||||
// Fast path. Adds |sample| to cached |histogram_pointer|.
|
||||
void HistogramAdd(Histogram* histogram_pointer, int sample) {
|
||||
RtcHistogram* ptr = reinterpret_cast<RtcHistogram*>(histogram_pointer);
|
||||
|
@ -22,11 +22,6 @@ void AddSparseSample(const std::string& name, int sample) {
|
||||
void AddSampleWithVaryingName(int index, const std::string& name, int sample) {
|
||||
RTC_HISTOGRAMS_COUNTS_100(index, name, sample);
|
||||
}
|
||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
void AddSample(const std::string& name, int sample) {
|
||||
RTC_HISTOGRAM_COUNTS_100(name, sample);
|
||||
}
|
||||
#endif // RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
} // namespace
|
||||
|
||||
class MetricsTest : public ::testing::Test {
|
||||
@ -117,11 +112,4 @@ TEST_F(MetricsTest, RtcHistogramSparse_NonConstantNameWorks) {
|
||||
EXPECT_EQ(1, metrics::NumSamples("Sparse2"));
|
||||
}
|
||||
|
||||
#if RTC_DCHECK_IS_ON && GTEST_HAS_DEATH_TEST && !defined(WEBRTC_ANDROID)
|
||||
TEST_F(MetricsTest, RtcHistogram_FailsForNonConstantName) {
|
||||
AddSample("ConstantName1", kSample);
|
||||
EXPECT_DEATH(AddSample("NotConstantName1", kSample), "");
|
||||
}
|
||||
#endif
|
||||
|
||||
} // namespace webrtc
|
||||
|
Reference in New Issue
Block a user