Switch to standard integer types in base/files/.

BUG=138542
[email protected]

Review URL: https://codereview.chromium.org/1549853002

Cr-Commit-Position: refs/heads/master@{#366804}
diff --git a/base/files/dir_reader_linux.h b/base/files/dir_reader_linux.h
index 83918e8..4ce0c34 100644
--- a/base/files/dir_reader_linux.h
+++ b/base/files/dir_reader_linux.h
@@ -7,11 +7,13 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <sys/syscall.h>
 #include <unistd.h>
 
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/posix/eintr_wrapper.h"
 
 // See the comments in dir_reader_posix.h about this.
diff --git a/base/files/dir_reader_posix_unittest.cc b/base/files/dir_reader_posix_unittest.cc
index 2e181b3d..a75858fe 100644
--- a/base/files/dir_reader_posix_unittest.cc
+++ b/base/files/dir_reader_posix_unittest.cc
@@ -12,6 +12,7 @@
 
 #include "base/files/scoped_temp_dir.h"
 #include "base/logging.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if defined(OS_ANDROID)
diff --git a/base/files/file.cc b/base/files/file.cc
index d62767a..ab05630 100644
--- a/base/files/file.cc
+++ b/base/files/file.cc
@@ -7,6 +7,7 @@
 #include "base/files/file_tracing.h"
 #include "base/metrics/histogram.h"
 #include "base/timer/elapsed_timer.h"
+#include "build/build_config.h"
 
 namespace base {
 
@@ -26,10 +27,8 @@
 }
 
 #if !defined(OS_NACL)
-File::File(const FilePath& path, uint32 flags)
-    : error_details_(FILE_OK),
-      created_(false),
-      async_(false) {
+File::File(const FilePath& path, uint32_t flags)
+    : error_details_(FILE_OK), created_(false), async_(false) {
   Initialize(path, flags);
 }
 #endif
@@ -83,7 +82,7 @@
 }
 
 #if !defined(OS_NACL)
-void File::Initialize(const FilePath& path, uint32 flags) {
+void File::Initialize(const FilePath& path, uint32_t flags) {
   if (path.ReferencesParent()) {
     error_details_ = FILE_ERROR_ACCESS_DENIED;
     return;
diff --git a/base/files/file.h b/base/files/file.h
index ba4dd34..7ab5ca585 100644
--- a/base/files/file.h
+++ b/base/files/file.h
@@ -5,29 +5,27 @@
 #ifndef BASE_FILES_FILE_H_
 #define BASE_FILES_FILE_H_
 
-#include "build/build_config.h"
-#if defined(OS_WIN)
-#include <windows.h>
-#endif
-
-#if defined(OS_POSIX)
-#include <sys/stat.h>
-#endif
+#include <stdint.h>
 
 #include <string>
 
 #include "base/base_export.h"
-#include "base/basictypes.h"
 #include "base/files/file_path.h"
 #include "base/files/file_tracing.h"
 #include "base/files/scoped_file.h"
 #include "base/move.h"
 #include "base/time/time.h"
+#include "build/build_config.h"
 
 #if defined(OS_WIN)
+#include <windows.h>
 #include "base/win/scoped_handle.h"
 #endif
 
+#if defined(OS_POSIX)
+#include <sys/stat.h>
+#endif
+
 namespace base {
 
 #if defined(OS_WIN)
@@ -138,7 +136,7 @@
 #endif
 
     // The size of the file in bytes.  Undefined when is_directory is true.
-    int64 size;
+    int64_t size;
 
     // True if the file corresponds to a directory.
     bool is_directory;
@@ -161,7 +159,7 @@
 
   // Creates or opens the given file. This will fail with 'access denied' if the
   // |path| contains path traversal ('..') components.
-  File(const FilePath& path, uint32 flags);
+  File(const FilePath& path, uint32_t flags);
 
   // Takes ownership of |platform_file|.
   explicit File(PlatformFile platform_file);
@@ -179,7 +177,7 @@
   File& operator=(File&& other);
 
   // Creates or opens the given file.
-  void Initialize(const FilePath& path, uint32 flags);
+  void Initialize(const FilePath& path, uint32_t flags);
 
   // Returns |true| if the handle / fd wrapped by this object is valid.  This
   // method doesn't interact with the file system (and is safe to be called from
@@ -207,7 +205,7 @@
   // Changes current position in the file to an |offset| relative to an origin
   // defined by |whence|. Returns the resultant current position in the file
   // (relative to the start) or -1 in case of error.
-  int64 Seek(Whence whence, int64 offset);
+  int64_t Seek(Whence whence, int64_t offset);
 
   // Reads the given number of bytes (or until EOF is reached) starting with the
   // given offset. Returns the number of bytes read, or -1 on error. Note that
@@ -215,7 +213,7 @@
   // is not intended for stream oriented files but instead for cases when the
   // normal expectation is that actually |size| bytes are read unless there is
   // an error.
-  int Read(int64 offset, char* data, int size);
+  int Read(int64_t offset, char* data, int size);
 
   // Same as above but without seek.
   int ReadAtCurrentPos(char* data, int size);
@@ -223,7 +221,7 @@
   // Reads the given number of bytes (or until EOF is reached) starting with the
   // given offset, but does not make any effort to read all data on all
   // platforms. Returns the number of bytes read, or -1 on error.
-  int ReadNoBestEffort(int64 offset, char* data, int size);
+  int ReadNoBestEffort(int64_t offset, char* data, int size);
 
   // Same as above but without seek.
   int ReadAtCurrentPosNoBestEffort(char* data, int size);
@@ -234,7 +232,7 @@
   // all platforms.
   // Ignores the offset and writes to the end of the file if the file was opened
   // with FLAG_APPEND.
-  int Write(int64 offset, const char* data, int size);
+  int Write(int64_t offset, const char* data, int size);
 
   // Save as above but without seek.
   int WriteAtCurrentPos(const char* data, int size);
@@ -244,12 +242,12 @@
   int WriteAtCurrentPosNoBestEffort(const char* data, int size);
 
   // Returns the current size of this file, or a negative number on failure.
-  int64 GetLength();
+  int64_t GetLength();
 
   // Truncates the file to the given length. If |length| is greater than the
   // current size of the file, the file is extended with zeros. If the file
   // doesn't exist, |false| is returned.
-  bool SetLength(int64 length);
+  bool SetLength(int64_t length);
 
   // Instructs the filesystem to flush the file to disk. (POSIX: fsync, Windows:
   // FlushFileBuffers).
@@ -309,7 +307,7 @@
 
   // Creates or opens the given file. Only called if |path| has no
   // traversal ('..') components.
-  void DoInitialize(const FilePath& path, uint32 flags);
+  void DoInitialize(const FilePath& path, uint32_t flags);
 
   // TODO(tnagel): Reintegrate into Flush() once histogram isn't needed anymore,
   // cf. issue 473337.
diff --git a/base/files/file_enumerator.h b/base/files/file_enumerator.h
index 38bb833..7cac8dd 100644
--- a/base/files/file_enumerator.h
+++ b/base/files/file_enumerator.h
@@ -5,12 +5,15 @@
 #ifndef BASE_FILES_FILE_ENUMERATOR_H_
 #define BASE_FILES_FILE_ENUMERATOR_H_
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <stack>
 #include <vector>
 
 #include "base/base_export.h"
-#include "base/basictypes.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 #include "base/time/time.h"
 #include "build/build_config.h"
 
@@ -49,7 +52,7 @@
     // includes the |root_path| passed into the FileEnumerator constructor.
     FilePath GetName() const;
 
-    int64 GetSize() const;
+    int64_t GetSize() const;
     Time GetLastModifiedTime() const;
 
 #if defined(OS_WIN)
diff --git a/base/files/file_enumerator_posix.cc b/base/files/file_enumerator_posix.cc
index 7533a24..fb4010a 100644
--- a/base/files/file_enumerator_posix.cc
+++ b/base/files/file_enumerator_posix.cc
@@ -7,9 +7,11 @@
 #include <dirent.h>
 #include <errno.h>
 #include <fnmatch.h>
+#include <stdint.h>
 
 #include "base/logging.h"
 #include "base/threading/thread_restrictions.h"
+#include "build/build_config.h"
 
 namespace base {
 
@@ -27,7 +29,7 @@
   return filename_;
 }
 
-int64 FileEnumerator::FileInfo::GetSize() const {
+int64_t FileEnumerator::FileInfo::GetSize() const {
   return stat_.st_size;
 }
 
diff --git a/base/files/file_enumerator_win.cc b/base/files/file_enumerator_win.cc
index 90db7f5..402a0720 100644
--- a/base/files/file_enumerator_win.cc
+++ b/base/files/file_enumerator_win.cc
@@ -4,6 +4,7 @@
 
 #include "base/files/file_enumerator.h"
 
+#include <stdint.h>
 #include <string.h>
 
 #include "base/logging.h"
@@ -26,13 +27,13 @@
   return FilePath(find_data_.cFileName);
 }
 
-int64 FileEnumerator::FileInfo::GetSize() const {
+int64_t FileEnumerator::FileInfo::GetSize() const {
   ULARGE_INTEGER size;
   size.HighPart = find_data_.nFileSizeHigh;
   size.LowPart = find_data_.nFileSizeLow;
   DCHECK_LE(size.QuadPart,
-            static_cast<ULONGLONG>(std::numeric_limits<int64>::max()));
-  return static_cast<int64>(size.QuadPart);
+            static_cast<ULONGLONG>(std::numeric_limits<int64_t>::max()));
+  return static_cast<int64_t>(size.QuadPart);
 }
 
 base::Time FileEnumerator::FileInfo::GetLastModifiedTime() const {
diff --git a/base/files/file_locking_unittest.cc b/base/files/file_locking_unittest.cc
index 7f41bba..d9a1755 100644
--- a/base/files/file_locking_unittest.cc
+++ b/base/files/file_locking_unittest.cc
@@ -6,6 +6,7 @@
 #include "base/files/file.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
+#include "base/macros.h"
 #include "base/test/multiprocess_test.h"
 #include "base/test/test_timeouts.h"
 #include "base/threading/platform_thread.h"
diff --git a/base/files/file_path.cc b/base/files/file_path.cc
index 18775ed..63e93879 100644
--- a/base/files/file_path.cc
+++ b/base/files/file_path.cc
@@ -7,13 +7,14 @@
 #include <string.h>
 #include <algorithm>
 
-#include "base/basictypes.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/pickle.h"
 #include "base/strings/string_piece.h"
 #include "base/strings/string_util.h"
 #include "base/strings/sys_string_conversions.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
 
 #if defined(OS_MACOSX)
 #include "base/mac/scoped_cftyperef.h"
diff --git a/base/files/file_path.h b/base/files/file_path.h
index fba2f98a..89e9cbf 100644
--- a/base/files/file_path.h
+++ b/base/files/file_path.h
@@ -111,6 +111,7 @@
 #include "base/base_export.h"
 #include "base/compiler_specific.h"
 #include "base/containers/hash_tables.h"
+#include "base/macros.h"
 #include "base/strings/string16.h"
 #include "base/strings/string_piece.h"
 #include "build/build_config.h"
diff --git a/base/files/file_path_constants.cc b/base/files/file_path_constants.cc
index 34b17a6..0b74846 100644
--- a/base/files/file_path_constants.cc
+++ b/base/files/file_path_constants.cc
@@ -2,7 +2,10 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <stddef.h>
+
 #include "base/files/file_path.h"
+#include "base/macros.h"
 
 namespace base {
 
diff --git a/base/files/file_path_unittest.cc b/base/files/file_path_unittest.cc
index bc0e843..f57de679 100644
--- a/base/files/file_path_unittest.cc
+++ b/base/files/file_path_unittest.cc
@@ -2,11 +2,14 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
+#include <stddef.h>
+
 #include <sstream>
 
-#include "base/basictypes.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
diff --git a/base/files/file_path_watcher.cc b/base/files/file_path_watcher.cc
index 59ae7059..955e6a2a 100644
--- a/base/files/file_path_watcher.cc
+++ b/base/files/file_path_watcher.cc
@@ -9,6 +9,7 @@
 
 #include "base/logging.h"
 #include "base/message_loop/message_loop.h"
+#include "build/build_config.h"
 
 #if defined(OS_MACOSX) && !defined(OS_IOS)
 #include "base/mac/mac_util.h"
diff --git a/base/files/file_path_watcher.h b/base/files/file_path_watcher.h
index 834acbc..d5c6db1ac 100644
--- a/base/files/file_path_watcher.h
+++ b/base/files/file_path_watcher.h
@@ -8,9 +8,9 @@
 #define BASE_FILES_FILE_PATH_WATCHER_H_
 
 #include "base/base_export.h"
-#include "base/basictypes.h"
 #include "base/callback.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/single_thread_task_runner.h"
 
diff --git a/base/files/file_path_watcher_fsevents.cc b/base/files/file_path_watcher_fsevents.cc
index da01c43..78637aa 100644
--- a/base/files/file_path_watcher_fsevents.cc
+++ b/base/files/file_path_watcher_fsevents.cc
@@ -12,6 +12,7 @@
 #include "base/logging.h"
 #include "base/mac/libdispatch_task_runner.h"
 #include "base/mac/scoped_cftyperef.h"
+#include "base/macros.h"
 #include "base/message_loop/message_loop.h"
 #include "base/thread_task_runner_handle.h"
 
diff --git a/base/files/file_path_watcher_fsevents.h b/base/files/file_path_watcher_fsevents.h
index 300aa761..1ebe463 100644
--- a/base/files/file_path_watcher_fsevents.h
+++ b/base/files/file_path_watcher_fsevents.h
@@ -6,11 +6,13 @@
 #define BASE_FILES_FILE_PATH_WATCHER_FSEVENTS_H_
 
 #include <CoreServices/CoreServices.h>
+#include <stddef.h>
 
 #include <vector>
 
 #include "base/files/file_path.h"
 #include "base/files/file_path_watcher.h"
+#include "base/macros.h"
 
 namespace base {
 
diff --git a/base/files/file_path_watcher_kqueue.cc b/base/files/file_path_watcher_kqueue.cc
index e15cba7..4d2b1d54 100644
--- a/base/files/file_path_watcher_kqueue.cc
+++ b/base/files/file_path_watcher_kqueue.cc
@@ -5,6 +5,7 @@
 #include "base/files/file_path_watcher_kqueue.h"
 
 #include <fcntl.h>
+#include <stddef.h>
 #include <sys/param.h>
 
 #include "base/bind.h"
diff --git a/base/files/file_path_watcher_kqueue.h b/base/files/file_path_watcher_kqueue.h
index 69555a3..d9db8c2 100644
--- a/base/files/file_path_watcher_kqueue.h
+++ b/base/files/file_path_watcher_kqueue.h
@@ -10,6 +10,7 @@
 
 #include "base/files/file_path.h"
 #include "base/files/file_path_watcher.h"
+#include "base/macros.h"
 #include "base/message_loop/message_loop.h"
 #include "base/single_thread_task_runner.h"
 
diff --git a/base/files/file_path_watcher_linux.cc b/base/files/file_path_watcher_linux.cc
index 6dfc0a64..a75eaba 100644
--- a/base/files/file_path_watcher_linux.cc
+++ b/base/files/file_path_watcher_linux.cc
@@ -5,6 +5,7 @@
 #include "base/files/file_path_watcher.h"
 
 #include <errno.h>
+#include <stddef.h>
 #include <string.h>
 #include <sys/inotify.h>
 #include <sys/ioctl.h>
@@ -25,6 +26,7 @@
 #include "base/lazy_instance.h"
 #include "base/location.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/posix/eintr_wrapper.h"
 #include "base/single_thread_task_runner.h"
diff --git a/base/files/file_path_watcher_mac.cc b/base/files/file_path_watcher_mac.cc
index 6f55ba4..7338eaf 100644
--- a/base/files/file_path_watcher_mac.cc
+++ b/base/files/file_path_watcher_mac.cc
@@ -4,6 +4,7 @@
 
 #include "base/files/file_path_watcher.h"
 #include "base/files/file_path_watcher_kqueue.h"
+#include "build/build_config.h"
 
 #if !defined(OS_IOS)
 #include "base/files/file_path_watcher_fsevents.h"
diff --git a/base/files/file_path_watcher_unittest.cc b/base/files/file_path_watcher_unittest.cc
index 21e9dd1..a860b13 100644
--- a/base/files/file_path_watcher_unittest.cc
+++ b/base/files/file_path_watcher_unittest.cc
@@ -13,7 +13,6 @@
 
 #include <set>
 
-#include "base/basictypes.h"
 #include "base/bind.h"
 #include "base/bind_helpers.h"
 #include "base/compiler_specific.h"
@@ -21,6 +20,7 @@
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/location.h"
+#include "base/macros.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "base/stl_util.h"
@@ -30,6 +30,7 @@
 #include "base/test/test_timeouts.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/threading/thread.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 #if defined(OS_ANDROID)
diff --git a/base/files/file_path_watcher_win.cc b/base/files/file_path_watcher_win.cc
index 3f37cec..29436e7 100644
--- a/base/files/file_path_watcher_win.cc
+++ b/base/files/file_path_watcher_win.cc
@@ -9,6 +9,7 @@
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/thread_task_runner_handle.h"
 #include "base/time/time.h"
diff --git a/base/files/file_posix.cc b/base/files/file_posix.cc
index 92721f9..462fbd6 100644
--- a/base/files/file_posix.cc
+++ b/base/files/file_posix.cc
@@ -6,6 +6,7 @@
 
 #include <errno.h>
 #include <fcntl.h>
+#include <stdint.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
@@ -14,6 +15,7 @@
 #include "base/posix/eintr_wrapper.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/threading/thread_restrictions.h"
+#include "build/build_config.h"
 
 #if defined(OS_ANDROID)
 #include "base/os_compat_android.h"
@@ -47,7 +49,7 @@
   return (fcntl(file, F_GETFL) & O_APPEND) != 0;
 }
 
-int CallFtruncate(PlatformFile file, int64 length) {
+int CallFtruncate(PlatformFile file, int64_t length) {
   return HANDLE_EINTR(ftruncate(file, length));
 }
 
@@ -87,7 +89,7 @@
   return false;
 }
 
-int CallFtruncate(PlatformFile file, int64 length) {
+int CallFtruncate(PlatformFile file, int64_t length) {
   NOTIMPLEMENTED();  // NaCl doesn't implement ftruncate.
   return 0;
 }
@@ -112,32 +114,32 @@
 
 #if defined(OS_LINUX)
   time_t last_modified_sec = stat_info.st_mtim.tv_sec;
-  int64 last_modified_nsec = stat_info.st_mtim.tv_nsec;
+  int64_t last_modified_nsec = stat_info.st_mtim.tv_nsec;
   time_t last_accessed_sec = stat_info.st_atim.tv_sec;
-  int64 last_accessed_nsec = stat_info.st_atim.tv_nsec;
+  int64_t last_accessed_nsec = stat_info.st_atim.tv_nsec;
   time_t creation_time_sec = stat_info.st_ctim.tv_sec;
-  int64 creation_time_nsec = stat_info.st_ctim.tv_nsec;
+  int64_t creation_time_nsec = stat_info.st_ctim.tv_nsec;
 #elif defined(OS_ANDROID)
   time_t last_modified_sec = stat_info.st_mtime;
-  int64 last_modified_nsec = stat_info.st_mtime_nsec;
+  int64_t last_modified_nsec = stat_info.st_mtime_nsec;
   time_t last_accessed_sec = stat_info.st_atime;
-  int64 last_accessed_nsec = stat_info.st_atime_nsec;
+  int64_t last_accessed_nsec = stat_info.st_atime_nsec;
   time_t creation_time_sec = stat_info.st_ctime;
-  int64 creation_time_nsec = stat_info.st_ctime_nsec;
+  int64_t creation_time_nsec = stat_info.st_ctime_nsec;
 #elif defined(OS_MACOSX) || defined(OS_IOS) || defined(OS_BSD)
   time_t last_modified_sec = stat_info.st_mtimespec.tv_sec;
-  int64 last_modified_nsec = stat_info.st_mtimespec.tv_nsec;
+  int64_t last_modified_nsec = stat_info.st_mtimespec.tv_nsec;
   time_t last_accessed_sec = stat_info.st_atimespec.tv_sec;
-  int64 last_accessed_nsec = stat_info.st_atimespec.tv_nsec;
+  int64_t last_accessed_nsec = stat_info.st_atimespec.tv_nsec;
   time_t creation_time_sec = stat_info.st_ctimespec.tv_sec;
-  int64 creation_time_nsec = stat_info.st_ctimespec.tv_nsec;
+  int64_t creation_time_nsec = stat_info.st_ctimespec.tv_nsec;
 #else
   time_t last_modified_sec = stat_info.st_mtime;
-  int64 last_modified_nsec = 0;
+  int64_t last_modified_nsec = 0;
   time_t last_accessed_sec = stat_info.st_atime;
-  int64 last_accessed_nsec = 0;
+  int64_t last_accessed_nsec = 0;
   time_t creation_time_sec = stat_info.st_ctime;
-  int64 creation_time_nsec = 0;
+  int64_t creation_time_nsec = 0;
 #endif
 
   last_modified =
@@ -177,24 +179,24 @@
   file_.reset();
 }
 
-int64 File::Seek(Whence whence, int64 offset) {
+int64_t File::Seek(Whence whence, int64_t offset) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
 
   SCOPED_FILE_TRACE_WITH_SIZE("Seek", offset);
 
 #if defined(OS_ANDROID)
-  static_assert(sizeof(int64) == sizeof(off64_t), "off64_t must be 64 bits");
+  static_assert(sizeof(int64_t) == sizeof(off64_t), "off64_t must be 64 bits");
   return lseek64(file_.get(), static_cast<off64_t>(offset),
                  static_cast<int>(whence));
 #else
-  static_assert(sizeof(int64) == sizeof(off_t), "off_t must be 64 bits");
+  static_assert(sizeof(int64_t) == sizeof(off_t), "off_t must be 64 bits");
   return lseek(file_.get(), static_cast<off_t>(offset),
                static_cast<int>(whence));
 #endif
 }
 
-int File::Read(int64 offset, char* data, int size) {
+int File::Read(int64_t offset, char* data, int size) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
   if (size < 0)
@@ -237,7 +239,7 @@
   return bytes_read ? bytes_read : rv;
 }
 
-int File::ReadNoBestEffort(int64 offset, char* data, int size) {
+int File::ReadNoBestEffort(int64_t offset, char* data, int size) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
   SCOPED_FILE_TRACE_WITH_SIZE("ReadNoBestEffort", size);
@@ -254,7 +256,7 @@
   return HANDLE_EINTR(read(file_.get(), data, size));
 }
 
-int File::Write(int64 offset, const char* data, int size) {
+int File::Write(int64_t offset, const char* data, int size) {
   ThreadRestrictions::AssertIOAllowed();
 
   if (IsOpenAppend(file_.get()))
@@ -312,7 +314,7 @@
   return HANDLE_EINTR(write(file_.get(), data, size));
 }
 
-int64 File::GetLength() {
+int64_t File::GetLength() {
   DCHECK(IsValid());
 
   SCOPED_FILE_TRACE("GetLength");
@@ -324,7 +326,7 @@
   return file_info.st_size;
 }
 
-bool File::SetLength(int64 length) {
+bool File::SetLength(int64_t length) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
 
@@ -423,7 +425,7 @@
 // NaCl doesn't implement system calls to open files directly.
 #if !defined(OS_NACL)
 // TODO(erikkay): does it make sense to support FLAG_EXCLUSIVE_* here?
-void File::DoInitialize(const FilePath& path, uint32 flags) {
+void File::DoInitialize(const FilePath& path, uint32_t flags) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(!IsValid());
 
diff --git a/base/files/file_proxy.cc b/base/files/file_proxy.cc
index 3761e99..f157d4d 100644
--- a/base/files/file_proxy.cc
+++ b/base/files/file_proxy.cc
@@ -11,6 +11,7 @@
 #include "base/files/file.h"
 #include "base/files/file_util.h"
 #include "base/location.h"
+#include "base/macros.h"
 #include "base/task_runner.h"
 #include "base/task_runner_util.h"
 
@@ -67,7 +68,7 @@
     error_ = rv ? File::FILE_OK : File::FILE_ERROR_FAILED;
   }
 
-  void SetLength(int64 length) {
+  void SetLength(int64_t length) {
     if (file_.SetLength(length))
       error_ = File::FILE_OK;
   }
@@ -114,7 +115,7 @@
       : FileHelper(proxy, std::move(file)) {
   }
 
-  void RunWork(uint32 additional_file_flags) {
+  void RunWork(uint32_t additional_file_flags) {
     // TODO(darin): file_util should have a variant of CreateTemporaryFile
     // that returns a FilePath and a File.
     if (!CreateTemporaryFile(&file_path_)) {
@@ -124,10 +125,8 @@
       return;
     }
 
-    uint32 file_flags = File::FLAG_WRITE |
-                        File::FLAG_TEMPORARY |
-                        File::FLAG_CREATE_ALWAYS |
-                        additional_file_flags;
+    uint32_t file_flags = File::FLAG_WRITE | File::FLAG_TEMPORARY |
+                          File::FLAG_CREATE_ALWAYS | additional_file_flags;
 
     file_.Initialize(file_path_, file_flags);
     if (file_.IsValid()) {
@@ -181,7 +180,7 @@
         bytes_read_(0) {
   }
 
-  void RunWork(int64 offset) {
+  void RunWork(int64_t offset) {
     bytes_read_ = file_.Read(offset, buffer_.get(), bytes_to_read_);
     error_ = (bytes_read_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
   }
@@ -211,7 +210,7 @@
     memcpy(buffer_.get(), buffer, bytes_to_write);
   }
 
-  void RunWork(int64 offset) {
+  void RunWork(int64_t offset) {
     bytes_written_ = file_.Write(offset, buffer_.get(), bytes_to_write_);
     error_ = (bytes_written_ < 0) ? File::FILE_ERROR_FAILED : File::FILE_OK;
   }
@@ -240,7 +239,7 @@
 }
 
 bool FileProxy::CreateOrOpen(const FilePath& file_path,
-                             uint32 file_flags,
+                             uint32_t file_flags,
                              const StatusCallback& callback) {
   DCHECK(!file_.IsValid());
   CreateOrOpenHelper* helper = new CreateOrOpenHelper(this, File());
@@ -251,7 +250,7 @@
       Bind(&CreateOrOpenHelper::Reply, Owned(helper), callback));
 }
 
-bool FileProxy::CreateTemporary(uint32 additional_file_flags,
+bool FileProxy::CreateTemporary(uint32_t additional_file_flags,
                                 const CreateTemporaryCallback& callback) {
   DCHECK(!file_.IsValid());
   CreateTemporaryHelper* helper = new CreateTemporaryHelper(this, File());
@@ -297,7 +296,7 @@
       Bind(&GetInfoHelper::Reply, Owned(helper), callback));
 }
 
-bool FileProxy::Read(int64 offset,
+bool FileProxy::Read(int64_t offset,
                      int bytes_to_read,
                      const ReadCallback& callback) {
   DCHECK(file_.IsValid());
@@ -311,7 +310,7 @@
       Bind(&ReadHelper::Reply, Owned(helper), callback));
 }
 
-bool FileProxy::Write(int64 offset,
+bool FileProxy::Write(int64_t offset,
                       const char* buffer,
                       int bytes_to_write,
                       const WriteCallback& callback) {
@@ -339,7 +338,7 @@
       Bind(&GenericFileHelper::Reply, Owned(helper), callback));
 }
 
-bool FileProxy::SetLength(int64 length, const StatusCallback& callback) {
+bool FileProxy::SetLength(int64_t length, const StatusCallback& callback) {
   DCHECK(file_.IsValid());
   GenericFileHelper* helper = new GenericFileHelper(this, std::move(file_));
   return task_runner_->PostTaskAndReply(
diff --git a/base/files/file_proxy.h b/base/files/file_proxy.h
index f990d04..87037ac 100644
--- a/base/files/file_proxy.h
+++ b/base/files/file_proxy.h
@@ -5,10 +5,13 @@
 #ifndef BASE_FILES_FILE_PROXY_H_
 #define BASE_FILES_FILE_PROXY_H_
 
+#include <stdint.h>
+
 #include "base/base_export.h"
 #include "base/callback_forward.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/memory/weak_ptr.h"
 
@@ -64,7 +67,7 @@
   //
   // This returns false if task posting to |task_runner| has failed.
   bool CreateOrOpen(const FilePath& file_path,
-                    uint32 file_flags,
+                    uint32_t file_flags,
                     const StatusCallback& callback);
 
   // Creates a temporary file for writing. The path and an open file are
@@ -75,7 +78,7 @@
   //   File::FLAG_TEMPORARY.
   //
   // This returns false if task posting to |task_runner| has failed.
-  bool CreateTemporary(uint32 additional_file_flags,
+  bool CreateTemporary(uint32_t additional_file_flags,
                        const CreateTemporaryCallback& callback);
 
   // Returns true if the underlying |file_| is valid.
@@ -104,12 +107,12 @@
   // Proxies File::Read. The callback can't be null.
   // This returns false if |bytes_to_read| is less than zero, or
   // if task posting to |task_runner| has failed.
-  bool Read(int64 offset, int bytes_to_read, const ReadCallback& callback);
+  bool Read(int64_t offset, int bytes_to_read, const ReadCallback& callback);
 
   // Proxies File::Write. The callback can be null.
   // This returns false if |bytes_to_write| is less than or equal to zero,
   // if |buffer| is NULL, or if task posting to |task_runner| has failed.
-  bool Write(int64 offset,
+  bool Write(int64_t offset,
              const char* buffer,
              int bytes_to_write,
              const WriteCallback& callback);
@@ -122,7 +125,7 @@
 
   // Proxies File::SetLength. The callback can be null.
   // This returns false if task posting to |task_runner| has failed.
-  bool SetLength(int64 length, const StatusCallback& callback);
+  bool SetLength(int64_t length, const StatusCallback& callback);
 
   // Proxies File::Flush. The callback can be null.
   // This returns false if task posting to |task_runner| has failed.
diff --git a/base/files/file_proxy_unittest.cc b/base/files/file_proxy_unittest.cc
index 72c430e37..2562208 100644
--- a/base/files/file_proxy_unittest.cc
+++ b/base/files/file_proxy_unittest.cc
@@ -4,15 +4,20 @@
 
 #include "base/files/file_proxy.h"
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <utility>
 
 #include "base/bind.h"
 #include "base/files/file.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
+#include "base/macros.h"
 #include "base/memory/weak_ptr.h"
 #include "base/threading/thread.h"
 #include "base/threading/thread_restrictions.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace base {
@@ -71,7 +76,7 @@
   }
 
  protected:
-  void CreateProxy(uint32 flags, FileProxy* proxy) {
+  void CreateProxy(uint32_t flags, FileProxy* proxy) {
     proxy->CreateOrOpen(
         test_path(), flags,
         Bind(&FileProxyTest::DidCreateOrOpen, weak_factory_.GetWeakPtr()));
diff --git a/base/files/file_tracing.cc b/base/files/file_tracing.cc
index 92a5780b..6d11cbc 100644
--- a/base/files/file_tracing.cc
+++ b/base/files/file_tracing.cc
@@ -39,8 +39,9 @@
     g_provider->FileTracingEventEnd(name_, id_);
 }
 
-void FileTracing::ScopedTrace::Initialize(
-    const char* name, File* file, int64 size) {
+void FileTracing::ScopedTrace::Initialize(const char* name,
+                                          File* file,
+                                          int64_t size) {
   id_ = &file->trace_enabler_;
   name_ = name;
   g_provider->FileTracingEventBegin(name_, id_, file->tracing_path_, size);
diff --git a/base/files/file_tracing.h b/base/files/file_tracing.h
index d37c21d..bedd7be6 100644
--- a/base/files/file_tracing.h
+++ b/base/files/file_tracing.h
@@ -5,8 +5,9 @@
 #ifndef BASE_FILES_FILE_TRACING_H_
 #define BASE_FILES_FILE_TRACING_H_
 
+#include <stdint.h>
+
 #include "base/base_export.h"
-#include "base/basictypes.h"
 #include "base/macros.h"
 
 #define FILE_TRACING_PREFIX "File"
@@ -44,8 +45,10 @@
     // Begins an event for |id| with |name|. |path| tells where in the directory
     // structure the event is happening (and may be blank). |size| is the number
     // of bytes involved in the event.
-    virtual void FileTracingEventBegin(
-        const char* name, void* id, const FilePath& path, int64 size) = 0;
+    virtual void FileTracingEventBegin(const char* name,
+                                       void* id,
+                                       const FilePath& path,
+                                       int64_t size) = 0;
 
     // Ends an event for |id| with |name|.
     virtual void FileTracingEventEnd(const char* name, void* id) = 0;
@@ -70,7 +73,7 @@
     // event to trace (e.g. "Read", "Write") and must have an application
     // lifetime (e.g. static or literal). |file| is the file being traced; must
     // outlive this class. |size| is the size (in bytes) of this event.
-    void Initialize(const char* name, File* file, int64 size);
+    void Initialize(const char* name, File* file, int64_t size);
 
    private:
     // The ID of this trace. Based on the |file| passed to |Initialize()|. Must
diff --git a/base/files/file_unittest.cc b/base/files/file_unittest.cc
index 909bacb..2445f7e 100644
--- a/base/files/file_unittest.cc
+++ b/base/files/file_unittest.cc
@@ -4,11 +4,14 @@
 
 #include "base/files/file.h"
 
+#include <stdint.h>
+
 #include <utility>
 
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
 #include "base/time/time.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 using base::File;
@@ -202,7 +205,7 @@
   EXPECT_EQ(kPartialWriteLength, bytes_written);
 
   // Make sure the file was extended.
-  int64 file_size = 0;
+  int64_t file_size = 0;
   EXPECT_TRUE(GetFileSize(file_path, &file_size));
   EXPECT_EQ(kOffsetBeyondEndOfFile + kPartialWriteLength, file_size);
 
@@ -284,7 +287,7 @@
 
   // Extend the file.
   const int kExtendedFileLength = 10;
-  int64 file_size = 0;
+  int64_t file_size = 0;
   EXPECT_TRUE(file.SetLength(kExtendedFileLength));
   EXPECT_EQ(kExtendedFileLength, file.GetLength());
   EXPECT_TRUE(GetFileSize(file_path, &file_size));
@@ -437,7 +440,7 @@
                 base::File::FLAG_WRITE);
   ASSERT_TRUE(file.IsValid());
 
-  const int64 kOffset = 10;
+  const int64_t kOffset = 10;
   EXPECT_EQ(kOffset, file.Seek(base::File::FROM_BEGIN, kOffset));
   EXPECT_EQ(2 * kOffset, file.Seek(base::File::FROM_CURRENT, kOffset));
   EXPECT_EQ(kOffset, file.Seek(base::File::FROM_CURRENT, -kOffset));
diff --git a/base/files/file_util.cc b/base/files/file_util.cc
index 4b6b888..9e35b67 100644
--- a/base/files/file_util.cc
+++ b/base/files/file_util.cc
@@ -19,6 +19,7 @@
 #include "base/strings/string_util.h"
 #include "base/strings/stringprintf.h"
 #include "base/strings/utf_string_conversions.h"
+#include "build/build_config.h"
 
 namespace base {
 
@@ -34,8 +35,8 @@
 
 }  // namespace
 
-int64 ComputeDirectorySize(const FilePath& root_path) {
-  int64 running_size = 0;
+int64_t ComputeDirectorySize(const FilePath& root_path) {
+  int64_t running_size = 0;
   FileEnumerator file_iter(root_path, true, FileEnumerator::FILES);
   while (!file_iter.Next().empty())
     running_size += file_iter.GetInfo().GetSize();
@@ -185,7 +186,7 @@
   return CreateDirectoryAndGetError(full_path, NULL);
 }
 
-bool GetFileSize(const FilePath& file_path, int64* file_size) {
+bool GetFileSize(const FilePath& file_path, int64_t* file_size) {
   File::Info info;
   if (!GetFileInfo(file_path, &info))
     return false;
diff --git a/base/files/file_util.h b/base/files/file_util.h
index 2e53c40..dfc10a3 100644
--- a/base/files/file_util.h
+++ b/base/files/file_util.h
@@ -8,6 +8,19 @@
 #ifndef BASE_FILES_FILE_UTIL_H_
 #define BASE_FILES_FILE_UTIL_H_
 
+#include <stddef.h>
+#include <stdint.h>
+#include <stdio.h>
+
+#include <set>
+#include <string>
+#include <vector>
+
+#include "base/base_export.h"
+#include "base/files/file.h"
+#include "base/files/file_path.h"
+#include "base/memory/scoped_ptr.h"
+#include "base/strings/string16.h"
 #include "build/build_config.h"
 
 #if defined(OS_WIN)
@@ -17,19 +30,6 @@
 #include <unistd.h>
 #endif
 
-#include <stdio.h>
-
-#include <set>
-#include <string>
-#include <vector>
-
-#include "base/base_export.h"
-#include "base/basictypes.h"
-#include "base/files/file.h"
-#include "base/files/file_path.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/strings/string16.h"
-
 #if defined(OS_POSIX)
 #include "base/file_descriptor_posix.h"
 #include "base/logging.h"
@@ -53,7 +53,7 @@
 //
 // This function is implemented using the FileEnumerator class so it is not
 // particularly speedy in any platform.
-BASE_EXPORT int64 ComputeDirectorySize(const FilePath& root_path);
+BASE_EXPORT int64_t ComputeDirectorySize(const FilePath& root_path);
 
 // Deletes the given path, whether it's a file or a directory.
 // If it's a directory, it's perfectly happy to delete all of the
@@ -265,7 +265,7 @@
 BASE_EXPORT bool CreateDirectory(const FilePath& full_path);
 
 // Returns the file size. Returns true on success.
-BASE_EXPORT bool GetFileSize(const FilePath& file_path, int64* file_size);
+BASE_EXPORT bool GetFileSize(const FilePath& file_path, int64_t* file_size);
 
 // Sets |real_path| to |path| with symbolic links and junctions expanded.
 // On windows, make sure the path starts with a lettered drive.
diff --git a/base/files/file_util_mac.mm b/base/files/file_util_mac.mm
index a701bad92..e9c6c65 100644
--- a/base/files/file_util_mac.mm
+++ b/base/files/file_util_mac.mm
@@ -7,7 +7,6 @@
 #include <copyfile.h>
 #import <Foundation/Foundation.h>
 
-#include "base/basictypes.h"
 #include "base/files/file_path.h"
 #include "base/mac/foundation_util.h"
 #include "base/strings/string_util.h"
diff --git a/base/files/file_util_posix.cc b/base/files/file_util_posix.cc
index a38f06d..7e31bfb 100644
--- a/base/files/file_util_posix.cc
+++ b/base/files/file_util_posix.cc
@@ -9,6 +9,7 @@
 #include <fcntl.h>
 #include <libgen.h>
 #include <limits.h>
+#include <stddef.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
@@ -21,16 +22,11 @@
 #include <time.h>
 #include <unistd.h>
 
-#if defined(OS_MACOSX)
-#include <AvailabilityMacros.h>
-#include "base/mac/foundation_util.h"
-#endif
-
-#include "base/basictypes.h"
 #include "base/files/file_enumerator.h"
 #include "base/files/file_path.h"
 #include "base/files/scoped_file.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/memory/scoped_ptr.h"
 #include "base/memory/singleton.h"
 #include "base/path_service.h"
@@ -43,6 +39,12 @@
 #include "base/sys_info.h"
 #include "base/threading/thread_restrictions.h"
 #include "base/time/time.h"
+#include "build/build_config.h"
+
+#if defined(OS_MACOSX)
+#include <AvailabilityMacros.h>
+#include "base/mac/foundation_util.h"
+#endif
 
 #if defined(OS_ANDROID)
 #include "base/android/content_uri_utils.h"
diff --git a/base/files/file_util_proxy.cc b/base/files/file_util_proxy.cc
index 0942e7a..633d162 100644
--- a/base/files/file_util_proxy.cc
+++ b/base/files/file_util_proxy.cc
@@ -8,6 +8,7 @@
 #include "base/bind_helpers.h"
 #include "base/files/file_util.h"
 #include "base/location.h"
+#include "base/macros.h"
 #include "base/task_runner.h"
 #include "base/task_runner_util.h"
 
diff --git a/base/files/file_util_proxy.h b/base/files/file_util_proxy.h
index 80688cfb..db69737 100644
--- a/base/files/file_util_proxy.h
+++ b/base/files/file_util_proxy.h
@@ -9,6 +9,7 @@
 #include "base/callback_forward.h"
 #include "base/files/file.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 
 namespace base {
 
diff --git a/base/files/file_util_unittest.cc b/base/files/file_util_unittest.cc
index aa554731..61ccba4 100644
--- a/base/files/file_util_unittest.cc
+++ b/base/files/file_util_unittest.cc
@@ -2,21 +2,8 @@
 // Use of this source code is governed by a BSD-style license that can be
 // found in the LICENSE file.
 
-#include "build/build_config.h"
-
-#if defined(OS_WIN)
-#include <windows.h>
-#include <shellapi.h>
-#include <shlobj.h>
-#include <tchar.h>
-#include <winioctl.h>
-#endif
-
-#if defined(OS_POSIX)
-#include <errno.h>
-#include <fcntl.h>
-#include <unistd.h>
-#endif
+#include <stddef.h>
+#include <stdint.h>
 
 #include <algorithm>
 #include <fstream>
@@ -30,19 +17,32 @@
 #include "base/files/file_util.h"
 #include "base/files/scoped_file.h"
 #include "base/files/scoped_temp_dir.h"
+#include "base/macros.h"
 #include "base/path_service.h"
 #include "base/strings/string_util.h"
 #include "base/strings/utf_string_conversions.h"
 #include "base/test/test_file_util.h"
 #include "base/threading/platform_thread.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 #include "testing/platform_test.h"
 
 #if defined(OS_WIN)
+#include <windows.h>
+#include <shellapi.h>
+#include <shlobj.h>
+#include <tchar.h>
+#include <winioctl.h>
 #include "base/win/scoped_handle.h"
 #include "base/win/windows_version.h"
 #endif
 
+#if defined(OS_POSIX)
+#include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
+#endif
+
 #if defined(OS_ANDROID)
 #include "base/android/content_uri_utils.h"
 #endif
@@ -250,7 +250,7 @@
   // should return 53 bytes.
   FilePath file_01 = temp_dir_.path().Append(FPL("The file 01.txt"));
   CreateTextFile(file_01, L"12345678901234567890");
-  int64 size_f1 = 0;
+  int64_t size_f1 = 0;
   ASSERT_TRUE(GetFileSize(file_01, &size_f1));
   EXPECT_EQ(20ll, size_f1);
 
@@ -259,7 +259,7 @@
 
   FilePath file_02 = subdir_path.Append(FPL("The file 02.txt"));
   CreateTextFile(file_02, L"123456789012345678901234567890");
-  int64 size_f2 = 0;
+  int64_t size_f2 = 0;
   ASSERT_TRUE(GetFileSize(file_02, &size_f2));
   EXPECT_EQ(30ll, size_f2);
 
@@ -269,7 +269,7 @@
   FilePath file_03 = subsubdir_path.Append(FPL("The file 03.txt"));
   CreateTextFile(file_03, L"123");
 
-  int64 computed_size = ComputeDirectorySize(temp_dir_.path());
+  int64_t computed_size = ComputeDirectorySize(temp_dir_.path());
   EXPECT_EQ(size_f1 + size_f2 + 3, computed_size);
 }
 
@@ -722,7 +722,7 @@
   EXPECT_TRUE(PathExists(file_name));
 
   // Make sure the file is readable.
-  int32 mode = 0;
+  int32_t mode = 0;
   EXPECT_TRUE(GetPosixFilePermissions(file_name, &mode));
   EXPECT_TRUE(mode & FILE_PERMISSION_READ_BY_USER);
 
@@ -2448,7 +2448,7 @@
   data_dir = data_dir.AppendASCII("file_util");
   ASSERT_TRUE(PathExists(data_dir));
   FilePath image_file = data_dir.Append(FILE_PATH_LITERAL("red.png"));
-  int64 image_size;
+  int64_t image_size;
   GetFileSize(image_file, &image_size);
   EXPECT_LT(0, image_size);
 
@@ -2459,7 +2459,7 @@
   EXPECT_TRUE(PathExists(path));
   // The file size may not equal to the input image as MediaStore may convert
   // the image.
-  int64 content_uri_size;
+  int64_t content_uri_size;
   GetFileSize(path, &content_uri_size);
   EXPECT_EQ(image_size, content_uri_size);
 
@@ -2476,7 +2476,7 @@
   EXPECT_TRUE(path.IsContentUri());
   EXPECT_FALSE(PathExists(path));
   // Size should be smaller than 0.
-  int64 size;
+  int64_t size;
   EXPECT_FALSE(GetFileSize(path, &size));
 
   // We should not be able to read the file.
diff --git a/base/files/file_util_win.cc b/base/files/file_util_win.cc
index 2bde7ad..d70454df 100644
--- a/base/files/file_util_win.cc
+++ b/base/files/file_util_win.cc
@@ -9,6 +9,7 @@
 #include <psapi.h>
 #include <shellapi.h>
 #include <shlobj.h>
+#include <stddef.h>
 #include <stdint.h>
 #include <time.h>
 #include <winsock2.h>
@@ -20,6 +21,7 @@
 #include "base/files/file_enumerator.h"
 #include "base/files/file_path.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/metrics/histogram.h"
 #include "base/process/process_handle.h"
 #include "base/rand_util.h"
diff --git a/base/files/file_win.cc b/base/files/file_win.cc
index c2cc3ab..8329672 100644
--- a/base/files/file_win.cc
+++ b/base/files/file_win.cc
@@ -5,6 +5,7 @@
 #include "base/files/file.h"
 
 #include <io.h>
+#include <stdint.h>
 
 #include "base/logging.h"
 #include "base/metrics/sparse_histogram.h"
@@ -39,7 +40,7 @@
   file_.Close();
 }
 
-int64 File::Seek(Whence whence, int64 offset) {
+int64_t File::Seek(Whence whence, int64_t offset) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
 
@@ -53,7 +54,7 @@
   return res.QuadPart;
 }
 
-int File::Read(int64 offset, char* data, int size) {
+int File::Read(int64_t offset, char* data, int size) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
   DCHECK(!async_);
@@ -96,7 +97,7 @@
   return -1;
 }
 
-int File::ReadNoBestEffort(int64 offset, char* data, int size) {
+int File::ReadNoBestEffort(int64_t offset, char* data, int size) {
   // TODO(dbeam): trace this separately?
   return Read(offset, data, size);
 }
@@ -106,7 +107,7 @@
   return ReadAtCurrentPos(data, size);
 }
 
-int File::Write(int64 offset, const char* data, int size) {
+int File::Write(int64_t offset, const char* data, int size) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
   DCHECK(!async_);
@@ -147,7 +148,7 @@
   return WriteAtCurrentPos(data, size);
 }
 
-int64 File::GetLength() {
+int64_t File::GetLength() {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
 
@@ -157,10 +158,10 @@
   if (!::GetFileSizeEx(file_.Get(), &size))
     return -1;
 
-  return static_cast<int64>(size.QuadPart);
+  return static_cast<int64_t>(size.QuadPart);
 }
 
-bool File::SetLength(int64 length) {
+bool File::SetLength(int64_t length) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(IsValid());
 
@@ -309,7 +310,7 @@
   }
 }
 
-void File::DoInitialize(const FilePath& path, uint32 flags) {
+void File::DoInitialize(const FilePath& path, uint32_t flags) {
   ThreadRestrictions::AssertIOAllowed();
   DCHECK(!IsValid());
 
diff --git a/base/files/important_file_writer.cc b/base/files/important_file_writer.cc
index 4af7137b..b429305 100644
--- a/base/files/important_file_writer.cc
+++ b/base/files/important_file_writer.cc
@@ -4,6 +4,8 @@
 
 #include "base/files/important_file_writer.h"
 
+#include <stddef.h>
+#include <stdint.h>
 #include <stdio.h>
 #include <string>
 #include <utility>
@@ -15,6 +17,7 @@
 #include "base/files/file_path.h"
 #include "base/files/file_util.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/metrics/histogram.h"
 #include "base/numerics/safe_conversions.h"
 #include "base/strings/string_number_conversions.h"
@@ -23,6 +26,7 @@
 #include "base/task_runner_util.h"
 #include "base/threading/thread.h"
 #include "base/time/time.h"
+#include "build/build_config.h"
 
 namespace base {
 
diff --git a/base/files/important_file_writer.h b/base/files/important_file_writer.h
index 7c6160a..1b2ad5c 100644
--- a/base/files/important_file_writer.h
+++ b/base/files/important_file_writer.h
@@ -8,9 +8,9 @@
 #include <string>
 
 #include "base/base_export.h"
-#include "base/basictypes.h"
 #include "base/callback.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 #include "base/memory/ref_counted.h"
 #include "base/threading/non_thread_safe.h"
 #include "base/time/time.h"
diff --git a/base/files/important_file_writer_unittest.cc b/base/files/important_file_writer_unittest.cc
index 71900c9..28e6001 100644
--- a/base/files/important_file_writer_unittest.cc
+++ b/base/files/important_file_writer_unittest.cc
@@ -11,6 +11,7 @@
 #include "base/files/scoped_temp_dir.h"
 #include "base/location.h"
 #include "base/logging.h"
+#include "base/macros.h"
 #include "base/run_loop.h"
 #include "base/single_thread_task_runner.h"
 #include "base/thread_task_runner_handle.h"
diff --git a/base/files/memory_mapped_file.cc b/base/files/memory_mapped_file.cc
index 45569e3..0fd9d67 100644
--- a/base/files/memory_mapped_file.cc
+++ b/base/files/memory_mapped_file.cc
@@ -9,6 +9,7 @@
 #include "base/files/file_path.h"
 #include "base/logging.h"
 #include "base/sys_info.h"
+#include "build/build_config.h"
 
 namespace base {
 
diff --git a/base/files/memory_mapped_file.h b/base/files/memory_mapped_file.h
index fec09e97..6362e76 100644
--- a/base/files/memory_mapped_file.h
+++ b/base/files/memory_mapped_file.h
@@ -5,6 +5,9 @@
 #ifndef BASE_FILES_MEMORY_MAPPED_FILE_H_
 #define BASE_FILES_MEMORY_MAPPED_FILE_H_
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include "base/base_export.h"
 #include "base/files/file.h"
 #include "base/macros.h"
diff --git a/base/files/memory_mapped_file_posix.cc b/base/files/memory_mapped_file_posix.cc
index d9a7e90f..1067fdc9 100644
--- a/base/files/memory_mapped_file_posix.cc
+++ b/base/files/memory_mapped_file_posix.cc
@@ -4,12 +4,15 @@
 
 #include "base/files/memory_mapped_file.h"
 
+#include <stddef.h>
+#include <stdint.h>
 #include <sys/mman.h>
 #include <sys/stat.h>
 #include <unistd.h>
 
 #include "base/logging.h"
 #include "base/threading/thread_restrictions.h"
+#include "build/build_config.h"
 
 namespace base {
 
diff --git a/base/files/memory_mapped_file_unittest.cc b/base/files/memory_mapped_file_unittest.cc
index 5c48b48..f75686f 100644
--- a/base/files/memory_mapped_file_unittest.cc
+++ b/base/files/memory_mapped_file_unittest.cc
@@ -4,6 +4,9 @@
 
 #include "base/files/memory_mapped_file.h"
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <utility>
 
 #include "base/files/file_path.h"
diff --git a/base/files/memory_mapped_file_win.cc b/base/files/memory_mapped_file_win.cc
index 4d26d82..5b397eed 100644
--- a/base/files/memory_mapped_file_win.cc
+++ b/base/files/memory_mapped_file_win.cc
@@ -4,6 +4,9 @@
 
 #include "base/files/memory_mapped_file.h"
 
+#include <stddef.h>
+#include <stdint.h>
+
 #include <limits>
 
 #include "base/files/file_path.h"
diff --git a/base/files/scoped_file.cc b/base/files/scoped_file.cc
index 39f064d..8971280 100644
--- a/base/files/scoped_file.cc
+++ b/base/files/scoped_file.cc
@@ -5,6 +5,7 @@
 #include "base/files/scoped_file.h"
 
 #include "base/logging.h"
+#include "build/build_config.h"
 
 #if defined(OS_POSIX)
 #include <unistd.h>
diff --git a/base/files/scoped_temp_dir.h b/base/files/scoped_temp_dir.h
index 5f63e09..b1f2f5b8 100644
--- a/base/files/scoped_temp_dir.h
+++ b/base/files/scoped_temp_dir.h
@@ -17,6 +17,7 @@
 
 #include "base/base_export.h"
 #include "base/files/file_path.h"
+#include "base/macros.h"
 
 namespace base {
 
diff --git a/base/files/scoped_temp_dir_unittest.cc b/base/files/scoped_temp_dir_unittest.cc
index a19f34d..3b2f28e5 100644
--- a/base/files/scoped_temp_dir_unittest.cc
+++ b/base/files/scoped_temp_dir_unittest.cc
@@ -7,6 +7,7 @@
 #include "base/files/file.h"
 #include "base/files/file_util.h"
 #include "base/files/scoped_temp_dir.h"
+#include "build/build_config.h"
 #include "testing/gtest/include/gtest/gtest.h"
 
 namespace base {