diff options
-rw-r--r-- | base/cpu.h | 8 | ||||
-rw-r--r-- | base/file_path.h | 5 | ||||
-rw-r--r-- | base/file_util.h | 175 | ||||
-rw-r--r-- | base/file_util_deprecated.h | 23 | ||||
-rw-r--r-- | base/file_version_info.h | 8 | ||||
-rw-r--r-- | base/file_version_info_win.h | 5 | ||||
-rw-r--r-- | base/logging.h | 48 | ||||
-rw-r--r-- | base/path_service.h | 8 | ||||
-rw-r--r-- | base/pickle.h | 3 | ||||
-rw-r--r-- | base/platform_file.h | 39 | ||||
-rw-r--r-- | base/scoped_temp_dir.h | 5 | ||||
-rw-r--r-- | base/shared_memory.h | 5 | ||||
-rw-r--r-- | base/synchronization/lock_impl.h | 3 | ||||
-rw-r--r-- | base/threading/non_thread_safe.h | 4 | ||||
-rw-r--r-- | base/threading/non_thread_safe_impl.h | 3 | ||||
-rw-r--r-- | base/utf_offset_string_conversions.h | 27 | ||||
-rw-r--r-- | base/win/windows_version.h | 12 |
17 files changed, 206 insertions, 175 deletions
@@ -1,4 +1,4 @@ -// Copyright (c) 2006-2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,14 +6,14 @@ #define BASE_CPU_H_ #pragma once -#include "build/build_config.h" - #include <string> +#include "base/base_api.h" + namespace base { // Query information about the processor. -class CPU { +class BASE_API CPU { public: // Constructor CPU(); diff --git a/base/file_path.h b/base/file_path.h index 42c1877..8ec66a2 100644 --- a/base/file_path.h +++ b/base/file_path.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -103,6 +103,7 @@ #include <string> #include <vector> +#include "base/base_api.h" #include "base/basictypes.h" #include "base/compiler_specific.h" #include "base/hash_tables.h" @@ -121,7 +122,7 @@ class Pickle; // An abstraction to isolate users from the differences between native // pathnames on different platforms. -class FilePath { +class BASE_API FilePath { public: #if defined(OS_POSIX) // On most platforms, native pathnames are char arrays, and the encoding diff --git a/base/file_util.h b/base/file_util.h index 481c642..77ccf2b 100644 --- a/base/file_util.h +++ b/base/file_util.h @@ -26,6 +26,7 @@ #include <string> #include <vector> +#include "base/base_api.h" #include "base/basictypes.h" #include "base/file_path.h" #include "base/platform_file.h" @@ -48,19 +49,19 @@ namespace file_util { // Functions that operate purely on a path string w/o touching the filesystem: // Returns true if the given path ends with a path separator character. -bool EndsWithSeparator(const FilePath& path); +BASE_API bool EndsWithSeparator(const FilePath& path); // Makes sure that |path| ends with a separator IFF path is a directory that // exists. Returns true if |path| is an existing directory, false otherwise. -bool EnsureEndsWithSeparator(FilePath* path); +BASE_API bool EnsureEndsWithSeparator(FilePath* path); // Convert provided relative path into an absolute path. Returns false on // error. On POSIX, this function fails if the path does not exist. -bool AbsolutePath(FilePath* path); +BASE_API bool AbsolutePath(FilePath* path); // Returns true if |parent| contains |child|. Both paths are converted to // absolute paths before doing the comparison. -bool ContainsPath(const FilePath& parent, const FilePath& child); +BASE_API bool ContainsPath(const FilePath& parent, const FilePath& child); //----------------------------------------------------------------------------- // Functions that involve filesystem access or modification: @@ -73,15 +74,15 @@ bool ContainsPath(const FilePath& parent, const FilePath& child); // timestmap of file creation time. If you need to avoid such // mis-detection perfectly, you should wait one second before // obtaining |file_time|. -int CountFilesCreatedAfter(const FilePath& path, - const base::Time& file_time); +BASE_API int CountFilesCreatedAfter(const FilePath& path, + const base::Time& file_time); // 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. -int64 ComputeDirectorySize(const FilePath& root_path); +BASE_API int64 ComputeDirectorySize(const FilePath& root_path); // Returns the total number of bytes used by all files matching the provided // |pattern|, on this |directory| (without recursion). If the path does not @@ -89,8 +90,8 @@ int64 ComputeDirectorySize(const FilePath& root_path); // // This function is implemented using the FileEnumerator class so it is not // particularly speedy in any platform. -int64 ComputeFilesSize(const FilePath& directory, - const FilePath::StringType& pattern); +BASE_API int64 ComputeFilesSize(const FilePath& directory, + const FilePath::StringType& pattern); // 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 @@ -100,7 +101,7 @@ int64 ComputeFilesSize(const FilePath& directory, // // WARNING: USING THIS WITH recursive==true IS EQUIVALENT // TO "rm -rf", SO USE WITH CAUTION. -bool Delete(const FilePath& path, bool recursive); +BASE_API bool Delete(const FilePath& path, bool recursive); #if defined(OS_WIN) // Schedules to delete the given path, whether it's a file or a directory, until @@ -108,24 +109,24 @@ bool Delete(const FilePath& path, bool recursive); // Note: // 1) The file/directory to be deleted should exist in a temp folder. // 2) The directory to be deleted must be empty. -bool DeleteAfterReboot(const FilePath& path); +BASE_API bool DeleteAfterReboot(const FilePath& path); #endif // Moves the given path, whether it's a file or a directory. // If a simple rename is not possible, such as in the case where the paths are // on different volumes, this will attempt to copy and delete. Returns // true for success. -bool Move(const FilePath& from_path, const FilePath& to_path); +BASE_API 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 // if it doesn't exist. Prefer this function over Move when dealing with // temporary files. On Windows it preserves attributes of the target file. // Returns true on success. -bool ReplaceFile(const FilePath& from_path, const FilePath& to_path); +BASE_API bool ReplaceFile(const FilePath& from_path, const FilePath& to_path); // Copies a single file. Use CopyDirectory to copy directories. -bool CopyFile(const FilePath& from_path, const FilePath& to_path); +BASE_API bool CopyFile(const FilePath& from_path, const FilePath& to_path); // Copies the given path, and optionally all subdirectories and their contents // as well. @@ -134,45 +135,46 @@ bool CopyFile(const FilePath& from_path, const FilePath& to_path); // Don't use wildcards on the names, it may stop working without notice. // // If you only need to copy a file use CopyFile, it's faster. -bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, - bool recursive); +BASE_API bool CopyDirectory(const FilePath& from_path, const FilePath& to_path, + bool recursive); // Returns true if the given path exists on the local filesystem, // false otherwise. -bool PathExists(const FilePath& path); +BASE_API bool PathExists(const FilePath& path); // Returns true if the given path is writable by the user, false otherwise. -bool PathIsWritable(const FilePath& path); +BASE_API bool PathIsWritable(const FilePath& path); // Returns true if the given path exists and is a directory, false otherwise. -bool DirectoryExists(const FilePath& path); +BASE_API bool DirectoryExists(const FilePath& path); #if defined(OS_WIN) // Gets the creation time of the given file (expressed in the local timezone), // and returns it via the creation_time parameter. Returns true if successful, // false otherwise. -bool GetFileCreationLocalTime(const std::wstring& filename, - LPSYSTEMTIME creation_time); +BASE_API bool GetFileCreationLocalTime(const std::wstring& filename, + LPSYSTEMTIME creation_time); // Same as above, but takes a previously-opened file handle instead of a name. -bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle, - LPSYSTEMTIME creation_time); +BASE_API bool GetFileCreationLocalTimeFromHandle(HANDLE file_handle, + LPSYSTEMTIME creation_time); #endif // defined(OS_WIN) // Returns true if the contents of the two files given are equal, false // otherwise. If either file can't be read, returns false. -bool ContentsEqual(const FilePath& filename1, - const FilePath& filename2); +BASE_API 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. -bool TextContentsEqual(const FilePath& filename1, const FilePath& filename2); +BASE_API bool TextContentsEqual(const FilePath& filename1, + const FilePath& filename2); // Read the file at |path| into |contents|, returning true on success. // |contents| may be NULL, in which case this function is useful for its // side effect of priming the disk cache. // Useful for unit tests. -bool ReadFileToString(const FilePath& path, std::string* contents); +BASE_API bool ReadFileToString(const FilePath& path, std::string* contents); #if defined(OS_POSIX) // Read exactly |bytes| bytes from file descriptor |fd|, storing the result @@ -194,7 +196,7 @@ bool ReadSymbolicLink(const FilePath& symlink, FilePath* target); // This methods tries to resolve a shortcut .LNK file. If the |path| is valid // returns true and puts the target into the |path|, otherwise returns // false leaving the path as it is. -bool ResolveShortcut(FilePath* path); +BASE_API bool ResolveShortcut(FilePath* path); // Create a Windows shortcut (.LNK file) // This method creates a shortcut link using the information given. Ensure @@ -205,10 +207,14 @@ bool ResolveShortcut(FilePath* path); // The 'icon' can specify a dll or exe in which case the icon index is the // resource id. 'app_id' is the app model id for the shortcut on Win7. // Note that if the shortcut exists it will overwrite it. -bool CreateShortcutLink(const wchar_t *source, const wchar_t *destination, - const wchar_t *working_dir, const wchar_t *arguments, - const wchar_t *description, const wchar_t *icon, - int icon_index, const wchar_t* app_id); +BASE_API bool CreateShortcutLink(const wchar_t *source, + const wchar_t *destination, + const wchar_t *working_dir, + const wchar_t *arguments, + const wchar_t *description, + const wchar_t *icon, + int icon_index, + const wchar_t* app_id); // Update a Windows shortcut (.LNK file). This method assumes the shortcut // link already exists (otherwise false is returned). Ensure you have @@ -217,86 +223,92 @@ bool CreateShortcutLink(const wchar_t *source, const wchar_t *destination, // is NULL no changes are made to the shortcut). 'destination' is the link // file to be updated. 'app_id' is the app model id for the shortcut on Win7. // For best results pass the filename with the .lnk extension. -bool UpdateShortcutLink(const wchar_t *source, const wchar_t *destination, - const wchar_t *working_dir, const wchar_t *arguments, - const wchar_t *description, const wchar_t *icon, - int icon_index, const wchar_t* app_id); +BASE_API bool UpdateShortcutLink(const wchar_t *source, + const wchar_t *destination, + const wchar_t *working_dir, + const wchar_t *arguments, + const wchar_t *description, + const wchar_t *icon, + int icon_index, + const wchar_t* app_id); // Pins a shortcut to the Windows 7 taskbar. The shortcut file must already // exist and be a shortcut that points to an executable. -bool TaskbarPinShortcutLink(const wchar_t* shortcut); +BASE_API bool TaskbarPinShortcutLink(const wchar_t* shortcut); // Unpins a shortcut from the Windows 7 taskbar. The shortcut must exist and // already be pinned to the taskbar. -bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); +BASE_API bool TaskbarUnpinShortcutLink(const wchar_t* shortcut); // Copy from_path to to_path recursively and then delete from_path recursively. // Returns true if all operations succeed. // This function simulates Move(), but unlike Move() it works across volumes. // This fuction is not transactional. -bool CopyAndDeleteDirectory(const FilePath& from_path, - const FilePath& to_path); +BASE_API bool CopyAndDeleteDirectory(const FilePath& from_path, + const FilePath& to_path); #endif // defined(OS_WIN) // Return true if the given directory is empty -bool IsDirectoryEmpty(const FilePath& dir_path); +BASE_API bool IsDirectoryEmpty(const FilePath& dir_path); // Get the temporary directory provided by the system. // WARNING: DON'T USE THIS. If you want to create a temporary file, use one of // the functions below. -bool GetTempDir(FilePath* path); +BASE_API bool GetTempDir(FilePath* path); // Get a temporary directory for shared memory files. // Only useful on POSIX; redirects to GetTempDir() on Windows. -bool GetShmemTempDir(FilePath* path); +BASE_API bool GetShmemTempDir(FilePath* path); // Get the home directory. This is more complicated than just getenv("HOME") // as it knows to fall back on getpwent() etc. -FilePath GetHomeDir(); +BASE_API 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. -bool CreateTemporaryFile(FilePath* path); +BASE_API bool CreateTemporaryFile(FilePath* path); // Same as CreateTemporaryFile but the file is created in |dir|. -bool CreateTemporaryFileInDir(const FilePath& dir, FilePath* temp_file); +BASE_API 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 occured. -FILE* CreateAndOpenTemporaryFile(FilePath* path); +BASE_API FILE* CreateAndOpenTemporaryFile(FilePath* path); // Like above but for shmem files. Only useful for POSIX. -FILE* CreateAndOpenTemporaryShmemFile(FilePath* path); +BASE_API FILE* CreateAndOpenTemporaryShmemFile(FilePath* path); // Similar to CreateAndOpenTemporaryFile, but the file is created in |dir|. -FILE* CreateAndOpenTemporaryFileInDir(const FilePath& dir, FilePath* path); +BASE_API 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. -bool CreateNewTempDirectory(const FilePath::StringType& prefix, - FilePath* new_temp_path); +BASE_API 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. -bool CreateTemporaryDirInDir(const FilePath& base_dir, - const FilePath::StringType& prefix, - FilePath* new_dir); +BASE_API bool CreateTemporaryDirInDir(const FilePath& base_dir, + const FilePath::StringType& prefix, + FilePath* new_dir); // Creates a directory, as well as creating any parent directories, if they // don't exist. Returns 'true' on successful creation, or if the directory // already exists. The directory is only readable by the current user. -bool CreateDirectory(const FilePath& full_path); +BASE_API bool CreateDirectory(const FilePath& full_path); // Returns the file size. Returns true on success. -bool GetFileSize(const FilePath& file_path, int64* file_size); +BASE_API bool GetFileSize(const FilePath& file_path, int64* file_size); // Returns true if the given path's base name is ".". -bool IsDot(const FilePath& path); +BASE_API bool IsDot(const FilePath& path); // Returns true if the given path's base name is "..". -bool IsDotDot(const FilePath& path); +BASE_API bool IsDotDot(const FilePath& path); // Sets |real_path| to |path| with symbolic links and junctions expanded. // On windows, make sure the path starts with a lettered drive. @@ -304,27 +316,29 @@ bool IsDotDot(const FilePath& path); // 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. -bool NormalizeFilePath(const FilePath& path, FilePath* real_path); +BASE_API bool NormalizeFilePath(const FilePath& path, FilePath* real_path); #if defined(OS_WIN) // Given an existing file in |path|, it returns in |real_path| the path // in the native NT format, of the form "\Device\HarddiskVolumeXX\..". // Returns false it it fails. Empty files cannot be resolved with this // function. -bool NormalizeToNativeFilePath(const FilePath& path, FilePath* nt_path); +BASE_API bool NormalizeToNativeFilePath(const FilePath& path, + FilePath* nt_path); #endif // Returns information about the given file path. -bool GetFileInfo(const FilePath& file_path, base::PlatformFileInfo* info); +BASE_API bool GetFileInfo(const FilePath& file_path, + base::PlatformFileInfo* info); // Sets the time of the last access and the time of the last modification. -bool TouchFile(const FilePath& path, - const base::Time& last_accessed, - const base::Time& last_modified); +BASE_API bool TouchFile(const FilePath& path, + const base::Time& last_accessed, + const base::Time& last_modified); // Set the time of the last modification. Useful for unit tests. -bool SetLastModifiedTime(const FilePath& path, - const base::Time& last_modified); +BASE_API bool SetLastModifiedTime(const FilePath& path, + const base::Time& last_modified); #if defined(OS_POSIX) // Store inode number of |path| in |inode|. Return true on success. @@ -332,32 +346,32 @@ bool GetInode(const FilePath& path, ino_t* inode); #endif // Wrapper for fopen-like calls. Returns non-NULL FILE* on success. -FILE* OpenFile(const FilePath& filename, const char* mode); +BASE_API FILE* OpenFile(const FilePath& filename, const char* mode); // Closes file opened by OpenFile. Returns true on success. -bool CloseFile(FILE* file); +BASE_API bool CloseFile(FILE* file); // Truncates an open file to end at the location of the current file pointer. // This is a cross-platform analog to Windows' SetEndOfFile() function. -bool TruncateFile(FILE* file); +BASE_API bool TruncateFile(FILE* file); // Reads the given number of bytes from the file into the buffer. Returns // the number of read bytes, or -1 on error. -int ReadFile(const FilePath& filename, char* data, int size); +BASE_API int ReadFile(const FilePath& filename, char* data, int 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. -int WriteFile(const FilePath& filename, const char* data, int size); +BASE_API int WriteFile(const FilePath& filename, const char* data, int size); #if defined(OS_POSIX) // Append the data to |fd|. Does not close |fd| when done. int WriteFileDescriptor(const int fd, const char* data, int size); #endif // Gets the current working directory for the process. -bool GetCurrentDirectory(FilePath* path); +BASE_API bool GetCurrentDirectory(FilePath* path); // Sets the current working directory for the process. -bool SetCurrentDirectory(const FilePath& path); +BASE_API bool SetCurrentDirectory(const FilePath& path); // A class to handle auto-closing of FILE*'s. class ScopedFILEClose { @@ -391,7 +405,7 @@ typedef scoped_ptr_malloc<int, ScopedFDClose> ScopedFD; // // DO NOT USE FROM THE MAIN THREAD of your application unless it is a test // program where latency does not matter. This class is blocking. -class FileEnumerator { +class BASE_API FileEnumerator { public: #if defined(OS_WIN) typedef WIN32_FIND_DATA FindInfo; @@ -490,7 +504,7 @@ class FileEnumerator { DISALLOW_COPY_AND_ASSIGN(FileEnumerator); }; -class MemoryMappedFile { +class BASE_API MemoryMappedFile { public: // The default constructor sets all members to invalid/null values. MemoryMappedFile(); @@ -545,13 +559,14 @@ class MemoryMappedFile { // Renames a file using the SHFileOperation API to ensure that the target file // gets the correct default security descriptor in the new path. -bool RenameFileAndResetSecurityDescriptor( +BASE_API bool RenameFileAndResetSecurityDescriptor( const FilePath& source_file_path, const FilePath& target_file_path); // Returns whether the file has been modified since a particular date. -bool HasFileBeenModifiedSince(const FileEnumerator::FindInfo& find_info, - const base::Time& cutoff_time); +BASE_API bool HasFileBeenModifiedSince( + const FileEnumerator::FindInfo& find_info, + const base::Time& cutoff_time); #ifdef UNIT_TEST @@ -611,8 +626,8 @@ inline bool MakeFileUnreadable(const FilePath& path) { // is passed in. If it is 0 then the whole file is paged in. The step size // which indicates the number of bytes to skip after every page touched is // also passed in. -bool PreReadImage(const wchar_t* file_path, size_t size_to_read, - size_t step_size); +bool BASE_API PreReadImage(const wchar_t* file_path, size_t size_to_read, + size_t step_size); #endif // OS_WIN #if defined(OS_LINUX) diff --git a/base/file_util_deprecated.h b/base/file_util_deprecated.h index dac4b45..d24e54d 100644 --- a/base/file_util_deprecated.h +++ b/base/file_util_deprecated.h @@ -14,6 +14,7 @@ #define BASE_FILE_UTIL_DEPRECATED_H_ #pragma once +#include "base/base_api.h" #include "build/build_config.h" // We've successfully deprecated all of these functions on non-Windows @@ -24,22 +25,24 @@ namespace file_util { // Use the FilePath versions instead. -FILE* OpenFile(const std::string& filename, const char* mode); -FILE* OpenFile(const std::wstring& filename, const char* mode); +BASE_API FILE* OpenFile(const std::string& filename, const char* mode); +BASE_API FILE* OpenFile(const std::wstring& filename, const char* mode); // Appends new_ending to path, adding a separator between the two if necessary. -void AppendToPath(std::wstring* path, const std::wstring& new_ending); +BASE_API void AppendToPath(std::wstring* path, const std::wstring& new_ending); // Use FilePath::Extension instead. -FilePath::StringType GetFileExtensionFromPath(const FilePath& path); -std::wstring GetFileExtensionFromPath(const std::wstring& path); +BASE_API FilePath::StringType GetFileExtensionFromPath(const FilePath& path); +BASE_API std::wstring GetFileExtensionFromPath(const std::wstring& path); // Use version that takes a FilePath. -bool Delete(const std::wstring& path, bool recursive); -bool CopyDirectory(const std::wstring& from_path, const std::wstring& to_path, - bool recursive); -int ReadFile(const std::wstring& filename, char* data, int size); -int WriteFile(const std::wstring& filename, const char* data, int size); +BASE_API bool Delete(const std::wstring& path, bool recursive); +BASE_API bool CopyDirectory(const std::wstring& from_path, + const std::wstring& to_path, + bool recursive); +BASE_API int ReadFile(const std::wstring& filename, char* data, int size); +BASE_API int WriteFile(const std::wstring& filename, + const char* data, int size); } diff --git a/base/file_version_info.h b/base/file_version_info.h index 481e88d..dca4148 100644 --- a/base/file_version_info.h +++ b/base/file_version_info.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,11 +6,11 @@ #define BASE_FILE_VERSION_INFO_H__ #pragma once -#include "build/build_config.h" - #include <string> +#include "base/base_api.h" #include "base/string16.h" +#include "build/build_config.h" class FilePath; @@ -24,7 +24,7 @@ class FilePath; // version returns values from the Info.plist as appropriate. TODO(avi): make // this a less-obvious Windows-ism. -class FileVersionInfo { +class BASE_API FileVersionInfo { public: virtual ~FileVersionInfo() {} #if defined(OS_WIN) || defined(OS_MACOSX) diff --git a/base/file_version_info_win.h b/base/file_version_info_win.h index 4a49314..fabc1c9 100644 --- a/base/file_version_info_win.h +++ b/base/file_version_info_win.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include <string> +#include "base/base_api.h" #include "base/basictypes.h" #include "base/file_version_info.h" #include "base/scoped_ptr.h" @@ -15,7 +16,7 @@ struct tagVS_FIXEDFILEINFO; typedef tagVS_FIXEDFILEINFO VS_FIXEDFILEINFO; -class FileVersionInfoWin : public FileVersionInfo { +class BASE_API FileVersionInfoWin : public FileVersionInfo { public: FileVersionInfoWin(void* data, int language, int code_page); ~FileVersionInfoWin(); diff --git a/base/logging.h b/base/logging.h index baf8eb6..7721a93 100644 --- a/base/logging.h +++ b/base/logging.h @@ -10,7 +10,9 @@ #include <cstring> #include <sstream> +#include "base/base_api.h" #include "base/basictypes.h" +#include "build/build_config.h" // // Optional message capabilities @@ -190,11 +192,11 @@ typedef char PathChar; // Implementation of the InitLogging() method declared below. We use a // more-specific name so we can #define it above without affecting other code // that has named stuff "InitLogging". -bool BaseInitLoggingImpl(const PathChar* log_file, - LoggingDestination logging_dest, - LogLockingState lock_log, - OldFileDeletionState delete_old, - DcheckState dcheck_state); +BASE_API bool BaseInitLoggingImpl(const PathChar* log_file, + LoggingDestination logging_dest, + LogLockingState lock_log, + OldFileDeletionState delete_old, + DcheckState dcheck_state); // Sets the log file name and other global logging state. Calling this function // is recommended, and is normally done at the beginning of application init. @@ -221,19 +223,19 @@ inline bool InitLogging(const PathChar* log_file, // up to level INFO) if this function is not called. // Note that log messages for VLOG(x) are logged at level -x, so setting // the min log level to negative values enables verbose logging. -void SetMinLogLevel(int level); +BASE_API void SetMinLogLevel(int level); // Gets the current log level. -int GetMinLogLevel(); +BASE_API int GetMinLogLevel(); // Gets the VLOG default verbosity level. -int GetVlogVerbosity(); +BASE_API int GetVlogVerbosity(); // Gets the current vlog level for the given file (usually taken from // __FILE__). // Note that |N| is the size *with* the null terminator. -int GetVlogLevelHelper(const char* file_start, size_t N); +BASE_API int GetVlogLevelHelper(const char* file_start, size_t N); template <size_t N> int GetVlogLevel(const char (&file)[N]) { @@ -244,27 +246,27 @@ int GetVlogLevel(const char (&file)[N]) { // process and thread IDs default to off, the timestamp defaults to on. // If this function is not called, logging defaults to writing the timestamp // only. -void SetLogItems(bool enable_process_id, bool enable_thread_id, - bool enable_timestamp, bool enable_tickcount); +BASE_API void SetLogItems(bool enable_process_id, bool enable_thread_id, + bool enable_timestamp, bool enable_tickcount); // Sets whether or not you'd like to see fatal debug messages popped up in // a dialog box or not. // Dialogs are not shown by default. -void SetShowErrorDialogs(bool enable_dialogs); +BASE_API void SetShowErrorDialogs(bool enable_dialogs); // Sets the Log Assert Handler that will be used to notify of check failures. // The default handler shows a dialog box and then terminate the process, // however clients can use this function to override with their own handling // (e.g. a silent one for Unit Tests) typedef void (*LogAssertHandlerFunction)(const std::string& str); -void SetLogAssertHandler(LogAssertHandlerFunction handler); +BASE_API void SetLogAssertHandler(LogAssertHandlerFunction handler); // Sets the Log Report Handler that will be used to notify of check failures // in non-debug mode. The default handler shows a dialog box and continues // the execution, however clients can use this function to override with their // own handling. typedef void (*LogReportHandlerFunction)(const std::string& str); -void SetLogReportHandler(LogReportHandlerFunction handler); +BASE_API void SetLogReportHandler(LogReportHandlerFunction handler); // Sets the Log Message Handler that gets passed every log message before // it's sent to other log destinations (if any). @@ -272,8 +274,8 @@ void SetLogReportHandler(LogReportHandlerFunction handler); // should not be sent to other log destinations. typedef bool (*LogMessageHandlerFunction)(int severity, const char* file, int line, size_t message_start, const std::string& str); -void SetLogMessageHandler(LogMessageHandlerFunction handler); -LogMessageHandlerFunction GetLogMessageHandler(); +BASE_API void SetLogMessageHandler(LogMessageHandlerFunction handler); +BASE_API LogMessageHandlerFunction GetLogMessageHandler(); typedef int LogSeverity; const LogSeverity LOG_VERBOSE = -1; // This is level 1 verbosity @@ -714,7 +716,7 @@ const LogSeverity LOG_DCHECK = LOG_INFO; // You shouldn't actually use LogMessage's constructor to log things, // though. You should use the LOG() macro (and variants thereof) // above. -class LogMessage { +class BASE_API LogMessage { public: LogMessage(const char* file, int line, LogSeverity severity, int ctr); @@ -792,7 +794,7 @@ inline void LogAtLevel(int const log_level, std::string const &msg) { // This class is used to explicitly ignore values in the conditional // logging macros. This avoids compiler warnings like "value computed // is not used" and "statement has no effect". -class LogMessageVoidify { +class BASE_API LogMessageVoidify { public: LogMessageVoidify() { } // This has to be an operator with a precedence lower than << but @@ -808,11 +810,11 @@ typedef int SystemErrorCode; // Alias for ::GetLastError() on Windows and errno on POSIX. Avoids having to // pull in windows.h just for GetLastError() and DWORD. -SystemErrorCode GetLastSystemErrorCode(); +BASE_API SystemErrorCode GetLastSystemErrorCode(); #if defined(OS_WIN) // Appends a formatted system message of the GetLastError() type. -class Win32ErrorLogMessage { +class BASE_API Win32ErrorLogMessage { public: Win32ErrorLogMessage(const char* file, int line, @@ -864,10 +866,10 @@ class ErrnoLogMessage { // NOTE: Since the log file is opened as necessary by the action of logging // statements, there's no guarantee that it will stay closed // after this call. -void CloseLogFile(); +BASE_API void CloseLogFile(); // Async signal safe logging mechanism. -void RawLog(int level, const char* message); +BASE_API void RawLog(int level, const char* message); #define RAW_LOG(level, message) logging::RawLog(logging::LOG_ ## level, message) @@ -885,7 +887,7 @@ void RawLog(int level, const char* message); // which is normally ASCII. It is relatively slow, so try not to use it for // common cases. Non-ASCII characters will be converted to UTF-8 by these // operators. -std::ostream& operator<<(std::ostream& out, const wchar_t* wstr); +BASE_API std::ostream& operator<<(std::ostream& out, const wchar_t* wstr); inline std::ostream& operator<<(std::ostream& out, const std::wstring& wstr) { return out << wstr.c_str(); } diff --git a/base/path_service.h b/base/path_service.h index edaa5e3..284fbf7 100644 --- a/base/path_service.h +++ b/base/path_service.h @@ -1,4 +1,4 @@ -// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -6,18 +6,18 @@ #define BASE_PATH_SERVICE_H_ #pragma once -#include "build/build_config.h" - #include <string> +#include "base/base_api.h" #include "base/base_paths.h" +#include "build/build_config.h" class FilePath; // The path service is a global table mapping keys to file system paths. It is // OK to use this service from multiple threads. // -class PathService { +class BASE_API PathService { public: // Retrieves a path to a special directory or file and places it into the // string pointed to by 'path'. If you ask for a directory it is guaranteed diff --git a/base/pickle.h b/base/pickle.h index 9d449ae..20878e0 100644 --- a/base/pickle.h +++ b/base/pickle.h @@ -8,6 +8,7 @@ #include <string> +#include "base/base_api.h" #include "base/basictypes.h" #include "base/gtest_prod_util.h" #include "base/logging.h" @@ -30,7 +31,7 @@ // space is controlled by the header_size parameter passed to the Pickle // constructor. // -class Pickle { +class BASE_API Pickle { public: // Initialize a Pickle object using the default header size. Pickle(); diff --git a/base/platform_file.h b/base/platform_file.h index 7fae75c..71adcac 100644 --- a/base/platform_file.h +++ b/base/platform_file.h @@ -6,16 +6,18 @@ #define BASE_PLATFORM_FILE_H_ #pragma once -#include "base/basictypes.h" #include "build/build_config.h" -#include "base/file_path.h" -#include "base/time.h" #if defined(OS_WIN) #include <windows.h> #endif #include <string> +#include "base/base_api.h" +#include "base/basictypes.h" +#include "base/file_path.h" +#include "base/time.h" + namespace base { #if defined(OS_WIN) @@ -69,7 +71,7 @@ enum PlatformFileError { // make sure to update all functions that use it in file_util_{win|posix}.cc // too, and the ParamTraits<base::PlatformFileInfo> implementation in // chrome/common/common_param_traits.cc. -struct PlatformFileInfo { +struct BASE_API PlatformFileInfo { PlatformFileInfo(); ~PlatformFileInfo(); @@ -99,38 +101,39 @@ struct PlatformFileInfo { // Creates or opens the given file. If PLATFORM_FILE_OPEN_ALWAYS is used, and // |created| is provided, |created| will be set to true if the file was created // or to false in case the file was just opened. |error_code| can be NULL. -PlatformFile CreatePlatformFile(const FilePath& name, - int flags, - bool* created, - PlatformFileError* error_code); +BASE_API PlatformFile CreatePlatformFile(const FilePath& name, + int flags, + bool* created, + PlatformFileError* error_code); // Closes a file handle. Returns |true| on success and |false| otherwise. -bool ClosePlatformFile(PlatformFile file); +BASE_API bool ClosePlatformFile(PlatformFile file); // 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. -int ReadPlatformFile(PlatformFile file, int64 offset, char* data, int size); +BASE_API int ReadPlatformFile(PlatformFile file, int64 offset, + char* data, int size); // Writes the given buffer into the file at the given offset, overwritting any // data that was previously there. Returns the number of bytes written, or -1 // on error. -int WritePlatformFile(PlatformFile file, int64 offset, - const char* data, int size); +BASE_API int WritePlatformFile(PlatformFile file, int64 offset, + const char* data, int size); // Truncates the given 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 TruncatePlatformFile(PlatformFile file, int64 length); +BASE_API bool TruncatePlatformFile(PlatformFile file, int64 length); // Flushes the buffers of the given file. -bool FlushPlatformFile(PlatformFile file); +BASE_API bool FlushPlatformFile(PlatformFile file); // Touches the given file. -bool TouchPlatformFile(PlatformFile file, const Time& last_access_time, - const Time& last_modified_time); +BASE_API bool TouchPlatformFile(PlatformFile file, const Time& last_access_time, + const Time& last_modified_time); // Returns some information for the given file. -bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info); +BASE_API bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info); // Use this class to pass ownership of a PlatformFile to a receiver that may or // may not want to accept it. This class does not own the storage for the @@ -152,7 +155,7 @@ bool GetPlatformFileInfo(PlatformFile file, PlatformFileInfo* info); // ClosePlatformFile(file); // } // -class PassPlatformFile { +class BASE_API PassPlatformFile { public: explicit PassPlatformFile(PlatformFile* value) : value_(value) { } diff --git a/base/scoped_temp_dir.h b/base/scoped_temp_dir.h index 4286d28..d9f0e2f 100644 --- a/base/scoped_temp_dir.h +++ b/base/scoped_temp_dir.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -16,9 +16,10 @@ // (CreateUniqueTempDir, CreateUniqueTempDirUnderPath, and Set) must have // intervening calls to Delete or Take, or the calls will fail. +#include "base/base_api.h" #include "base/file_path.h" -class ScopedTempDir { +class BASE_API ScopedTempDir { public: // No directory is owned/created initially. ScopedTempDir(); diff --git a/base/shared_memory.h b/base/shared_memory.h index a088682..cf07da3 100644 --- a/base/shared_memory.h +++ b/base/shared_memory.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -15,6 +15,7 @@ #endif #include <string> +#include "base/base_api.h" #include "base/basictypes.h" #include "base/process.h" @@ -39,7 +40,7 @@ typedef ino_t SharedMemoryId; // Platform abstraction for shared memory. Provides a C++ wrapper // around the OS primitive for a memory mapped file. -class SharedMemory { +class BASE_API SharedMemory { public: SharedMemory(); diff --git a/base/synchronization/lock_impl.h b/base/synchronization/lock_impl.h index 79bc147..2994610 100644 --- a/base/synchronization/lock_impl.h +++ b/base/synchronization/lock_impl.h @@ -14,7 +14,6 @@ #include <pthread.h> #endif -#include "base/base_api.h" #include "base/basictypes.h" namespace base { @@ -23,7 +22,7 @@ namespace internal { // This class implements the underlying platform-specific spin-lock mechanism // used for the Lock class. Most users should not use LockImpl directly, but // should instead use Lock. -class BASE_API LockImpl { +class LockImpl { public: #if defined(OS_WIN) typedef CRITICAL_SECTION OSLockType; diff --git a/base/threading/non_thread_safe.h b/base/threading/non_thread_safe.h index bc3be3c..83a2178 100644 --- a/base/threading/non_thread_safe.h +++ b/base/threading/non_thread_safe.h @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -45,7 +45,7 @@ class NonThreadSafeDoNothing { // In Release mode, CalledOnValidThread will always return true. // #ifndef NDEBUG -class NonThreadSafe : public NonThreadSafeImpl { +class BASE_API NonThreadSafe : public NonThreadSafeImpl { }; #else class NonThreadSafe : public NonThreadSafeDoNothing { diff --git a/base/threading/non_thread_safe_impl.h b/base/threading/non_thread_safe_impl.h index 12925f1..ab0999a 100644 --- a/base/threading/non_thread_safe_impl.h +++ b/base/threading/non_thread_safe_impl.h @@ -6,6 +6,7 @@ #define BASE_THREADING_NON_THREAD_SAFE_IMPL_H_ #pragma once +#include "base/base_api.h" #include "base/threading/thread_checker_impl.h" namespace base { @@ -16,7 +17,7 @@ namespace base { // // Note: You should almost always use the NonThreadSafe class to get // the right version of the class for your build configuration. -class NonThreadSafeImpl { +class BASE_API NonThreadSafeImpl { public: ~NonThreadSafeImpl(); diff --git a/base/utf_offset_string_conversions.h b/base/utf_offset_string_conversions.h index b20e4b1..13df1b4 100644 --- a/base/utf_offset_string_conversions.h +++ b/base/utf_offset_string_conversions.h @@ -1,4 +1,4 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Copyright (c) 2011 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -8,6 +8,7 @@ #include <string> +#include "base/base_api.h" #include "base/string16.h" namespace base { @@ -19,18 +20,18 @@ class StringPiece; // in the result strings. If this isn't possible because the offsets point past // the end of the source strings or into the middle of multibyte sequences, they // will be set to std::wstring::npos. |offset_for_adjustment| may be NULL. -bool UTF8ToWideAndAdjustOffset(const char* src, - size_t src_len, - std::wstring* output, - size_t* offset_for_adjustment); -std::wstring UTF8ToWideAndAdjustOffset(const base::StringPiece& utf8, - size_t* offset_for_adjustment); - -bool UTF16ToWideAndAdjustOffset(const char16* src, - size_t src_len, - std::wstring* output, - size_t* offset_for_adjustment); -std::wstring UTF16ToWideAndAdjustOffset(const string16& utf16, +BASE_API bool UTF8ToWideAndAdjustOffset(const char* src, + size_t src_len, + std::wstring* output, size_t* offset_for_adjustment); +BASE_API std::wstring UTF8ToWideAndAdjustOffset(const base::StringPiece& utf8, + size_t* offset_for_adjustment); + +BASE_API bool UTF16ToWideAndAdjustOffset(const char16* src, + size_t src_len, + std::wstring* output, + size_t* offset_for_adjustment); +BASE_API std::wstring UTF16ToWideAndAdjustOffset(const string16& utf16, + size_t* offset_for_adjustment); #endif // BASE_UTF_OFFSET_STRING_CONVERSIONS_H_ diff --git a/base/win/windows_version.h b/base/win/windows_version.h index df3cc35..1d4b9bf 100644 --- a/base/win/windows_version.h +++ b/base/win/windows_version.h @@ -6,6 +6,8 @@ #define BASE_WIN_WINDOWS_VERSION_H_ #pragma once +#include "base/base_api.h" + typedef void* HANDLE; namespace base { @@ -25,10 +27,10 @@ enum Version { }; // Returns the running version of Windows. -Version GetVersion(); +BASE_API Version GetVersion(); // Returns the major and minor version of the service pack installed. -void GetServicePackLevel(int* major, int* minor); +BASE_API void GetServicePackLevel(int* major, int* minor); enum WindowsArchitecture { X86_ARCHITECTURE, @@ -42,7 +44,7 @@ enum WindowsArchitecture { // 32-bit Chrome running on 32-bit Windows: X86_ARCHITECTURE // 32-bit Chrome running on 64-bit Windows via WOW64: X64_ARCHITECTURE // 64-bit Chrome running on 64-bit Windows: X64_ARCHITECTURE -WindowsArchitecture GetWindowsArchitecture(); +BASE_API WindowsArchitecture GetWindowsArchitecture(); enum WOW64Status { WOW64_DISABLED, @@ -55,11 +57,11 @@ enum WOW64Status { // WOW64_DISABLED for both "32-bit Chrome on 32-bit Windows" and "64-bit Chrome // on 64-bit Windows". WOW64_UNKNOWN means "an error occurred", e.g. the // process does not have sufficient access rights to determine this. -WOW64Status GetWOW64Status(); +BASE_API WOW64Status GetWOW64Status(); // Like GetWOW64Status(), but for the supplied handle instead of the current // process. -WOW64Status GetWOW64StatusForProcess(HANDLE process_handle); +BASE_API WOW64Status GetWOW64StatusForProcess(HANDLE process_handle); } // namespace win } // namespace base |