| Index: base/metrics/histogram_persistence.cc
|
| diff --git a/base/metrics/histogram_persistence.cc b/base/metrics/histogram_persistence.cc
|
| index f18d17528354329cd4995615d2451f6a52c59302..4a6b5dc4caf98957089c7dae5ec38d5340c4e80b 100644
|
| --- a/base/metrics/histogram_persistence.cc
|
| +++ b/base/metrics/histogram_persistence.cc
|
| @@ -7,6 +7,7 @@
|
| #include "base/lazy_instance.h"
|
| #include "base/logging.h"
|
| #include "base/memory/scoped_ptr.h"
|
| +#include "base/memory/shared_memory.h"
|
| #include "base/metrics/histogram.h"
|
| #include "base/metrics/histogram_base.h"
|
| #include "base/metrics/histogram_samples.h"
|
| @@ -189,6 +190,28 @@ void SetPersistentHistogramMemoryAllocator(
|
| g_allocator = allocator;
|
| }
|
|
|
| +SharedPersistentMemoryAllocator* CreateSharedPersistentHistogramMemoryAllocator(
|
| + size_t size,
|
| + StringPiece name,
|
| + uint64_t id) {
|
| + scoped_ptr<SharedMemory> shm(new SharedMemory());
|
| + shm->CreateAndMapAnonymous(size);
|
| + return new SharedPersistentMemoryAllocator(std::move(shm), id, name, false);
|
| +}
|
| +
|
| +SharedPersistentMemoryAllocator* CreateSharedPersistentHistogramMemoryAllocator(
|
| + size_t size,
|
| + const SharedMemoryHandle& handle,
|
| + bool readonly) {
|
| + scoped_ptr<SharedMemory> shm(new SharedMemory(handle, readonly));
|
| + if (!shm->Map(size)) {
|
| + NOTREACHED();
|
| + return nullptr;
|
| + }
|
| + return new SharedPersistentMemoryAllocator(std::move(shm), 0, StringPiece(),
|
| + readonly);
|
| +}
|
| +
|
| PersistentMemoryAllocator* GetPersistentHistogramMemoryAllocator() {
|
| return g_allocator;
|
| }
|
|
|