Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2022)

Unified Diff: base/metrics/persistent_histogram_allocator.cc

Issue 2714963002: Remove code duplication in CreateWithSharedMemory.
Patch Set: rebased Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/metrics/persistent_histogram_allocator.cc
diff --git a/base/metrics/persistent_histogram_allocator.cc b/base/metrics/persistent_histogram_allocator.cc
index a0e38716161934184fb79ca1e8bc94c38646f655..98a8498c237800cc430c1b283f37af3054da9a34 100644
--- a/base/metrics/persistent_histogram_allocator.cc
+++ b/base/metrics/persistent_histogram_allocator.cc
@@ -799,7 +799,7 @@ void GlobalHistogramAllocator::CreateWithSharedMemory(
DCHECK_LE(memory->mapped_size(), size);
Set(WrapUnique(
new GlobalHistogramAllocator(MakeUnique<SharedPersistentMemoryAllocator>(
- std::move(memory), 0, StringPiece(), /*readonly=*/false))));
+ std::move(memory), id, name, /*readonly=*/false))));
}
// static
@@ -808,15 +808,7 @@ void GlobalHistogramAllocator::CreateWithSharedMemoryHandle(
size_t size) {
std::unique_ptr<SharedMemory> shm(
new SharedMemory(handle, /*readonly=*/false));
- if (!shm->Map(size) ||
- !SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable(*shm)) {
- NOTREACHED();
- return;
- }
-
- Set(WrapUnique(
- new GlobalHistogramAllocator(MakeUnique<SharedPersistentMemoryAllocator>(
- std::move(shm), 0, StringPiece(), /*readonly=*/false))));
+ CreateWithSharedMemory(std::move(shm), size, 0, StringPiece());
}
// static
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698