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 606 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
617 uint64_t id, | 617 uint64_t id, |
618 StringPiece name) { | 618 StringPiece name) { |
619 Set(WrapUnique(new GlobalHistogramAllocator( | 619 Set(WrapUnique(new GlobalHistogramAllocator( |
620 WrapUnique(new LocalPersistentMemoryAllocator(size, id, name))))); | 620 WrapUnique(new LocalPersistentMemoryAllocator(size, id, name))))); |
621 } | 621 } |
622 | 622 |
623 // static | 623 // static |
624 void GlobalHistogramAllocator::CreateWithSharedMemory( | 624 void GlobalHistogramAllocator::CreateWithSharedMemory( |
625 std::unique_ptr<SharedMemory> memory, | 625 std::unique_ptr<SharedMemory> memory, |
626 size_t size, | 626 size_t size, |
627 uint64_t id, | 627 uint64_t /*id*/, |
628 StringPiece name) { | 628 StringPiece /*name*/) { |
629 if ((!memory->memory() && !memory->Map(size)) || | 629 if ((!memory->memory() && !memory->Map(size)) || |
630 !SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable(*memory)) { | 630 !SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable(*memory)) { |
631 NOTREACHED(); | 631 NOTREACHED(); |
632 return; | 632 return; |
633 } | 633 } |
634 | 634 |
635 DCHECK_LE(memory->mapped_size(), size); | 635 DCHECK_LE(memory->mapped_size(), size); |
636 Set(WrapUnique(new GlobalHistogramAllocator( | 636 Set(WrapUnique(new GlobalHistogramAllocator( |
637 WrapUnique(new SharedPersistentMemoryAllocator( | 637 WrapUnique(new SharedPersistentMemoryAllocator( |
638 std::move(memory), 0, StringPiece(), /*readonly=*/false))))); | 638 std::move(memory), 0, StringPiece(), /*readonly=*/false))))); |
(...skipping 119 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 |