| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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 <utility> | 5 #include <utility> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/chromeos/logging.h" | 9 #include "base/chromeos/logging.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 "/var/log/messages", "/var/log/messages.1", | 39 "/var/log/messages", "/var/log/messages.1", |
| 40 "/var/log/net.log", "/var/log/net.1.log", | 40 "/var/log/net.log", "/var/log/net.1.log", |
| 41 "/var/log/ui/ui.LATEST", "/var/log/update_engine.log"}; | 41 "/var/log/ui/ui.LATEST", "/var/log/update_engine.log"}; |
| 42 | 42 |
| 43 // Reads the system log files as binary files, anonymizes data, stores the files | 43 // Reads the system log files as binary files, anonymizes data, stores the files |
| 44 // as pairs (file name, data) and returns. Called on blocking thread. | 44 // as pairs (file name, data) and returns. Called on blocking thread. |
| 45 std::unique_ptr<policy::SystemLogUploader::SystemLogs> ReadFiles() { | 45 std::unique_ptr<policy::SystemLogUploader::SystemLogs> ReadFiles() { |
| 46 std::unique_ptr<policy::SystemLogUploader::SystemLogs> system_logs( | 46 std::unique_ptr<policy::SystemLogUploader::SystemLogs> system_logs( |
| 47 new policy::SystemLogUploader::SystemLogs()); | 47 new policy::SystemLogUploader::SystemLogs()); |
| 48 feedback::AnonymizerTool anonymizer; | 48 feedback::AnonymizerTool anonymizer; |
| 49 for (auto const file_path : kSystemLogFileNames) { | 49 for (auto* file_path : kSystemLogFileNames) { |
| 50 if (!base::PathExists(base::FilePath(file_path))) | 50 if (!base::PathExists(base::FilePath(file_path))) |
| 51 continue; | 51 continue; |
| 52 std::string data = std::string(); | 52 std::string data = std::string(); |
| 53 if (!base::ReadFileToString(base::FilePath(file_path), &data)) { | 53 if (!base::ReadFileToString(base::FilePath(file_path), &data)) { |
| 54 CHROMEOS_SYSLOG(ERROR) | 54 CHROMEOS_SYSLOG(ERROR) |
| 55 << "Failed to read the system log file from the disk " << file_path | 55 << "Failed to read the system log file from the disk " << file_path |
| 56 << std::endl; | 56 << std::endl; |
| 57 } | 57 } |
| 58 system_logs->push_back(std::make_pair( | 58 system_logs->push_back(std::make_pair( |
| 59 file_path, | 59 file_path, |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 base::TimeDelta()); | 301 base::TimeDelta()); |
| 302 // Ensure that we never have more than one pending delayed task. | 302 // Ensure that we never have more than one pending delayed task. |
| 303 weak_factory_.InvalidateWeakPtrs(); | 303 weak_factory_.InvalidateWeakPtrs(); |
| 304 task_runner_->PostDelayedTask(FROM_HERE, | 304 task_runner_->PostDelayedTask(FROM_HERE, |
| 305 base::Bind(&SystemLogUploader::StartLogUpload, | 305 base::Bind(&SystemLogUploader::StartLogUpload, |
| 306 weak_factory_.GetWeakPtr()), | 306 weak_factory_.GetWeakPtr()), |
| 307 delay); | 307 delay); |
| 308 } | 308 } |
| 309 | 309 |
| 310 } // namespace policy | 310 } // namespace policy |
| OLD | NEW |