| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <windows.h> | 5 #include <windows.h> |
| 6 | 6 |
| 7 #include "chrome/installer/util/logging_installer.h" | 7 #include "chrome/installer/util/logging_installer.h" |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 namespace installer { | 27 namespace installer { |
| 28 | 28 |
| 29 // This should be true for the period between the end of | 29 // This should be true for the period between the end of |
| 30 // InitInstallerLogging() and the beginning of EndInstallerLogging(). | 30 // InitInstallerLogging() and the beginning of EndInstallerLogging(). |
| 31 bool installer_logging_ = false; | 31 bool installer_logging_ = false; |
| 32 | 32 |
| 33 TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) { | 33 TruncateResult TruncateLogFileIfNeeded(const base::FilePath& log_file) { |
| 34 TruncateResult result = LOGFILE_UNTOUCHED; | 34 TruncateResult result = LOGFILE_UNTOUCHED; |
| 35 | 35 |
| 36 int64 log_size = 0; | 36 int64 log_size = 0; |
| 37 if (file_util::GetFileSize(log_file, &log_size) && | 37 if (base::GetFileSize(log_file, &log_size) && |
| 38 log_size > kMaxInstallerLogFileSize) { | 38 log_size > kMaxInstallerLogFileSize) { |
| 39 // Cause the old log file to be deleted when we are done with it. | 39 // Cause the old log file to be deleted when we are done with it. |
| 40 const int file_flags = base::PLATFORM_FILE_OPEN | | 40 const int file_flags = base::PLATFORM_FILE_OPEN | |
| 41 base::PLATFORM_FILE_READ | | 41 base::PLATFORM_FILE_READ | |
| 42 base::PLATFORM_FILE_SHARE_DELETE | | 42 base::PLATFORM_FILE_SHARE_DELETE | |
| 43 base::PLATFORM_FILE_DELETE_ON_CLOSE; | 43 base::PLATFORM_FILE_DELETE_ON_CLOSE; |
| 44 base::win::ScopedHandle old_log_file( | 44 base::win::ScopedHandle old_log_file( |
| 45 base::CreatePlatformFile(log_file, file_flags, NULL, NULL)); | 45 base::CreatePlatformFile(log_file, file_flags, NULL, NULL)); |
| 46 | 46 |
| 47 if (old_log_file.IsValid()) { | 47 if (old_log_file.IsValid()) { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 base::FilePath log_path; | 124 base::FilePath log_path; |
| 125 if (PathService::Get(base::DIR_TEMP, &log_path)) { | 125 if (PathService::Get(base::DIR_TEMP, &log_path)) { |
| 126 log_path = log_path.Append(log_filename); | 126 log_path = log_path.Append(log_filename); |
| 127 return log_path; | 127 return log_path; |
| 128 } else { | 128 } else { |
| 129 return base::FilePath(log_filename); | 129 return base::FilePath(log_filename); |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 | 132 |
| 133 } // namespace installer | 133 } // namespace installer |
| OLD | NEW |