Chromium Code Reviews| Index: chrome/browser/ui/webui/net_internals/net_internals_ui.cc |
| diff --git a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc |
| index 728daf52e902515b963a5753a12eab4e93445c50..20bee77f9b4c005914e63e2cc4a418b9909e3ab7 100644 |
| --- a/chrome/browser/ui/webui/net_internals/net_internals_ui.cc |
| +++ b/chrome/browser/ui/webui/net_internals/net_internals_ui.cc |
| @@ -166,18 +166,22 @@ ChromeWebUIDataSource* CreateNetInternalsHTMLSource() { |
| typedef base::Callback<void(const FilePath& log_path, |
| bool succeded)> StoreDebugLogsCallback; |
| +// Deletes debug log file, so should be called on the FILE thread. |
| +void DeleteDebugLogFile(const FilePath& log_path) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| + file_util::Delete(log_path, false); |
| +} |
| + |
| // Called once creation of the debug log file is completed. If |
| -// creation failed, deletes the file by |log_path|. So, this function |
| -// should be called on the FILE thread. After all, calls |callback| on |
| -// the UI thread. |
| +// creation failed, deletes the file by |log_path|. After all, calls |
| +// |callback| on the UI thread. |
| void CreateDebugLogFileCompleted(const StoreDebugLogsCallback& callback, |
| const FilePath& log_path, |
| bool succeeded) { |
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::FILE)); |
| - |
| - if (!succeeded) |
| - file_util::Delete(log_path, false); |
| - |
| + if (!succeeded) { |
| + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, |
| + base::Bind(&DeleteDebugLogFile, log_path)); |
| + } |
| BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| base::Bind(callback, log_path, succeeded)); |
| } |
| @@ -192,7 +196,7 @@ void CreateDebugLogFile(const StoreDebugLogsCallback& callback) { |
| const FilePath::CharType kLogFileName[] = FILE_PATH_LITERAL("debug-log.tgz"); |
| FilePath fileshelf_dir; |
| - if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS, &fileshelf_dir)) { |
| + if (!PathService::Get(chrome::DIR_DEFAULT_DOWNLOADS_SAFE, &fileshelf_dir)) { |
|
Sam Leffler
2012/05/14 15:52:38
should this be download_util::GetDefaultDownloadDi
ygorshenin1
2012/05/15 12:46:20
Done.
|
| LOG(ERROR) << "Can't get fileshelf dir"; |
| CreateDebugLogFileCompleted(callback, FilePath(), false); |
| return; |
| @@ -215,10 +219,17 @@ void CreateDebugLogFile(const StoreDebugLogsCallback& callback) { |
| CreateDebugLogFileCompleted(callback, log_path, false); |
| return; |
| } |
| - chromeos::DBusThreadManager::Get()->GetDebugDaemonClient()-> |
| - GetDebugLogs(log_file, |
| - base::Bind(&CreateDebugLogFileCompleted, |
| - callback, log_path)); |
| + |
| + chromeos::DebugDaemonClient* client = |
| + chromeos::DBusThreadManager::Get()->GetDebugDaemonClient(); |
| + BrowserThread::PostTask( |
| + BrowserThread::UI, FROM_HERE, |
| + base::Bind(&chromeos::DebugDaemonClient::GetDebugLogs, |
| + base::Unretained(client), |
| + log_file, |
| + base::Bind(&CreateDebugLogFileCompleted, |
| + callback, |
| + log_path))); |
| } |
| // Delegates the job of saving debug logs on the fileshelf to |