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 695 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 } | 706 } |
707 | 707 |
708 g_allocator = nullptr; | 708 g_allocator = nullptr; |
709 return WrapUnique(histogram_allocator); | 709 return WrapUnique(histogram_allocator); |
710 }; | 710 }; |
711 | 711 |
712 void GlobalHistogramAllocator::SetPersistentLocation(const FilePath& location) { | 712 void GlobalHistogramAllocator::SetPersistentLocation(const FilePath& location) { |
713 persistent_location_ = location; | 713 persistent_location_ = location; |
714 } | 714 } |
715 | 715 |
| 716 const FilePath& GlobalHistogramAllocator::GetPersistentLocation() const { |
| 717 return persistent_location_; |
| 718 } |
| 719 |
716 bool GlobalHistogramAllocator::WriteToPersistentLocation() { | 720 bool GlobalHistogramAllocator::WriteToPersistentLocation() { |
717 #if defined(OS_NACL) | 721 #if defined(OS_NACL) |
718 // NACL doesn't support file operations, including ImportantFileWriter. | 722 // NACL doesn't support file operations, including ImportantFileWriter. |
719 NOTREACHED(); | 723 NOTREACHED(); |
720 return false; | 724 return false; |
721 #else | 725 #else |
722 // Stop if no destination is set. | 726 // Stop if no destination is set. |
723 if (persistent_location_.empty()) { | 727 if (persistent_location_.empty()) { |
724 NOTREACHED() << "Could not write \"" << Name() << "\" persistent histograms" | 728 NOTREACHED() << "Could not write \"" << Name() << "\" persistent histograms" |
725 << " to file because no location was set."; | 729 << " to file because no location was set."; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
758 while (true) { | 762 while (true) { |
759 std::unique_ptr<HistogramBase> histogram = | 763 std::unique_ptr<HistogramBase> histogram = |
760 import_iterator_.GetNextWithIgnore(record_to_ignore); | 764 import_iterator_.GetNextWithIgnore(record_to_ignore); |
761 if (!histogram) | 765 if (!histogram) |
762 break; | 766 break; |
763 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); | 767 StatisticsRecorder::RegisterOrDeleteDuplicate(histogram.release()); |
764 } | 768 } |
765 } | 769 } |
766 | 770 |
767 } // namespace base | 771 } // namespace base |
OLD | NEW |