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

Unified Diff: util/file/file_io.h

Issue 818433002: Add LoggingOpenFileFor{Read|Write} (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad@scoped-handle-land
Patch Set: posix Created 6 years 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 | util/file/file_io_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: util/file/file_io.h
diff --git a/util/file/file_io.h b/util/file/file_io.h
index 927bc3cb13319ff5843a613cff77bbfd20588648..3b1adef2b816435ac50a50bb462e950ec51fe135 100644
--- a/util/file/file_io.h
+++ b/util/file/file_io.h
@@ -15,6 +15,7 @@
#ifndef CRASHPAD_UTIL_FILE_FILE_IO_H_
#define CRASHPAD_UTIL_FILE_FILE_IO_H_
+#include <inttypes.h>
Mark Mentovai 2014/12/18 19:04:27 We use <stdint.h> to get intxx_t in Crashpad. But
scottmg 2014/12/18 19:59:20 Done. (removed)
#include <sys/types.h>
#include "build/build_config.h"
@@ -23,6 +24,10 @@
#include <windows.h>
#endif
+namespace base {
+class FilePath;
+}
Mark Mentovai 2014/12/18 19:04:27 // namespace base
scottmg 2014/12/18 19:59:20 Done.
+
namespace crashpad {
#if defined(OS_POSIX)
@@ -121,6 +126,26 @@ void CheckedWriteFile(FileHandle file, const void* buffer, size_t size);
//! \sa ReadFile
void CheckedReadFileAtEOF(FileHandle file);
+//! \brief Wraps `open()` or `CreateFile()`, creating a file for output. Logs
+//! an error if the operation fails.
+//!
+//! On a POSIX system, \a mode will be used as the permissions bits.
+//!
+//! \return The newly opened FileHandle, or an invalid FileHandle on failure.
Mark Mentovai 2014/12/18 19:04:27 Aha! We should have a \brief on FileHandle. None
scottmg 2014/12/18 19:59:20 Done.
+//!
+//! \sa ScopedFD
+//! \sa ScopedFileHANDLE
+FileHandle LoggingOpenFileForWrite(const base::FilePath& path, uint32_t mode);
Mark Mentovai 2014/12/18 19:04:26 I agree that we probably don’t need to worry about
scottmg 2014/12/18 19:59:20 I was thinking a separate LoggingOpenFileForAppend
+
+//! \brief Wraps `open()` or `CreateFile()`, opening an existing file for
+//! reading. Logs an error if the operation fails.
+//!
+//! \return The newly opened FileHandle, or an invalid FileHandle on failure.
+//!
+//! \sa ScopedFD
+//! \sa ScopedFileHANDLE
+FileHandle LoggingOpenFileForRead(const base::FilePath& path);
Mark Mentovai 2014/12/18 19:04:26 On the other hand, I see no problems with an inter
+
//! \brief Wraps `close()` or `CloseHandle()`, logging an error if the operation
//! fails.
//!
« no previous file with comments | « no previous file | util/file/file_io_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698