Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(975)

Side by Side Diff: chrome/browser/component_updater/sw_reporter_installer_win.cc

Issue 2347753002: Adds histograms for tracking Software Reporter logs uploads in SRT Fetcher. (Closed)
Patch Set: Fix comment in RunSwReporterAfterStartup Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 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/component_updater/sw_reporter_installer_win.h" 5 #include "chrome/browser/component_updater/sw_reporter_installer_win.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <map> 10 #include <map>
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 UMA_HISTOGRAM_COUNTS_100("SoftwareReporter.UploadLongestFailureRun", 112 UMA_HISTOGRAM_COUNTS_100("SoftwareReporter.UploadLongestFailureRun",
113 longest_failure_run); 113 longest_failure_run);
114 UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.LastUploadResult", last_result); 114 UMA_HISTOGRAM_BOOLEAN("SoftwareReporter.LastUploadResult", last_result);
115 } 115 }
116 116
117 void ReportExperimentError(SwReporterExperimentError error) { 117 void ReportExperimentError(SwReporterExperimentError error) {
118 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.ExperimentErrors", error, 118 UMA_HISTOGRAM_ENUMERATION("SoftwareReporter.ExperimentErrors", error,
119 SW_REPORTER_EXPERIMENT_ERROR_MAX); 119 SW_REPORTER_EXPERIMENT_ERROR_MAX);
120 } 120 }
121 121
122 // Run the software reporter on the next Chrome startup after it's downloaded. 122 // Schedules the software reporter to run after browser startup once it's
Joe Mason 2016/09/16 14:57:13 I think this is still ambiguous - "after browser s
ftirelo 2016/09/16 15:34:41 Done.
grt (UTC plus 2) 2016/09/16 15:59:20 how about "...to run sometime after browser startu
ftirelo 2016/09/16 19:26:55 I kept the "current browser", because even though
123 // (This is the default |reporter_runner| function passed to the 123 // downloaded. (This is the default |reporter_runner| function passed to the
124 // |SwReporterInstallerTraits| constructor in |RegisterSwReporterComponent| 124 // |SwReporterInstallerTraits| constructor in |RegisterSwReporterComponent|
125 // below.) 125 // below.)
126 void RunSwReportersAfterStartup( 126 void RunSwReportersAfterStartup(
127 const safe_browsing::SwReporterQueue& invocations, 127 const safe_browsing::SwReporterQueue& invocations,
128 const base::Version& version) { 128 const base::Version& version) {
129 content::BrowserThread::PostAfterStartupTask( 129 content::BrowserThread::PostAfterStartupTask(
130 FROM_HERE, base::ThreadTaskRunnerHandle::Get(), 130 FROM_HERE, base::ThreadTaskRunnerHandle::Get(),
131 base::Bind(&safe_browsing::RunSwReporters, invocations, version, 131 base::Bind(&safe_browsing::RunSwReporters, invocations, version,
132 base::ThreadTaskRunnerHandle::Get(), 132 base::ThreadTaskRunnerHandle::Get(),
133 base::WorkerPool::GetTaskRunner(true))); 133 base::WorkerPool::GetTaskRunner(true)));
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 209
210 base::CommandLine command_line(argv); 210 base::CommandLine command_line(argv);
211 211
212 // Add the histogram suffix to the command-line as well, so that the 212 // Add the histogram suffix to the command-line as well, so that the
213 // reporter will add the same suffix to registry keys where it writes 213 // reporter will add the same suffix to registry keys where it writes
214 // metrics. 214 // metrics.
215 if (!suffix.empty()) 215 if (!suffix.empty())
216 command_line.AppendSwitchASCII("registry-suffix", suffix); 216 command_line.AppendSwitchASCII("registry-suffix", suffix);
217 217
218 // "prompt" is optional, but if present must be a boolean. 218 // "prompt" is optional, but if present must be a boolean.
219 SwReporterInvocation::Flags flags = 0; 219 SwReporterInvocation::ReporterBehaviours supported_behaviours = 0;
220 const base::Value* prompt_value = nullptr; 220 const base::Value* prompt_value = nullptr;
221 if (invocation_params->Get("prompt", &prompt_value)) { 221 if (invocation_params->Get("prompt", &prompt_value)) {
222 bool prompt = false; 222 bool prompt = false;
223 if (!prompt_value->GetAsBoolean(&prompt)) { 223 if (!prompt_value->GetAsBoolean(&prompt)) {
224 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS); 224 ReportExperimentError(SW_REPORTER_EXPERIMENT_ERROR_BAD_PARAMS);
225 return; 225 return;
226 } 226 }
227 if (prompt) 227 if (prompt)
228 flags |= SwReporterInvocation::FLAG_TRIGGER_PROMPT; 228 supported_behaviours |=
229 SwReporterInvocation::REPORTER_BEHAVIOUR_TRIGGER_PROMPT;
229 } 230 }
230 231
231 auto invocation = SwReporterInvocation::FromCommandLine(command_line); 232 auto invocation = SwReporterInvocation::FromCommandLine(command_line);
232 invocation.suffix = suffix; 233 invocation.suffix = suffix;
233 invocation.flags = flags; 234 invocation.supported_behaviours = supported_behaviours;
234 invocations.push(invocation); 235 invocations.push(invocation);
235 } 236 }
236 237
237 DCHECK(!invocations.empty()); 238 DCHECK(!invocations.empty());
238 reporter_runner.Run(invocations, version); 239 reporter_runner.Run(invocations, version);
239 } 240 }
240 241
241 } // namespace 242 } // namespace
242 243
243 SwReporterInstallerTraits::SwReporterInstallerTraits( 244 SwReporterInstallerTraits::SwReporterInstallerTraits(
(...skipping 29 matching lines...) Expand all
273 const base::Version& version, 274 const base::Version& version,
274 const base::FilePath& install_dir, 275 const base::FilePath& install_dir,
275 std::unique_ptr<base::DictionaryValue> manifest) { 276 std::unique_ptr<base::DictionaryValue> manifest) {
276 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); 277 DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
277 const base::FilePath exe_path(install_dir.Append(kSwReporterExeName)); 278 const base::FilePath exe_path(install_dir.Append(kSwReporterExeName));
278 if (IsExperimentalEngineEnabled()) { 279 if (IsExperimentalEngineEnabled()) {
279 RunExperimentalSwReporter(exe_path, version, std::move(manifest), 280 RunExperimentalSwReporter(exe_path, version, std::move(manifest),
280 reporter_runner_); 281 reporter_runner_);
281 } else { 282 } else {
282 auto invocation = SwReporterInvocation::FromFilePath(exe_path); 283 auto invocation = SwReporterInvocation::FromFilePath(exe_path);
283 invocation.flags = SwReporterInvocation::FLAG_LOG_TO_RAPPOR | 284 invocation.supported_behaviours =
284 SwReporterInvocation::FLAG_LOG_EXIT_CODE_TO_PREFS | 285 SwReporterInvocation::REPORTER_BEHAVIOUR_LOG_TO_RAPPOR |
285 SwReporterInvocation::FLAG_TRIGGER_PROMPT | 286 SwReporterInvocation::REPORTER_BEHAVIOUR_LOG_EXIT_CODE_TO_PREFS |
286 SwReporterInvocation::FLAG_SEND_REPORTER_LOGS; 287 SwReporterInvocation::REPORTER_BEHAVIOUR_TRIGGER_PROMPT |
288 SwReporterInvocation::REPORTER_BEHAVIOUR_SEND_REPORTER_LOGS;
287 289
288 safe_browsing::SwReporterQueue invocations; 290 safe_browsing::SwReporterQueue invocations;
289 invocations.push(invocation); 291 invocations.push(invocation);
290 reporter_runner_.Run(invocations, version); 292 reporter_runner_.Run(invocations, version);
291 } 293 }
292 } 294 }
293 295
294 base::FilePath SwReporterInstallerTraits::GetRelativeInstallDir() const { 296 base::FilePath SwReporterInstallerTraits::GetRelativeInstallDir() const {
295 return base::FilePath(FILE_PATH_LITERAL("SwReporter")); 297 return base::FilePath(FILE_PATH_LITERAL("SwReporter"));
296 } 298 }
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 } 441 }
440 442
441 void RegisterProfilePrefsForSwReporter( 443 void RegisterProfilePrefsForSwReporter(
442 user_prefs::PrefRegistrySyncable* registry) { 444 user_prefs::PrefRegistrySyncable* registry) {
443 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, ""); 445 registry->RegisterStringPref(prefs::kSwReporterPromptVersion, "");
444 446
445 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, ""); 447 registry->RegisterStringPref(prefs::kSwReporterPromptSeed, "");
446 } 448 }
447 449
448 } // namespace component_updater 450 } // namespace component_updater
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698