Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Unified Diff: chrome/browser/ui/webui/net_internals/net_internals_ui.cc

Issue 10332115: Fixed GetDebugLogs functionality. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Fixed fileshelf directory, simplified methods call chain for the GetDebugLogs. Created 8 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698