Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Unified Diff: base/file_util_win.cc

Issue 3427019: Remove logging for issue 35198. (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/file_util.h ('k') | chrome/browser/utility_process_host.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/file_util_win.cc
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index f538c20c4f847ae243873e65a333dc367bf9065a..e0f9ccacfb0600a1e386ce039233ec5f20d1ae65 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -593,31 +593,18 @@ bool CreateNewTempDirectory(const FilePath::StringType& prefix,
}
bool CreateDirectory(const FilePath& full_path) {
- return file_util::CreateDirectoryExtraLogging(full_path, LOG(INFO));
-}
-
-// TODO(skerner): Extra logging has been added to understand crbug/35198 .
-// Remove it once we get a log from a user who can reproduce the issue.
-bool CreateDirectoryExtraLogging(const FilePath& full_path,
- std::ostream& log) {
- log << "Enter CreateDirectory: full_path = " << full_path.value()
- << std::endl;
// If the path exists, we've succeeded if it's a directory, failed otherwise.
const wchar_t* full_path_str = full_path.value().c_str();
DWORD fileattr = ::GetFileAttributes(full_path_str);
- log << "::GetFileAttributes() returned " << fileattr << std::endl;
- if (fileattr == INVALID_FILE_ATTRIBUTES) {
- DWORD fileattr_error = GetLastError();
- log << "::GetFileAttributes() failed. GetLastError() = "
- << fileattr_error << std::endl;
- } else {
+ if (fileattr != INVALID_FILE_ATTRIBUTES) {
if ((fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0) {
- log << "CreateDirectory(" << full_path_str << "), "
- << "directory already exists." << std::endl;
+ DLOG(INFO) << "CreateDirectory(" << full_path_str << "), "
+ << "directory already exists.";
return true;
} else {
- log << "CreateDirectory(" << full_path_str << "), "
- << "conflicts with existing file." << std::endl;
+ LOG(WARNING) << "CreateDirectory(" << full_path_str << "), "
+ << "conflicts with existing file.";
+ return false;
}
}
@@ -628,49 +615,26 @@ bool CreateDirectoryExtraLogging(const FilePath& full_path,
// directories starting with the highest-level missing parent.
FilePath parent_path(full_path.DirName());
if (parent_path.value() == full_path.value()) {
- log << "Can't create directory: parent_path " << parent_path.value()
- << " should not equal full_path " << full_path.value()
- << std::endl;
return false;
}
if (!CreateDirectory(parent_path)) {
- log << "Failed to create one of the parent directories: "
- << parent_path.value() << std::endl;
+ DLOG(WARNING) << "Failed to create one of the parent directories.";
return false;
}
- log << "About to call ::CreateDirectory() with full_path_str = "
- << full_path_str << std::endl;
if (!::CreateDirectory(full_path_str, NULL)) {
DWORD error_code = ::GetLastError();
- log << "CreateDirectory() gave last error " << error_code << std::endl;
-
- DWORD fileattr = GetFileAttributes(full_path.value().c_str());
- if (fileattr == INVALID_FILE_ATTRIBUTES) {
- DWORD fileattr_error = ::GetLastError();
- log << "GetFileAttributes() failed, GetLastError() = "
- << fileattr_error << std::endl;
- } else {
- log << "GetFileAttributes() returned " << fileattr << std::endl;
- log << "Is the path a directory: "
- << ((fileattr & FILE_ATTRIBUTE_DIRECTORY) != 0) << std::endl;
- }
if (error_code == ERROR_ALREADY_EXISTS && DirectoryExists(full_path)) {
// This error code doesn't indicate whether we were racing with someone
// creating the same directory, or a file with the same path, therefore
// we check.
- log << "Race condition? Directory already exists: "
- << full_path.value() << std::endl;
return true;
} else {
- DWORD dir_exists_error = ::GetLastError();
- log << "Failed to create directory " << full_path_str << std::endl;
- log << "GetLastError() for DirectoryExists() is "
- << dir_exists_error << std::endl;
+ LOG(WARNING) << "Failed to create directory " << full_path_str
+ << ", last error is " << error_code << ".";
return false;
}
} else {
- log << "::CreateDirectory() succeeded." << std::endl;
return true;
}
}
« no previous file with comments | « base/file_util.h ('k') | chrome/browser/utility_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698