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/files/important_file_writer.h" | 9 #include "base/files/important_file_writer.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
473 void PersistentHistogramAllocator::FinalizeHistogram(Reference ref, | 473 void PersistentHistogramAllocator::FinalizeHistogram(Reference ref, |
474 bool registered) { | 474 bool registered) { |
475 // If the created persistent histogram was registered then it needs to | 475 // If the created persistent histogram was registered then it needs to |
476 // be marked as "iterable" in order to be found by other processes. | 476 // be marked as "iterable" in order to be found by other processes. |
477 if (registered) | 477 if (registered) |
478 memory_allocator_->MakeIterable(ref); | 478 memory_allocator_->MakeIterable(ref); |
479 // If it wasn't registered then a race condition must have caused | 479 // If it wasn't registered then a race condition must have caused |
480 // two to be created. The allocator does not support releasing the | 480 // two to be created. The allocator does not support releasing the |
481 // acquired memory so just change the type to be empty. | 481 // acquired memory so just change the type to be empty. |
482 else | 482 else |
483 memory_allocator_->SetType(ref, 0); | 483 memory_allocator_->ChangeType(ref, 0, kTypeIdHistogram); |
484 } | 484 } |
485 | 485 |
486 PersistentSampleMapRecords* PersistentHistogramAllocator::UseSampleMapRecords( | 486 PersistentSampleMapRecords* PersistentHistogramAllocator::UseSampleMapRecords( |
487 uint64_t id, | 487 uint64_t id, |
488 const void* user) { | 488 const void* user) { |
489 return sparse_histogram_data_manager_.UseSampleMapRecords(id, user); | 489 return sparse_histogram_data_manager_.UseSampleMapRecords(id, user); |
490 } | 490 } |
491 | 491 |
492 std::unique_ptr<HistogramBase> PersistentHistogramAllocator::AllocateHistogram( | 492 std::unique_ptr<HistogramBase> PersistentHistogramAllocator::AllocateHistogram( |
493 HistogramType histogram_type, | 493 HistogramType histogram_type, |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 while (true) { | 758 while (true) { |
759 std::unique_ptr<HistogramBase> histogram = | 759 std::unique_ptr<HistogramBase> histogram = |
760 import_iterator_.GetNextWithIgnore(record_to_ignore); | 760 import_iterator_.GetNextWithIgnore(record_to_ignore); |
761 if (!histogram) | 761 if (!histogram) |
762 break; | 762 break; |
763 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); | 763 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); |
764 } | 764 } |
765 } | 765 } |
766 | 766 |
767 } // namespace base | 767 } // namespace base |
OLD | NEW |