| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <string> | 5 #include <string> |
| 6 | 6 |
| 7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
| 8 #include "base/metrics/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
| 10 #include "chrome/browser/tracing/crash_service_uploader.h" | 10 #include "chrome/browser/tracing/crash_service_uploader.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 } | 27 } |
| 28 | 28 |
| 29 void OnUploadComplete(TraceCrashServiceUploader* uploader, | 29 void OnUploadComplete(TraceCrashServiceUploader* uploader, |
| 30 base::Closure done_callback, | 30 base::Closure done_callback, |
| 31 bool success, | 31 bool success, |
| 32 const std::string& feedback) { | 32 const std::string& feedback) { |
| 33 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 33 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 34 done_callback.Run(); | 34 done_callback.Run(); |
| 35 } | 35 } |
| 36 | 36 |
| 37 void UploadCallback(const base::RefCountedString* file_contents, | 37 void UploadCallback(const scoped_refptr<base::RefCountedString>& file_contents, |
| 38 base::Closure callback) { | 38 base::Closure callback) { |
| 39 TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( | 39 TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( |
| 40 g_browser_process->system_request_context()); | 40 g_browser_process->system_request_context()); |
| 41 | 41 |
| 42 uploader->DoUpload( | 42 uploader->DoUpload( |
| 43 file_contents->data(), base::Bind(&OnUploadProgress), | 43 file_contents->data(), base::Bind(&OnUploadProgress), |
| 44 base::Bind(&OnUploadComplete, base::Owned(uploader), callback)); | 44 base::Bind(&OnUploadComplete, base::Owned(uploader), callback)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 } // namespace | 47 } // namespace |
| (...skipping 11 matching lines...) Expand all Loading... |
| 59 const base::DictionaryValue* dict = nullptr; | 59 const base::DictionaryValue* dict = nullptr; |
| 60 if (!value->GetAsDictionary(&dict)) | 60 if (!value->GetAsDictionary(&dict)) |
| 61 return; | 61 return; |
| 62 | 62 |
| 63 scoped_ptr<content::BackgroundTracingConfig> config = | 63 scoped_ptr<content::BackgroundTracingConfig> config = |
| 64 content::BackgroundTracingConfig::FromDict(dict); | 64 content::BackgroundTracingConfig::FromDict(dict); |
| 65 if (!config) | 65 if (!config) |
| 66 return; | 66 return; |
| 67 | 67 |
| 68 content::BackgroundTracingManager::GetInstance()->SetActiveScenario( | 68 content::BackgroundTracingManager::GetInstance()->SetActiveScenario( |
| 69 config.Pass(), base::Bind(&UploadCallback), true); | 69 config.Pass(), base::Bind(&UploadCallback), |
| 70 content::BackgroundTracingManager::ANONYMIZE_DATA); |
| 70 } | 71 } |
| 71 | 72 |
| 72 } // namespace tracing | 73 } // namespace tracing |
| OLD | NEW |