Bug 1388748 - Don't resize histogram ranges on init r=gfritzsche

We were using std::vector::assign, which resizes the vector to
match the incoming data. This isn't what we want, as ranges_ has
already been sized to bucket_count_ + 1. Instead, just use a
copy.

MozReview-Commit-ID: EGuW5jj7Rpq

--HG--
extra : rebase_source : 616d61fc27c7e43c22ea69e11e070ba958bf20a9
This commit is contained in:
Doug Thayer 2017-08-09 10:21:09 -07:00
Родитель 3c7cc8f012
Коммит a70aac6a11
1 изменённых файлов: 2 добавлений и 1 удалений

Просмотреть файл

@ -273,7 +273,8 @@ Histogram::~Histogram() {
}
void Histogram::InitializeBucketRangeFromData(const int* buckets) {
ranges_.assign(buckets, buckets + bucket_count());
DCHECK_EQ(bucket_count_ + 1, ranges_.size());
std::copy_n(buckets, bucket_count_, ranges_.data());
ResetRangeChecksum();
DCHECK(ValidateBucketRanges());
}