OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/metrics/persistent_histogram_allocator.h" | 5 #include "base/metrics/persistent_histogram_allocator.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
603 RecordCreateHistogramResult(CREATE_HISTOGRAM_INVALID_RANGES_ARRAY); | 603 RecordCreateHistogramResult(CREATE_HISTOGRAM_INVALID_RANGES_ARRAY); |
604 NOTREACHED(); | 604 NOTREACHED(); |
605 return nullptr; | 605 return nullptr; |
606 } | 606 } |
607 const BucketRanges* ranges = | 607 const BucketRanges* ranges = |
608 StatisticsRecorder::RegisterOrDeleteDuplicateRanges( | 608 StatisticsRecorder::RegisterOrDeleteDuplicateRanges( |
609 created_ranges.release()); | 609 created_ranges.release()); |
610 | 610 |
611 size_t counts_bytes = CalculateRequiredCountsBytes(histogram_bucket_count); | 611 size_t counts_bytes = CalculateRequiredCountsBytes(histogram_bucket_count); |
612 PersistentMemoryAllocator::Reference counts_ref = | 612 PersistentMemoryAllocator::Reference counts_ref = |
613 subtle::NoBarrier_Load(&histogram_data_ptr->counts_ref); | 613 subtle::Acquire_Load(&histogram_data_ptr->counts_ref); |
614 if (counts_bytes == 0 || | 614 if (counts_bytes == 0 || |
615 (counts_ref != 0 && | 615 (counts_ref != 0 && |
616 memory_allocator_->GetAllocSize(counts_ref) < counts_bytes)) { | 616 memory_allocator_->GetAllocSize(counts_ref) < counts_bytes)) { |
617 RecordCreateHistogramResult(CREATE_HISTOGRAM_INVALID_COUNTS_ARRAY); | 617 RecordCreateHistogramResult(CREATE_HISTOGRAM_INVALID_COUNTS_ARRAY); |
618 NOTREACHED(); | 618 NOTREACHED(); |
619 return nullptr; | 619 return nullptr; |
620 } | 620 } |
621 | 621 |
622 // The "counts" data (including both samples and logged samples) is a delayed | 622 // The "counts" data (including both samples and logged samples) is a delayed |
623 // persistent allocation meaning that though its size and storage for a | 623 // persistent allocation meaning that though its size and storage for a |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
964 while (true) { | 964 while (true) { |
965 std::unique_ptr<HistogramBase> histogram = | 965 std::unique_ptr<HistogramBase> histogram = |
966 import_iterator_.GetNextWithIgnore(record_to_ignore); | 966 import_iterator_.GetNextWithIgnore(record_to_ignore); |
967 if (!histogram) | 967 if (!histogram) |
968 break; | 968 break; |
969 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); | 969 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); |
970 } | 970 } |
971 } | 971 } |
972 | 972 |
973 } // namespace base | 973 } // namespace base |
OLD | NEW |