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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 attached_file, | 164 attached_file, |
165 *(attached_filedata_.get()), | 165 *(attached_filedata_.get()), |
166 compressed_file_ptr), | 166 compressed_file_ptr), |
167 base::Bind(&FeedbackData::OnCompressFileComplete, | 167 base::Bind(&FeedbackData::OnCompressFileComplete, |
168 this, | 168 this, |
169 base::Passed(&compressed_file))); | 169 base::Passed(&compressed_file))); |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void FeedbackData::OnGetTraceData( | 173 void FeedbackData::OnGetTraceData( |
174 int trace_id_, | 174 int trace_id, |
175 scoped_refptr<base::RefCountedString> trace_data) { | 175 scoped_refptr<base::RefCountedString> trace_data) { |
176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 176 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
177 TracingManager* manager = TracingManager::Get(); | 177 TracingManager* manager = TracingManager::Get(); |
178 if (manager) | 178 if (manager) |
179 manager->DiscardTraceData(trace_id_); | 179 manager->DiscardTraceData(trace_id); |
180 | 180 |
181 scoped_ptr<std::string> data(new std::string(trace_data->data())); | 181 scoped_ptr<std::string> data(new std::string); |
| 182 data->swap(trace_data->data()); |
182 | 183 |
183 attached_filename_ = kTraceFilename; | 184 attached_filename_ = kTraceFilename; |
184 attached_filedata_ = data.Pass(); | 185 attached_filedata_ = data.Pass(); |
| 186 attached_file_compression_complete_ = true; |
185 trace_id_ = 0; | 187 trace_id_ = 0; |
186 | 188 |
187 set_category_tag(kPerformanceCategoryTag); | 189 set_category_tag(kPerformanceCategoryTag); |
188 | 190 |
189 SendReport(); | 191 SendReport(); |
190 } | 192 } |
191 | 193 |
192 void FeedbackData::OnCompressLogsComplete( | 194 void FeedbackData::OnCompressLogsComplete( |
193 scoped_ptr<std::string> compressed_logs) { | 195 scoped_ptr<std::string> compressed_logs) { |
194 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 196 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
(...skipping 27 matching lines...) Expand all Loading... |
222 feedback_page_data_complete_; | 224 feedback_page_data_complete_; |
223 } | 225 } |
224 | 226 |
225 void FeedbackData::SendReport() { | 227 void FeedbackData::SendReport() { |
226 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 228 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
227 if (IsDataComplete() && !report_sent_) { | 229 if (IsDataComplete() && !report_sent_) { |
228 report_sent_ = true; | 230 report_sent_ = true; |
229 feedback_util::SendReport(this); | 231 feedback_util::SendReport(this); |
230 } | 232 } |
231 } | 233 } |
OLD | NEW |