| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "chrome/browser/chromeos/system_logs/debug_log_writer.h" | 5 #include "chrome/browser/chromeos/system_logs/debug_log_writer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| 11 #include "base/bind_helpers.h" | 11 #include "base/bind_helpers.h" |
| 12 #include "base/callback.h" | 12 #include "base/callback.h" |
| 13 #include "base/command_line.h" | 13 #include "base/command_line.h" |
| 14 #include "base/files/file.h" | 14 #include "base/files/file.h" |
| 15 #include "base/files/file_util.h" | 15 #include "base/files/file_util.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/process/kill.h" | 17 #include "base/process/kill.h" |
| 18 #include "base/process/launch.h" | 18 #include "base/process/launch.h" |
| 19 #include "chrome/browser/chromeos/dbus_thread_manager_chrome.h" |
| 19 #include "chrome/common/logging_chrome.h" | 20 #include "chrome/common/logging_chrome.h" |
| 20 #include "chromeos/dbus/dbus_thread_manager.h" | 21 // #include "chromeos/dbus/dbus_thread_manager.h" |
| 21 #include "chromeos/dbus/debug_daemon_client.h" | 22 #include "chromeos/dbus/debug_daemon_client.h" |
| 22 #include "content/public/browser/browser_thread.h" | 23 #include "content/public/browser/browser_thread.h" |
| 23 | 24 |
| 24 namespace chromeos { | 25 namespace chromeos { |
| 25 | 26 |
| 26 namespace { | 27 namespace { |
| 27 | 28 |
| 28 // Callback for returning status of executed external command. | 29 // Callback for returning status of executed external command. |
| 29 typedef base::Callback<void(bool succeeded)> CommandCompletionCallback; | 30 typedef base::Callback<void(bool succeeded)> CommandCompletionCallback; |
| 30 | 31 |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 const base::FilePath& file_path, | 68 const base::FilePath& file_path, |
| 68 bool should_compress, | 69 bool should_compress, |
| 69 const DebugLogWriter::StoreLogsCallback& callback) { | 70 const DebugLogWriter::StoreLogsCallback& callback) { |
| 70 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 71 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 71 if (!file->IsValid()) { | 72 if (!file->IsValid()) { |
| 72 LOG(ERROR) << "Can't create debug log file: " << file_path.AsUTF8Unsafe() | 73 LOG(ERROR) << "Can't create debug log file: " << file_path.AsUTF8Unsafe() |
| 73 << ", " | 74 << ", " |
| 74 << "error: " << file->error_details(); | 75 << "error: " << file->error_details(); |
| 75 return; | 76 return; |
| 76 } | 77 } |
| 77 chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()->DumpDebugLogs( | 78 DBusThreadManagerChrome::Get()->GetDebugDaemonClient()->DumpDebugLogs( |
| 78 should_compress, file->GetPlatformFile(), | 79 should_compress, file->GetPlatformFile(), |
| 79 base::Bind(&WriteDebugLogToFileCompleted, file_path, sequence_token_name, | 80 base::Bind(&WriteDebugLogToFileCompleted, file_path, sequence_token_name, |
| 80 callback)); | 81 callback)); |
| 81 | 82 |
| 82 // Close the file on an IO-allowed thread. | 83 // Close the file on an IO-allowed thread. |
| 83 GetSequencedTaskRunner(sequence_token_name) | 84 GetSequencedTaskRunner(sequence_token_name) |
| 84 ->PostTask(FROM_HERE, | 85 ->PostTask(FROM_HERE, |
| 85 base::Bind(&base::DeletePointer<base::File>, file.release())); | 86 base::Bind(&base::DeletePointer<base::File>, file.release())); |
| 86 } | 87 } |
| 87 | 88 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 fileshelf.Append(FILE_PATH_LITERAL("combined-logs.tar")); | 268 fileshelf.Append(FILE_PATH_LITERAL("combined-logs.tar")); |
| 268 | 269 |
| 269 // Get system logs from /var/log first, then add user-specific stuff. | 270 // Get system logs from /var/log first, then add user-specific stuff. |
| 270 StartLogRetrieval(file_path, | 271 StartLogRetrieval(file_path, |
| 271 false, | 272 false, |
| 272 sequence_token_name, | 273 sequence_token_name, |
| 273 base::Bind(&OnSystemLogsAdded, callback)); | 274 base::Bind(&OnSystemLogsAdded, callback)); |
| 274 } | 275 } |
| 275 | 276 |
| 276 } // namespace chromeos | 277 } // namespace chromeos |
| OLD | NEW |