Move webrtc/{base => rtc_base}
This refactoring takes a careful approach to avoid rushing the change:
* stub headers are left in all the old locations of webrtc/base
* existing GN targets are kept and now just forward to the moved ones
using public_deps.
The only exception to the above is the base_java target and its .java files,
which were moved to webrtc/rtc_base right away since it's not possible
to use public_deps for android_library.
To avoid breaking builds, a temporary Dummy.java file was added to
the new intermediate target in webrtc/rtc_base:base_java as well to avoid
hitting a GN assert in the android_library template.
The above approach should make the transition smooth without breaking
downstream.
A helper script was created (https://codereview.webrtc.org/2879203002/)
and was run like this:
stub-headers.py -s webrtc/base -d webrtc/rtc_base -i 7634
stub-headers.py -s webrtc/base/numerics -d webrtc/rtc_base/numerics -i 7634
Fixed invalid header guards in the following files:
webrtc/base/base64.h
webrtc/base/cryptstring.h
webrtc/base/event.h
webrtc/base/flags.h
webrtc/base/httpbase.h
webrtc/base/httpcommon-inl.h
webrtc/base/httpcommon.h
webrtc/base/httpserver.h
webrtc/base/logsinks.h
webrtc/base/macutils.h
webrtc/base/nattypes.h
webrtc/base/openssladapter.h
webrtc/base/opensslstreamadapter.h
webrtc/base/pathutils.h
webrtc/base/physicalsocketserver.h
webrtc/base/proxyinfo.h
webrtc/base/sigslot.h
webrtc/base/sigslotrepeater.h
webrtc/base/socket.h
webrtc/base/socketaddresspair.h
webrtc/base/socketfactory.h
webrtc/base/stringutils.h
webrtc/base/testbase64.h
webrtc/base/testutils.h
webrtc/base/transformadapter.h
webrtc/base/win32filesystem.h
Added new header guards to:
sslroots.h
testbase64.h
BUG=webrtc:7634
NOTRY=True
NOPRESUBMIT=True
R=kwiberg@webrtc.org
Review-Url: https://codereview.webrtc.org/2877023002 .
Cr-Commit-Position: refs/heads/master@{#18816}
diff --git a/webrtc/base/fileutils.h b/webrtc/base/fileutils.h
index 00b4d8d..18de30c 100644
--- a/webrtc/base/fileutils.h
+++ b/webrtc/base/fileutils.h
@@ -1,3 +1,4 @@
+
/*
* Copyright 2004 The WebRTC Project Authors. All rights reserved.
*
@@ -11,172 +12,9 @@
#ifndef WEBRTC_BASE_FILEUTILS_H_
#define WEBRTC_BASE_FILEUTILS_H_
-#include <string>
-#if !defined(WEBRTC_WIN)
-#include <dirent.h>
-#include <stdio.h>
-#include <sys/stat.h>
-#include <sys/types.h>
-#include <unistd.h>
-#endif
-
-#include "webrtc/base/checks.h"
-#include "webrtc/base/constructormagic.h"
-#include "webrtc/base/platform_file.h"
-
-namespace rtc {
-
-class FileStream;
-class Pathname;
-
-//////////////////////////
-// Directory Iterator //
-//////////////////////////
-
-// A DirectoryIterator is created with a given directory. It originally points
-// to the first file in the directory, and can be advanecd with Next(). This
-// allows you to get information about each file.
-
-class DirectoryIterator {
- friend class Filesystem;
- public:
- // Constructor
- DirectoryIterator();
- // Destructor
- virtual ~DirectoryIterator();
-
- // Starts traversing a directory
- // dir is the directory to traverse
- // returns true if the directory exists and is valid
- // The iterator will point to the first entry in the directory
- virtual bool Iterate(const Pathname &path);
-
- // Advances to the next file
- // returns true if there were more files in the directory.
- virtual bool Next();
-
- // returns true if the file currently pointed to is a directory
- virtual bool IsDirectory() const;
-
- // returns the name of the file currently pointed to
- virtual std::string Name() const;
-
- private:
- std::string directory_;
-#if defined(WEBRTC_WIN)
- WIN32_FIND_DATA data_;
- HANDLE handle_;
-#else
- DIR *dir_;
- struct dirent *dirent_;
- struct stat stat_;
-#endif
-};
-
-class FilesystemInterface {
- public:
- virtual ~FilesystemInterface() {}
-
- // This will attempt to delete the path located at filename.
- // It DCHECKs and returns false if the path points to a folder or a
- // non-existent file.
- virtual bool DeleteFile(const Pathname &filename) = 0;
-
- // Creates a directory. This will call itself recursively to create /foo/bar
- // even if /foo does not exist. Returns true if the function succeeds.
- virtual bool CreateFolder(const Pathname &pathname) = 0;
-
- // This moves a file from old_path to new_path, where "old_path" is a
- // plain file. This DCHECKs and returns false if old_path points to a
- // directory, and returns true if the function succeeds.
- virtual bool MoveFile(const Pathname &old_path, const Pathname &new_path) = 0;
-
- // Returns true if pathname refers to a directory
- virtual bool IsFolder(const Pathname& pathname) = 0;
-
- // Returns true if pathname refers to a file
- virtual bool IsFile(const Pathname& pathname) = 0;
-
- // Returns true if pathname refers to no filesystem object, every parent
- // directory either exists, or is also absent.
- virtual bool IsAbsent(const Pathname& pathname) = 0;
-
- // A folder appropriate for storing temporary files (Contents are
- // automatically deleted when the program exits)
- virtual bool GetTemporaryFolder(Pathname &path, bool create,
- const std::string *append) = 0;
-
- virtual std::string TempFilename(const Pathname &dir,
- const std::string &prefix) = 0;
-
- // Determines the size of the file indicated by path.
- virtual bool GetFileSize(const Pathname& path, size_t* size) = 0;
-};
-
-class Filesystem {
- public:
- static FilesystemInterface *default_filesystem() {
- RTC_DCHECK(default_filesystem_);
- return default_filesystem_;
- }
-
- static void set_default_filesystem(FilesystemInterface *filesystem) {
- default_filesystem_ = filesystem;
- }
-
- static FilesystemInterface *swap_default_filesystem(
- FilesystemInterface *filesystem) {
- FilesystemInterface *cur = default_filesystem_;
- default_filesystem_ = filesystem;
- return cur;
- }
-
- static bool CreateFolder(const Pathname &pathname) {
- return EnsureDefaultFilesystem()->CreateFolder(pathname);
- }
-
- static bool DeleteFile(const Pathname &filename) {
- return EnsureDefaultFilesystem()->DeleteFile(filename);
- }
-
- static bool MoveFile(const Pathname &old_path, const Pathname &new_path) {
- return EnsureDefaultFilesystem()->MoveFile(old_path, new_path);
- }
-
- static bool IsFolder(const Pathname& pathname) {
- return EnsureDefaultFilesystem()->IsFolder(pathname);
- }
-
- static bool IsFile(const Pathname &pathname) {
- return EnsureDefaultFilesystem()->IsFile(pathname);
- }
-
- static bool IsAbsent(const Pathname &pathname) {
- return EnsureDefaultFilesystem()->IsAbsent(pathname);
- }
-
- static bool GetTemporaryFolder(Pathname &path, bool create,
- const std::string *append) {
- return EnsureDefaultFilesystem()->GetTemporaryFolder(path, create, append);
- }
-
- static std::string TempFilename(const Pathname &dir,
- const std::string &prefix) {
- return EnsureDefaultFilesystem()->TempFilename(dir, prefix);
- }
-
- static bool GetFileSize(const Pathname& path, size_t* size) {
- return EnsureDefaultFilesystem()->GetFileSize(path, size);
- }
-
- private:
- static FilesystemInterface* default_filesystem_;
-
- static FilesystemInterface *EnsureDefaultFilesystem();
- RTC_DISALLOW_IMPLICIT_CONSTRUCTORS(Filesystem);
-};
-
-} // namespace rtc
+// This header is deprecated and is just left here temporarily during
+// refactoring. See https://bugs.webrtc.org/7634 for more details.
+#include "webrtc/rtc_base/fileutils.h"
#endif // WEBRTC_BASE_FILEUTILS_H_