From 075be5d0fe3c21a7405906172dafc76f2343b3da Mon Sep 17 00:00:00 2001
From: "skerner@chromium.org"
 <skerner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>
Date: Fri, 24 Sep 2010 15:39:39 +0000
Subject: Remove logging for issue 35198.

Remove switch --issue35198-logging .

BUG=56664
TEST=Install an extension on all platforms.

Review URL: http://codereview.chromium.org/3427019

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60471 0039d316-1c4b-4281-b951-d872f2087c98
---
 base/file_util.h      |  8 --------
 base/file_util_win.cc | 53 ++++++++-------------------------------------------
 2 files changed, 8 insertions(+), 53 deletions(-)

(limited to 'base')

diff --git a/base/file_util.h b/base/file_util.h
index 7825d5b..553f520 100644
--- a/base/file_util.h
+++ b/base/file_util.h
@@ -281,14 +281,6 @@ bool CreateTemporaryDirInDir(const FilePath& base_dir,
 // already exists.  The directory is only readable by the current user.
 bool CreateDirectory(const FilePath& full_path);
 
-#if defined(OS_WIN)
-// Added for debugging an issue where CreateDirectory() fails.  LOG(*) does
-// not work, because the failure happens in a sandboxed process.
-// TODO(skerner): Remove once crbug/35198 is resolved.
-bool CreateDirectoryExtraLogging(const FilePath& full_path,
-                                 std::ostream& error);
-#endif  // defined (OS_WIN)
-
 // Returns the file size. Returns true on success.
 bool GetFileSize(const FilePath& file_path, int64* file_size);
 
diff --git a/base/file_util_win.cc b/base/file_util_win.cc
index b3ce896..61e6082 100644
--- a/base/file_util_win.cc
+++ b/base/file_util_win.cc
@@ -593,31 +593,17 @@ 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.";
     }
   }
 
@@ -628,49 +614,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;
   }
 }
-- 
cgit v1.1