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

Unified Diff: chrome/browser/feedback/feedback_data.cc

Issue 55363003: Send compressed histograms with system logs when sending feedback. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: attachment helper Created 7 years, 2 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
Index: chrome/browser/feedback/feedback_data.cc
diff --git a/chrome/browser/feedback/feedback_data.cc b/chrome/browser/feedback/feedback_data.cc
index 95cb49fe9f9108ad113d1c7adf196273ee5e3cbf..c0315f6cff07ef7ee20e10dd3609585da865db38 100644
--- a/chrome/browser/feedback/feedback_data.cc
+++ b/chrome/browser/feedback/feedback_data.cc
@@ -39,6 +39,8 @@ const char kZipExt[] = ".zip";
const base::FilePath::CharType kLogsFilename[] =
FILE_PATH_LITERAL("system_logs.txt");
+const base::FilePath::CharType kHistogramsFilename[] =
+ FILE_PATH_LITERAL("histograms.txt");
// Converts the system logs into a string that we can compress and send
// with the report. This method only converts those logs that we want in
@@ -87,6 +89,18 @@ void ZipLogs(FeedbackData::SystemLogsMap* sys_info,
}
}
+void ZipHistograms(const std::string& histograms,
+ std::string* compressed_histograms) {
+ DCHECK(compressed_histograms);
+ if (histograms.empty() ||
+ !feedback_util::ZipString(
+ base::FilePath(kHistogramsFilename),
+ histograms,
+ compressed_histograms)) {
+ compressed_histograms->clear();
+ }
+}
+
} // namespace
// static
@@ -103,6 +117,7 @@ FeedbackData::FeedbackData() : profile_(NULL),
trace_id_(0),
feedback_page_data_complete_(false),
syslogs_compression_complete_(false),
+ histograms_compression_complete_(false),
attached_file_compression_complete_(false),
report_sent_(false) {
}
@@ -144,6 +159,25 @@ void FeedbackData::SetAndCompressSystemInfo(
}
}
+void FeedbackData::SetAndCompressHistograms(
+ const std::string& histograms) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ histograms_ = histograms;
+ if (!histograms_.empty()) {
+ std::string* compressed_histograms_ptr = new std::string;
+ scoped_ptr<std::string> compressed_histograms(compressed_histograms_ptr);
+ BrowserThread::PostBlockingPoolTaskAndReply(
+ FROM_HERE,
+ base::Bind(&ZipHistograms,
+ histograms_,
+ compressed_histograms_ptr),
+ base::Bind(&FeedbackData::OnCompressHistogramsComplete,
+ this,
+ base::Passed(&compressed_histograms)));
+ }
+}
+
void FeedbackData::AttachAndCompressFileData(
scoped_ptr<std::string> attached_filedata) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -199,6 +233,16 @@ void FeedbackData::OnCompressLogsComplete(
SendReport();
}
+void FeedbackData::OnCompressHistogramsComplete(
+ scoped_ptr<std::string> compressed_histograms) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
+ compressed_histograms_ = compressed_histograms.Pass();
+ histograms_compression_complete_ = true;
+
+ SendReport();
+}
+
void FeedbackData::OnCompressFileComplete(
scoped_ptr<std::string> compressed_file) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
@@ -217,6 +261,7 @@ void FeedbackData::OnCompressFileComplete(
bool FeedbackData::IsDataComplete() {
return (!sys_info_.get() || syslogs_compression_complete_) &&
+ (histograms_.empty() || histograms_compression_complete_) &&
(!attached_filedata_.get() || attached_file_compression_complete_) &&
!trace_id_ &&
feedback_page_data_complete_;

Powered by Google App Engine
This is Rietveld 408576698