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

Unified Diff: components/metrics/file_metrics_provider.cc

Issue 2000523003: Fully support read/write memory-mapped files for persistent memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebased Created 4 years, 7 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 | « base/metrics/persistent_memory_allocator_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/metrics/file_metrics_provider.cc
diff --git a/components/metrics/file_metrics_provider.cc b/components/metrics/file_metrics_provider.cc
index a1c560d436a95f960543a59b6ecab9e28cb2ddb3..68b9e8c83e5144f09b98b4a5df02d8eb5fd4e050 100644
--- a/components/metrics/file_metrics_provider.cc
+++ b/components/metrics/file_metrics_provider.cc
@@ -15,6 +15,7 @@
#include "base/metrics/histogram_macros.h"
#include "base/metrics/persistent_histogram_allocator.h"
#include "base/metrics/persistent_memory_allocator.h"
+#include "base/strings/string_piece.h"
#include "base/task_runner.h"
#include "base/time/time.h"
#include "components/metrics/metrics_pref_names.h"
@@ -196,7 +197,8 @@ FileMetricsProvider::AccessResult FileMetricsProvider::CheckAndMapNewMetrics(
source->last_seen = info.last_modified;
// Test the validity of the file contents.
- if (!base::FilePersistentMemoryAllocator::IsFileAcceptable(*source->mapped)) {
+ if (!base::FilePersistentMemoryAllocator::IsFileAcceptable(*source->mapped,
+ true)) {
source->mapped.reset();
return ACCESS_RESULT_INVALID_CONTENTS;
}
@@ -367,13 +369,14 @@ void FileMetricsProvider::CreateAllocatorForSource(SourceInfo* source) {
// TODO(bcwhite): Make this do read/write when supported for "active".
source->allocator.reset(new base::PersistentHistogramAllocator(
base::WrapUnique(new base::FilePersistentMemoryAllocator(
- std::move(source->mapped), 0, ""))));
+ std::move(source->mapped), 0, 0, base::StringPiece(), true))));
} else {
// Data was copied from the mapped file into memory. Create an allocator
// on the copy thus eliminating disk I/O during data access.
source->allocator.reset(new base::PersistentHistogramAllocator(
base::WrapUnique(new base::PersistentMemoryAllocator(
- &source->data[0], source->data.size(), 0, 0, "", true))));
+ &source->data[0], source->data.size(), 0, 0, base::StringPiece(),
+ true))));
}
}
« no previous file with comments | « base/metrics/persistent_memory_allocator_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698