Switch over to the google3 unix_file File*.
I also moved macros.h to base/macros.h to ease google3 porting, at
the expense of a larger than necessary change. (I learned my lesson,
though, and didn't make the equivalent base/logging.h change.)
I'm not sure whether we want to keep the unix_file MappedFile given
our existing MemMap, but it's easier to bring it over and then remove
it (and possibly revert the removal) than to bring it over later.
Change-Id: Id50a66faa5ab17b9bc936cc9043dbc26f791f0ca
diff --git a/src/hprof/hprof.cc b/src/hprof/hprof.cc
index 6965015..8838c29 100644
--- a/src/hprof/hprof.cc
+++ b/src/hprof/hprof.cc
@@ -37,9 +37,9 @@
#include <set>
+#include "base/unix_file/fd_file.h"
#include "class_linker.h"
#include "debugger.h"
-#include "file.h"
#include "globals.h"
#include "heap.h"
#include "logging.h"
@@ -459,7 +459,7 @@
}
}
- UniquePtr<File> file(OS::FileFromFd(filename_.c_str(), out_fd));
+ UniquePtr<File> file(new File(out_fd, filename_));
okay = file->WriteFully(header_data_ptr_, header_data_size_) &&
file->WriteFully(body_data_ptr_, body_data_size_);
if (!okay) {
@@ -468,7 +468,6 @@
self->ThrowNewException("Ljava/lang/RuntimeException;", msg.c_str());
LOG(ERROR) << msg;
}
- close(out_fd);
}
// Throw out a log message for the benefit of "runhat".