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 "chrome/browser/tracing/background_tracing_field_trial.h" | 5 #include "chrome/browser/tracing/background_tracing_field_trial.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
8 | 9 |
9 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
10 #include "base/metrics/field_trial.h" | 11 #include "base/metrics/field_trial.h" |
11 #include "chrome/browser/browser_process.h" | 12 #include "chrome/browser/browser_process.h" |
12 #include "chrome/browser/tracing/crash_service_uploader.h" | 13 #include "chrome/browser/tracing/crash_service_uploader.h" |
13 #include "chrome/common/variations/variations_util.h" | 14 #include "chrome/common/variations/variations_util.h" |
14 #include "components/variations/variations_associated_data.h" | 15 #include "components/variations/variations_associated_data.h" |
15 #include "content/public/browser/background_tracing_config.h" | 16 #include "content/public/browser/background_tracing_config.h" |
16 #include "content/public/browser/background_tracing_manager.h" | 17 #include "content/public/browser/background_tracing_manager.h" |
17 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
(...skipping 22 matching lines...) Expand all Loading... |
40 scoped_ptr<const base::DictionaryValue> metadata, | 41 scoped_ptr<const base::DictionaryValue> metadata, |
41 base::Closure callback) { | 42 base::Closure callback) { |
42 TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( | 43 TraceCrashServiceUploader* uploader = new TraceCrashServiceUploader( |
43 g_browser_process->system_request_context()); | 44 g_browser_process->system_request_context()); |
44 | 45 |
45 if (GURL(upload_url).is_valid()) | 46 if (GURL(upload_url).is_valid()) |
46 uploader->SetUploadURL(upload_url); | 47 uploader->SetUploadURL(upload_url); |
47 | 48 |
48 uploader->DoUpload( | 49 uploader->DoUpload( |
49 file_contents->data(), content::TraceUploader::UNCOMPRESSED_UPLOAD, | 50 file_contents->data(), content::TraceUploader::UNCOMPRESSED_UPLOAD, |
50 metadata.Pass(), content::TraceUploader::UploadProgressCallback(), | 51 std::move(metadata), content::TraceUploader::UploadProgressCallback(), |
51 base::Bind(&OnUploadComplete, base::Owned(uploader), callback)); | 52 base::Bind(&OnUploadComplete, base::Owned(uploader), callback)); |
52 } | 53 } |
53 | 54 |
54 } // namespace | 55 } // namespace |
55 | 56 |
56 void SetConfigTextFilterForTesting(ConfigTextFilterForTesting predicate) { | 57 void SetConfigTextFilterForTesting(ConfigTextFilterForTesting predicate) { |
57 g_config_text_filter_for_testing = predicate; | 58 g_config_text_filter_for_testing = predicate; |
58 } | 59 } |
59 | 60 |
60 void SetupBackgroundTracingFieldTrial() { | 61 void SetupBackgroundTracingFieldTrial() { |
(...skipping 15 matching lines...) Expand all Loading... |
76 const base::DictionaryValue* dict = nullptr; | 77 const base::DictionaryValue* dict = nullptr; |
77 if (!value->GetAsDictionary(&dict)) | 78 if (!value->GetAsDictionary(&dict)) |
78 return; | 79 return; |
79 | 80 |
80 scoped_ptr<content::BackgroundTracingConfig> config = | 81 scoped_ptr<content::BackgroundTracingConfig> config = |
81 content::BackgroundTracingConfig::FromDict(dict); | 82 content::BackgroundTracingConfig::FromDict(dict); |
82 if (!config) | 83 if (!config) |
83 return; | 84 return; |
84 | 85 |
85 content::BackgroundTracingManager::GetInstance()->SetActiveScenario( | 86 content::BackgroundTracingManager::GetInstance()->SetActiveScenario( |
86 config.Pass(), base::Bind(&UploadCallback, upload_url), | 87 std::move(config), base::Bind(&UploadCallback, upload_url), |
87 content::BackgroundTracingManager::ANONYMIZE_DATA); | 88 content::BackgroundTracingManager::ANONYMIZE_DATA); |
88 } | 89 } |
89 | 90 |
90 } // namespace tracing | 91 } // namespace tracing |
OLD | NEW |