metrics_daemon: fix harmless confusion in writing persistent integers

As the subject says, I don't think this can change any of the
behavior, but the argument to Write() was ignored and merely
confusing.

BUG=chromium:339588
TEST=ran unit tests

Change-Id: Ie6d59e6879a734523978c21d66170721e0f499c7
Reviewed-on: https://chromium-review.googlesource.com/194919
Tested-by: Luigi Semenzato <semenzato@chromium.org>
Reviewed-by: Daniel Erat <derat@chromium.org>
Reviewed-by: Luigi Semenzato <semenzato@chromium.org>
Commit-Queue: Luigi Semenzato <semenzato@chromium.org>
diff --git a/metrics/persistent_integer.cc b/metrics/persistent_integer.cc
index c6ccf0e..658c9d3 100644
--- a/metrics/persistent_integer.cc
+++ b/metrics/persistent_integer.cc
@@ -35,13 +35,13 @@
 
 void PersistentInteger::Set(int64 value) {
   value_ = value;
-  Write(value);
+  Write();
 }
 
 int64 PersistentInteger::Get() {
   // If not synced, then read.  If the read fails, it's a good idea to write.
   if (!synced_ && !Read())
-    Write(value_);
+    Write();
   return value_;
 }
 
@@ -55,7 +55,7 @@
   Set(Get() + x);
 }
 
-void PersistentInteger::Write(int64 value) {
+void PersistentInteger::Write() {
   int fd = HANDLE_EINTR(open(backing_file_name_.c_str(),
                              O_WRONLY | O_CREAT | O_TRUNC,
                              S_IWUSR | S_IRUSR | S_IRGRP | S_IROTH));
diff --git a/metrics/persistent_integer.h b/metrics/persistent_integer.h
index 7d920b5..5b159c7 100644
--- a/metrics/persistent_integer.h
+++ b/metrics/persistent_integer.h
@@ -45,11 +45,12 @@
  private:
   static const int kVersion = 1001;
 
-  // Writes |value| to the backing file, creating it if necessary.
-  void Write(int64 value);
+  // Writes |value_| to the backing file, creating it if necessary.
+  void Write();
 
   // Reads the value from the backing file, stores it in |value_|, and returns
-  // true if the backing file is valid.  Returns false otherwise.
+  // true if the backing file is valid.  Returns false otherwise, and creates
+  // a valid backing file as a side effect.
   bool Read();
 
   int64 value_;