Remove base_export.h
This mucked up all the formatting alignment, but I'm going to leave it wrong in
this CL and then globally clang-format in the next one to keep the changes
separate.
Change-Id: I53c836a83d26edcae9b97831844f7a6b350cfd14
Reviewed-on: https://gn-review.googlesource.com/1624
Commit-Queue: Scott Graham <scottmg@chromium.org>
Reviewed-by: Brett Wilson <brettw@chromium.org>
diff --git a/base/files/file.h b/base/files/file.h
index 3f959a4..c554249 100644
--- a/base/files/file.h
+++ b/base/files/file.h
@@ -9,7 +9,6 @@
#include <string>
-#include "base/base_export.h"
#include "base/files/file_path.h"
#include "base/files/platform_file.h"
#include "base/files/scoped_file.h"
@@ -40,7 +39,7 @@
// obvious non-modifying way are marked as const. Any method that forward calls
// to the OS is not considered const, even if there is no apparent change to
// member variables.
-class BASE_EXPORT File {
+class File {
public:
// FLAG_(OPEN|CREATE).* are mutually exclusive. You should specify exactly one
// of the five (possibly combining with other flags) when opening or creating
@@ -118,7 +117,7 @@
// make sure to update all functions that use it in file_util_{win|posix}.cc,
// too, and the ParamTraits<base::File::Info> implementation in
// ipc/ipc_message_utils.cc.
- struct BASE_EXPORT Info {
+ struct Info {
Info();
~Info();
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
diff --git a/base/files/file_enumerator.h b/base/files/file_enumerator.h
index db54301..45ce88b 100644
--- a/base/files/file_enumerator.h
+++ b/base/files/file_enumerator.h
@@ -10,7 +10,6 @@
#include <vector>
-#include "base/base_export.h"
#include "base/containers/stack.h"
#include "base/files/file_path.h"
#include "base/macros.h"
@@ -37,10 +36,10 @@
// FILE_PATH_LITERAL("*.txt"));
// for (base::FilePath name = enum.Next(); !name.empty(); name = enum.Next())
// ...
-class BASE_EXPORT FileEnumerator {
+class FileEnumerator {
public:
// Note: copy & assign supported.
- class BASE_EXPORT FileInfo {
+ class FileInfo {
public:
FileInfo();
~FileInfo();
diff --git a/base/files/file_path.h b/base/files/file_path.h
index be70317..8c153b4 100644
--- a/base/files/file_path.h
+++ b/base/files/file_path.h
@@ -108,7 +108,6 @@
#include <string>
#include <vector>
-#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/macros.h"
#include "base/strings/string16.h"
@@ -140,7 +139,7 @@
// An abstraction to isolate users from the differences between native
// pathnames on different platforms.
-class BASE_EXPORT FilePath {
+class FilePath {
public:
#if defined(OS_WIN)
// On Windows, for Unicode-aware applications, native pathnames are wchar_t
@@ -438,7 +437,7 @@
StringType path_;
};
-BASE_EXPORT std::ostream& operator<<(std::ostream& out,
+std::ostream& operator<<(std::ostream& out,
const FilePath& file_path);
} // namespace base
diff --git a/base/files/file_util.h b/base/files/file_util.h
index d95410a..1401108 100644
--- a/base/files/file_util.h
+++ b/base/files/file_util.h
@@ -21,7 +21,6 @@
#include <unistd.h>
#endif
-#include "base/base_export.h"
#include "base/files/file.h"
#include "base/files/file_path.h"
#include "base/strings/string16.h"
@@ -45,14 +44,14 @@
// Returns an absolute version of a relative path. Returns an empty path on
// error. On POSIX, this function fails if the path does not exist. This
// function can result in I/O so it can be slow.
-BASE_EXPORT FilePath MakeAbsoluteFilePath(const FilePath& input);
+FilePath MakeAbsoluteFilePath(const FilePath& input);
// Returns the total number of bytes used by all the files under |root_path|.
// If the path does not exist the function returns 0.
//
// This function is implemented using the FileEnumerator class so it is not
// particularly speedy in any platform.
-BASE_EXPORT int64_t ComputeDirectorySize(const FilePath& root_path);
+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
@@ -66,7 +65,7 @@
//
// WARNING: USING THIS WITH recursive==true IS EQUIVALENT
// TO "rm -rf", SO USE WITH CAUTION.
-BASE_EXPORT bool DeleteFile(const FilePath& path, bool recursive);
+bool DeleteFile(const FilePath& path, bool recursive);
#if defined(OS_WIN)
// Schedules to delete the given path, whether it's a file or a directory, until
@@ -74,7 +73,7 @@
// Note:
// 1) The file/directory to be deleted should exist in a temp folder.
// 2) The directory to be deleted must be empty.
-BASE_EXPORT bool DeleteFileAfterReboot(const FilePath& path);
+bool DeleteFileAfterReboot(const FilePath& path);
#endif
// Moves the given path, whether it's a file or a directory.
@@ -82,7 +81,7 @@
// on different volumes, this will attempt to copy and delete. Returns
// true for success.
// This function fails if either path contains traversal components ('..').
-BASE_EXPORT bool Move(const FilePath& from_path, const FilePath& to_path);
+bool Move(const FilePath& from_path, const FilePath& to_path);
// Renames file |from_path| to |to_path|. Both paths must be on the same
// volume, or the function will fail. Destination file will be created
@@ -90,7 +89,7 @@
// temporary files. On Windows it preserves attributes of the target file.
// Returns true on success, leaving *error unchanged.
// Returns false on failure and sets *error appropriately, if it is non-NULL.
-BASE_EXPORT bool ReplaceFile(const FilePath& from_path,
+bool ReplaceFile(const FilePath& from_path,
const FilePath& to_path,
File::Error* error);
@@ -114,7 +113,7 @@
// Always 0600.
// - On ChromeOS, |to_path| has user read/write permissions and group/others
// read permissions. i.e. Always 0644.
-BASE_EXPORT bool CopyFile(const FilePath& from_path, const FilePath& to_path);
+bool CopyFile(const FilePath& from_path, const FilePath& to_path);
// Copies the given path, and optionally all subdirectories and their contents
// as well.
@@ -125,34 +124,34 @@
// This function has the same metadata behavior as CopyFile().
//
// If you only need to copy a file use CopyFile, it's faster.
-BASE_EXPORT bool CopyDirectory(const FilePath& from_path,
+bool CopyDirectory(const FilePath& from_path,
const FilePath& to_path,
bool recursive);
// Like CopyDirectory() except trying to overwrite an existing file will not
// work and will return false.
-BASE_EXPORT bool CopyDirectoryExcl(const FilePath& from_path,
+bool CopyDirectoryExcl(const FilePath& from_path,
const FilePath& to_path,
bool recursive);
// Returns true if the given path exists on the local filesystem,
// false otherwise.
-BASE_EXPORT bool PathExists(const FilePath& path);
+bool PathExists(const FilePath& path);
// Returns true if the given path is writable by the user, false otherwise.
-BASE_EXPORT bool PathIsWritable(const FilePath& path);
+bool PathIsWritable(const FilePath& path);
// Returns true if the given path exists and is a directory, false otherwise.
-BASE_EXPORT bool DirectoryExists(const FilePath& path);
+bool DirectoryExists(const FilePath& path);
// Returns true if the contents of the two files given are equal, false
// otherwise. If either file can't be read, returns false.
-BASE_EXPORT bool ContentsEqual(const FilePath& filename1,
+bool ContentsEqual(const FilePath& filename1,
const FilePath& filename2);
// Returns true if the contents of the two text files given are equal, false
// otherwise. This routine treats "\r\n" and "\n" as equivalent.
-BASE_EXPORT bool TextContentsEqual(const FilePath& filename1,
+bool TextContentsEqual(const FilePath& filename1,
const FilePath& filename2);
// Reads the file at |path| into |contents| and returns true on success and
@@ -162,7 +161,7 @@
// file before the error occurred.
// |contents| may be NULL, in which case this function is useful for its side
// effect of priming the disk cache (could be used for unit tests).
-BASE_EXPORT bool ReadFileToString(const FilePath& path, std::string* contents);
+bool ReadFileToString(const FilePath& path, std::string* contents);
// Reads the file at |path| into |contents| and returns true on success and
// false on error. For security reasons, a |path| containing path traversal
@@ -173,7 +172,7 @@
// |max_size|.
// |contents| may be NULL, in which case this function is useful for its side
// effect of priming the disk cache (could be used for unit tests).
-BASE_EXPORT bool ReadFileToStringWithMaxSize(const FilePath& path,
+bool ReadFileToStringWithMaxSize(const FilePath& path,
std::string* contents,
size_t max_size);
@@ -182,12 +181,12 @@
// Read exactly |bytes| bytes from file descriptor |fd|, storing the result
// in |buffer|. This function is protected against EINTR and partial reads.
// Returns true iff |bytes| bytes have been successfully read from |fd|.
-BASE_EXPORT bool ReadFromFD(int fd, char* buffer, size_t bytes);
+bool ReadFromFD(int fd, char* buffer, size_t bytes);
// Performs the same function as CreateAndOpenTemporaryFileInDir(), but returns
// the file-descriptor directly, rather than wrapping it into a FILE. Returns
// -1 on failure.
-BASE_EXPORT int CreateAndOpenFdForTemporaryFileInDir(const FilePath& dir,
+int CreateAndOpenFdForTemporaryFileInDir(const FilePath& dir,
FilePath* path);
#endif // OS_POSIX || OS_FUCHSIA
@@ -196,12 +195,12 @@
// Creates a symbolic link at |symlink| pointing to |target|. Returns
// false on failure.
-BASE_EXPORT bool CreateSymbolicLink(const FilePath& target,
+bool CreateSymbolicLink(const FilePath& target,
const FilePath& symlink);
// Reads the given |symlink| and returns where it points to in |target|.
// Returns false upon failure.
-BASE_EXPORT bool ReadSymbolicLink(const FilePath& symlink, FilePath* target);
+bool ReadSymbolicLink(const FilePath& symlink, FilePath* target);
// Bits and masks of the file permission.
enum FilePermissionBits {
@@ -224,20 +223,20 @@
// Reads the permission of the given |path|, storing the file permission
// bits in |mode|. If |path| is symbolic link, |mode| is the permission of
// a file which the symlink points to.
-BASE_EXPORT bool GetPosixFilePermissions(const FilePath& path, int* mode);
+bool GetPosixFilePermissions(const FilePath& path, int* mode);
// Sets the permission of the given |path|. If |path| is symbolic link, sets
// the permission of a file which the symlink points to.
-BASE_EXPORT bool SetPosixFilePermissions(const FilePath& path, int mode);
+bool SetPosixFilePermissions(const FilePath& path, int mode);
// Returns true iff |executable| can be found in any directory specified by the
// environment variable in |env|.
-BASE_EXPORT bool ExecutableExistsInPath(Environment* env,
+bool ExecutableExistsInPath(Environment* env,
const FilePath::StringType& executable);
#endif // OS_POSIX
// Returns true if the given directory is empty
-BASE_EXPORT bool IsDirectoryEmpty(const FilePath& dir_path);
+bool IsDirectoryEmpty(const FilePath& dir_path);
// Get the temporary directory provided by the system.
//
@@ -245,7 +244,7 @@
// instead of this function. Those variants will ensure that the proper
// permissions are set so that other users on the system can't edit them while
// they're open (which can lead to security issues).
-BASE_EXPORT bool GetTempDir(FilePath* path);
+bool GetTempDir(FilePath* path);
// Get the home directory. This is more complicated than just getenv("HOME")
// as it knows to fall back on getpwent() etc.
@@ -253,37 +252,37 @@
// You should not generally call this directly. Instead use DIR_HOME with the
// path service which will use this function but cache the value.
// Path service may also override DIR_HOME.
-BASE_EXPORT FilePath GetHomeDir();
+FilePath GetHomeDir();
// Creates a temporary file. The full path is placed in |path|, and the
// function returns true if was successful in creating the file. The file will
// be empty and all handles closed after this function returns.
-BASE_EXPORT bool CreateTemporaryFile(FilePath* path);
+bool CreateTemporaryFile(FilePath* path);
// Same as CreateTemporaryFile but the file is created in |dir|.
-BASE_EXPORT bool CreateTemporaryFileInDir(const FilePath& dir,
+bool CreateTemporaryFileInDir(const FilePath& dir,
FilePath* temp_file);
// Create and open a temporary file. File is opened for read/write.
// The full path is placed in |path|.
// Returns a handle to the opened file or NULL if an error occurred.
-BASE_EXPORT FILE* CreateAndOpenTemporaryFile(FilePath* path);
+FILE* CreateAndOpenTemporaryFile(FilePath* path);
// Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|.
-BASE_EXPORT FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir,
+FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir,
FilePath* path);
// Create a new directory. If prefix is provided, the new directory name is in
// the format of prefixyyyy.
// NOTE: prefix is ignored in the POSIX implementation.
// If success, return true and output the full path of the directory created.
-BASE_EXPORT bool CreateNewTempDirectory(const FilePath::StringType& prefix,
+bool CreateNewTempDirectory(const FilePath::StringType& prefix,
FilePath* new_temp_path);
// Create a directory within another directory.
// Extra characters will be appended to |prefix| to ensure that the
// new directory does not have the same name as an existing directory.
-BASE_EXPORT bool CreateTemporaryDirInDir(const FilePath& base_dir,
+bool CreateTemporaryDirInDir(const FilePath& base_dir,
const FilePath::StringType& prefix,
FilePath* new_dir);
@@ -292,14 +291,14 @@
// already exists. The directory is only readable by the current user.
// Returns true on success, leaving *error unchanged.
// Returns false on failure and sets *error appropriately, if it is non-NULL.
-BASE_EXPORT bool CreateDirectoryAndGetError(const FilePath& full_path,
+bool CreateDirectoryAndGetError(const FilePath& full_path,
File::Error* error);
// Backward-compatible convenience method for the above.
-BASE_EXPORT bool CreateDirectory(const FilePath& full_path);
+bool CreateDirectory(const FilePath& full_path);
// Returns the file size. Returns true on success.
-BASE_EXPORT bool GetFileSize(const FilePath& file_path, int64_t* file_size);
+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.
@@ -307,101 +306,101 @@
// a directory or to a nonexistent path. On windows, this function will
// fail if |path| is a junction or symlink that points to an empty file,
// or if |real_path| would be longer than MAX_PATH characters.
-BASE_EXPORT bool NormalizeFilePath(const FilePath& path, FilePath* real_path);
+bool NormalizeFilePath(const FilePath& path, FilePath* real_path);
#if defined(OS_WIN)
// Given a path in NT native form ("\Device\HarddiskVolumeXX\..."),
// return in |drive_letter_path| the equivalent path that starts with
// a drive letter ("C:\..."). Return false if no such path exists.
-BASE_EXPORT bool DevicePathToDriveLetterPath(const FilePath& device_path,
+bool DevicePathToDriveLetterPath(const FilePath& device_path,
FilePath* drive_letter_path);
// Given an existing file in |path|, set |real_path| to the path
// in native NT format, of the form "\Device\HarddiskVolumeXX\..".
// Returns false if the path can not be found. Empty files cannot
// be resolved with this function.
-BASE_EXPORT bool NormalizeToNativeFilePath(const FilePath& path,
+bool NormalizeToNativeFilePath(const FilePath& path,
FilePath* nt_path);
#endif
// This function will return if the given file is a symlink or not.
-BASE_EXPORT bool IsLink(const FilePath& file_path);
+bool IsLink(const FilePath& file_path);
// Returns information about the given file path.
-BASE_EXPORT bool GetFileInfo(const FilePath& file_path, File::Info* info);
+bool GetFileInfo(const FilePath& file_path, File::Info* info);
// Sets the time of the last access and the time of the last modification.
-BASE_EXPORT bool TouchFile(const FilePath& path,
+bool TouchFile(const FilePath& path,
const Time& last_accessed,
const Time& last_modified);
// Wrapper for fopen-like calls. Returns non-NULL FILE* on success. The
// underlying file descriptor (POSIX) or handle (Windows) is unconditionally
// configured to not be propagated to child processes.
-BASE_EXPORT FILE* OpenFile(const FilePath& filename, const char* mode);
+FILE* OpenFile(const FilePath& filename, const char* mode);
// Closes file opened by OpenFile. Returns true on success.
-BASE_EXPORT bool CloseFile(FILE* file);
+bool CloseFile(FILE* file);
// Associates a standard FILE stream with an existing File. Note that this
// functions take ownership of the existing File.
-BASE_EXPORT FILE* FileToFILE(File file, const char* mode);
+FILE* FileToFILE(File file, const char* mode);
// Truncates an open file to end at the location of the current file pointer.
// This is a cross-platform analog to Windows' SetEndOfFile() function.
-BASE_EXPORT bool TruncateFile(FILE* file);
+bool TruncateFile(FILE* file);
// Reads at most the given number of bytes from the file into the buffer.
// Returns the number of read bytes, or -1 on error.
-BASE_EXPORT int ReadFile(const FilePath& filename, char* data, int max_size);
+int ReadFile(const FilePath& filename, char* data, int max_size);
// Writes the given buffer into the file, overwriting any data that was
// previously there. Returns the number of bytes written, or -1 on error.
-BASE_EXPORT int WriteFile(const FilePath& filename, const char* data,
+int WriteFile(const FilePath& filename, const char* data,
int size);
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
// Appends |data| to |fd|. Does not close |fd| when done. Returns true iff
// |size| bytes of |data| were written to |fd|.
-BASE_EXPORT bool WriteFileDescriptor(const int fd, const char* data, int size);
+bool WriteFileDescriptor(const int fd, const char* data, int size);
#endif
// Appends |data| to |filename|. Returns true iff |size| bytes of |data| were
// written to |filename|.
-BASE_EXPORT bool AppendToFile(const FilePath& filename,
+bool AppendToFile(const FilePath& filename,
const char* data,
int size);
// Gets the current working directory for the process.
-BASE_EXPORT bool GetCurrentDirectory(FilePath* path);
+bool GetCurrentDirectory(FilePath* path);
// Sets the current working directory for the process.
-BASE_EXPORT bool SetCurrentDirectory(const FilePath& path);
+bool SetCurrentDirectory(const FilePath& path);
// Attempts to find a number that can be appended to the |path| to make it
// unique. If |path| does not exist, 0 is returned. If it fails to find such
// a number, -1 is returned. If |suffix| is not empty, also checks the
// existence of it with the given suffix.
-BASE_EXPORT int GetUniquePathNumber(const FilePath& path,
+int GetUniquePathNumber(const FilePath& path,
const FilePath::StringType& suffix);
// Sets the given |fd| to non-blocking mode.
// Returns true if it was able to set it in the non-blocking mode, otherwise
// false.
-BASE_EXPORT bool SetNonBlocking(int fd);
+bool SetNonBlocking(int fd);
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
// Creates a non-blocking, close-on-exec pipe.
// This creates a non-blocking pipe that is not intended to be shared with any
// child process. This will be done atomically if the operating system supports
// it. Returns true if it was able to create the pipe, otherwise false.
-BASE_EXPORT bool CreateLocalNonBlockingPipe(int fds[2]);
+bool CreateLocalNonBlockingPipe(int fds[2]);
// Sets the given |fd| to close-on-exec mode.
// Returns true if it was able to set it in the close-on-exec mode, otherwise
// false.
-BASE_EXPORT bool SetCloseOnExec(int fd);
+bool SetCloseOnExec(int fd);
// Test that |path| can only be changed by a given user and members of
// a given set of groups.
@@ -414,7 +413,7 @@
// * Are not symbolic links.
// This is useful for checking that a config file is administrator-controlled.
// |base| must contain |path|.
-BASE_EXPORT bool VerifyPathControlledByUser(const base::FilePath& base,
+bool VerifyPathControlledByUser(const base::FilePath& base,
const base::FilePath& path,
uid_t owner_uid,
const std::set<gid_t>& group_gids);
@@ -428,12 +427,12 @@
// the filesystem, are owned by the superuser, controlled by the group
// "admin", are not writable by all users, and contain no symbolic links.
// Will return false if |path| does not exist.
-BASE_EXPORT bool VerifyPathControlledByAdmin(const base::FilePath& path);
+bool VerifyPathControlledByAdmin(const base::FilePath& path);
#endif // defined(OS_MACOSX) && !defined(OS_IOS)
// Returns the maximum length of path component on the volume containing
// the directory |path|, in the number of FilePath::CharType, or -1 on failure.
-BASE_EXPORT int GetMaximumPathComponentLength(const base::FilePath& path);
+int GetMaximumPathComponentLength(const base::FilePath& path);
#if defined(OS_LINUX) || defined(OS_AIX)
// Broad categories of file systems as returned by statfs() on Linux.
@@ -452,7 +451,7 @@
// Attempts determine the FileSystemType for |path|.
// Returns false if |path| doesn't exist.
-BASE_EXPORT bool GetFileSystemType(const FilePath& path, FileSystemType* type);
+bool GetFileSystemType(const FilePath& path, FileSystemType* type);
#endif
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
@@ -461,7 +460,7 @@
// depends on how /dev/shmem was mounted. As a result, you must supply whether
// you intend to create executable shmem segments so this function can find
// an appropriate location.
-BASE_EXPORT bool GetShmemTempDir(bool executable, FilePath* path);
+bool GetShmemTempDir(bool executable, FilePath* path);
#endif
// Internal --------------------------------------------------------------------
@@ -470,7 +469,7 @@
// Same as Move but allows paths with traversal components.
// Use only with extreme care.
-BASE_EXPORT bool MoveUnsafe(const FilePath& from_path,
+bool MoveUnsafe(const FilePath& from_path,
const FilePath& to_path);
#if defined(OS_WIN)
@@ -478,7 +477,7 @@
// Returns true if all operations succeed.
// This function simulates Move(), but unlike Move() it works across volumes.
// This function is not transactional.
-BASE_EXPORT bool CopyAndDeleteDirectory(const FilePath& from_path,
+bool CopyAndDeleteDirectory(const FilePath& from_path,
const FilePath& to_path);
#endif // defined(OS_WIN)
diff --git a/base/files/scoped_file.h b/base/files/scoped_file.h
index ee8ed8b..c1a2988 100644
--- a/base/files/scoped_file.h
+++ b/base/files/scoped_file.h
@@ -9,7 +9,6 @@
#include <memory>
-#include "base/base_export.h"
#include "base/logging.h"
#include "base/scoped_generic.h"
#include "build_config.h"
@@ -19,7 +18,7 @@
namespace internal {
#if defined(OS_POSIX) || defined(OS_FUCHSIA)
-struct BASE_EXPORT ScopedFDCloseTraits {
+struct ScopedFDCloseTraits {
static int InvalidValue() {
return -1;
}
diff --git a/base/files/scoped_temp_dir.h b/base/files/scoped_temp_dir.h
index 872f6f8..4ddb690 100644
--- a/base/files/scoped_temp_dir.h
+++ b/base/files/scoped_temp_dir.h
@@ -17,13 +17,12 @@
// (CreateUniqueTempDir, CreateUniqueTempDirUnderPath, and Set) must have
// intervening calls to Delete or Take, or the calls will fail.
-#include "base/base_export.h"
#include "base/files/file_path.h"
#include "base/macros.h"
namespace base {
-class BASE_EXPORT ScopedTempDir {
+class ScopedTempDir {
public:
// No directory is owned/created initially.
ScopedTempDir();