Chromium Code Reviews| 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..c4dafbf0eb9539aeb3883918536c4f0d005b6632 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() || |
|
Alexei Svitkine (slow)
2013/11/04 15:26:40
Can the |histograms| param be null? If it can, ple
michaelpg
2013/11/04 17:25:18
It shouldn't be null, so I've changed ZipHistogram
|
| + !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( |
| + scoped_ptr<std::string> histograms) { |
| + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| + |
| + histograms_ = histograms.Pass(); |
| + if (histograms_.get()) { |
| + 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_.get(), |
| + 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_.get() || histograms_compression_complete_) && |
| (!attached_filedata_.get() || attached_file_compression_complete_) && |
| !trace_id_ && |
| feedback_page_data_complete_; |