| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 // Need to include this before most other files because it defines | 7 // Need to include this before most other files because it defines |
| 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define | 8 // IPC_MESSAGE_LOG_ENABLED. We need to use it to define |
| 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the | 9 // IPC_MESSAGE_MACROS_LOG_ENABLED so render_messages.h will generate the |
| 10 // ViewMsgLog et al. functions. | 10 // ViewMsgLog et al. functions. |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 base::FilePath target_path; | 169 base::FilePath target_path; |
| 170 bool symlink_exists = base::PathExists(symlink_path); | 170 bool symlink_exists = base::PathExists(symlink_path); |
| 171 if (new_log || !symlink_exists) { | 171 if (new_log || !symlink_exists) { |
| 172 target_path = GenerateTimestampedName(symlink_path, base::Time::Now()); | 172 target_path = GenerateTimestampedName(symlink_path, base::Time::Now()); |
| 173 | 173 |
| 174 // We don't care if the unlink fails; we're going to continue anyway. | 174 // We don't care if the unlink fails; we're going to continue anyway. |
| 175 if (::unlink(symlink_path.value().c_str()) == -1) { | 175 if (::unlink(symlink_path.value().c_str()) == -1) { |
| 176 if (symlink_exists) // only warn if we might expect it to succeed. | 176 if (symlink_exists) // only warn if we might expect it to succeed. |
| 177 DPLOG(WARNING) << "Unable to unlink " << symlink_path.value(); | 177 DPLOG(WARNING) << "Unable to unlink " << symlink_path.value(); |
| 178 } | 178 } |
| 179 if (!file_util::CreateSymbolicLink(target_path, symlink_path)) { | 179 if (!base::CreateSymbolicLink(target_path, symlink_path)) { |
| 180 DPLOG(ERROR) << "Unable to create symlink " << symlink_path.value() | 180 DPLOG(ERROR) << "Unable to create symlink " << symlink_path.value() |
| 181 << " pointing at " << target_path.value(); | 181 << " pointing at " << target_path.value(); |
| 182 } | 182 } |
| 183 } else { | 183 } else { |
| 184 if (!file_util::ReadSymbolicLink(symlink_path, &target_path)) | 184 if (!base::ReadSymbolicLink(symlink_path, &target_path)) |
| 185 DPLOG(ERROR) << "Unable to read symlink " << symlink_path.value(); | 185 DPLOG(ERROR) << "Unable to read symlink " << symlink_path.value(); |
| 186 } | 186 } |
| 187 return target_path; | 187 return target_path; |
| 188 } | 188 } |
| 189 | 189 |
| 190 void RemoveSymlinkAndLog(const base::FilePath& link_path, | 190 void RemoveSymlinkAndLog(const base::FilePath& link_path, |
| 191 const base::FilePath& target_path) { | 191 const base::FilePath& target_path) { |
| 192 if (::unlink(link_path.value().c_str()) == -1) | 192 if (::unlink(link_path.value().c_str()) == -1) |
| 193 DPLOG(WARNING) << "Unable to unlink symlink " << link_path.value(); | 193 DPLOG(WARNING) << "Unable to unlink symlink " << link_path.value(); |
| 194 if (::unlink(target_path.value().c_str()) == -1) | 194 if (::unlink(target_path.value().c_str()) == -1) |
| (...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 time_deets.year, | 455 time_deets.year, |
| 456 time_deets.month, | 456 time_deets.month, |
| 457 time_deets.day_of_month, | 457 time_deets.day_of_month, |
| 458 time_deets.hour, | 458 time_deets.hour, |
| 459 time_deets.minute, | 459 time_deets.minute, |
| 460 time_deets.second); | 460 time_deets.second); |
| 461 return base_path.InsertBeforeExtensionASCII(suffix); | 461 return base_path.InsertBeforeExtensionASCII(suffix); |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace logging | 464 } // namespace logging |
| OLD | NEW |