Index: base/file_util.h |
diff --git a/base/file_util.h b/base/file_util.h |
index f8418318a6a7ecd92255e6d708624b7f1ae6bcf7..7d058c8d2e62cc8db621c1b6da16302af821dfb5 100644 |
--- a/base/file_util.h |
+++ b/base/file_util.h |
@@ -137,6 +137,14 @@ BASE_EXPORT bool TextContentsEqual(const FilePath& filename1, |
// Useful for unit tests. |
BASE_EXPORT bool ReadFileToString(const FilePath& path, std::string* contents); |
+// Read the file at |path| into |contents|, returning true on success. |
+// This function has an additional check on the maximum size of the file. |
+// When the file size is greater than |max_size|, the function returns false |
+// with |contents| pointing to an empty string. |
+BASE_EXPORT bool ReadFileToString(const FilePath& path, |
+ std::string* contents, |
+ size_t max_size); |
+ |
#if defined(OS_POSIX) |
// Read exactly |bytes| bytes from file descriptor |fd|, storing the result |