Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/feedback/feedback_data.h" | 5 #include "chrome/browser/feedback/feedback_data.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/json/json_string_value_serializer.h" | 8 #include "base/json/json_string_value_serializer.h" |
| 9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
| 10 #include "base/values.h" | 10 #include "base/values.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 89 report_sent_ = true; | 89 report_sent_ = true; |
| 90 feedback_util::SendReport(this); | 90 feedback_util::SendReport(this); |
| 91 } | 91 } |
| 92 } | 92 } |
| 93 | 93 |
| 94 void FeedbackData::OnFeedbackPageDataComplete() { | 94 void FeedbackData::OnFeedbackPageDataComplete() { |
| 95 feedback_page_data_complete_ = true; | 95 feedback_page_data_complete_ = true; |
| 96 SendReport(); | 96 SendReport(); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void FeedbackData::set_sys_info( | 99 void FeedbackData::set_sys_info( |
|
asargent_no_longer_on_chrome
2013/09/06 22:53:48
style nit: I think the style guide recommends that
rkc
2013/09/06 23:02:17
Yeah, this is just legacy - used to do only one th
| |
| 100 scoped_ptr<FeedbackData::SystemLogsMap> sys_info) { | 100 scoped_ptr<FeedbackData::SystemLogsMap> sys_info) { |
| 101 if (sys_info.get()) | |
| 102 CompressSyslogs(sys_info.Pass()); | |
| 103 } | |
| 104 | |
| 105 void FeedbackData::CompressSyslogs( | |
| 106 scoped_ptr<FeedbackData::SystemLogsMap> sys_info) { | |
| 107 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 101 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 108 | 102 |
| 109 // We get the pointer first since base::Passed will nullify the scoper, hence | 103 sys_info_ = sys_info.Pass(); |
| 110 // it's not safe to use <scoper>.get() as a parameter to PostTaskAndReply. | 104 if (sys_info_.get()) { |
| 111 FeedbackData::SystemLogsMap* sys_info_ptr = sys_info.get(); | 105 std::string* compressed_logs_ptr = new std::string; |
| 112 std::string* compressed_logs_ptr = new std::string; | 106 scoped_ptr<std::string> compressed_logs(compressed_logs_ptr); |
| 113 scoped_ptr<std::string> compressed_logs(compressed_logs_ptr); | 107 BrowserThread::PostBlockingPoolTaskAndReply( |
| 114 BrowserThread::PostBlockingPoolTaskAndReply( | 108 FROM_HERE, |
| 115 FROM_HERE, | 109 base::Bind(&ZipLogs, |
| 116 base::Bind(&ZipLogs, | 110 sys_info_.get(), |
| 117 sys_info_ptr, | 111 compressed_logs_ptr), |
| 118 compressed_logs_ptr), | 112 base::Bind(&FeedbackData::OnCompressLogsComplete, |
| 119 base::Bind(&FeedbackData::OnCompressLogsComplete, | 113 this, |
| 120 this, | 114 base::Passed(&compressed_logs))); |
| 121 base::Passed(&sys_info), | 115 } |
| 122 base::Passed(&compressed_logs))); | |
| 123 } | 116 } |
| 124 | 117 |
| 125 void FeedbackData::OnCompressLogsComplete( | 118 void FeedbackData::OnCompressLogsComplete( |
| 126 scoped_ptr<FeedbackData::SystemLogsMap> sys_info, | |
| 127 scoped_ptr<std::string> compressed_logs) { | 119 scoped_ptr<std::string> compressed_logs) { |
| 128 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 120 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 129 | 121 |
| 130 sys_info_ = sys_info.Pass(); | |
| 131 compressed_logs_ = compressed_logs.Pass(); | 122 compressed_logs_ = compressed_logs.Pass(); |
| 132 syslogs_compression_complete_ = true; | 123 syslogs_compression_complete_ = true; |
| 133 | 124 |
| 134 SendReport(); | 125 SendReport(); |
| 135 } | 126 } |
| OLD | NEW |