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

Unified Diff: chrome/browser/safe_browsing/srt_fetcher_win.h

Issue 2226133005: Add support for the ExperimentalSwReporterEngine field trial. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move regexps to local vars Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/safe_browsing/srt_fetcher_win.h
diff --git a/chrome/browser/safe_browsing/srt_fetcher_win.h b/chrome/browser/safe_browsing/srt_fetcher_win.h
index 7d310194d93001db65c2c1556608c6649b85319a..66ba4cb89eb063ba1586916250ed1782bd6c4478 100644
--- a/chrome/browser/safe_browsing/srt_fetcher_win.h
+++ b/chrome/browser/safe_browsing/srt_fetcher_win.h
@@ -8,13 +8,14 @@
#include <limits.h>
#include <string>
+#include <vector>
#include "base/callback_forward.h"
+#include "base/command_line.h"
#include "base/memory/ref_counted.h"
#include "base/version.h"
namespace base {
-class FilePath;
class TaskRunner;
}
@@ -43,19 +44,58 @@ const int kDaysBetweenSwReporterRunsForPendingPrompt = 1;
// To test SRT Fetches.
const int kSRTFetcherID = 47;
+// Parameters used to invoke the sw_reporter component.
+struct SwReporterInvocation {
+ base::CommandLine command_line;
+
+ // Experimental versions of the reporter will write metrics to registry keys
+ // ending in |suffix|. Those metrics should be copid to UMA histograms also
csharp 2016/08/11 18:58:02 nit: copid -> copied
Joe Mason 2016/08/15 17:24:40 Done.
+ // ending in |suffix|. For the canonical version, |suffix| will be empty.
+ std::string suffix;
+
csharp 2016/08/11 18:58:02 I think this should always contain a bool to deter
Joe Mason 2016/08/15 17:24:40 Done.
+ SwReporterInvocation();
+ explicit SwReporterInvocation(const base::FilePath& exe_path);
+ SwReporterInvocation(const base::CommandLine& command_line,
+ const std::string& suffix);
+
+ bool operator==(const SwReporterInvocation& other) const;
csharp 2016/08/11 18:58:02 Why do you need to compare SwReporterInvocations?
Joe Mason 2016/08/15 17:24:40 ReporterRunner::Run starts with a check to see if
+};
+
// Tries to run the sw_reporter component, and then schedule the next try. If
// called multiple times, then multiple sequences of trying to run will happen,
// yet only one reporter will run per specified period (either
// |kDaysBetweenSuccessfulSwReporterRuns| or
// |kDaysBetweenSwReporterRunsForPendingPrompt|) will actually happen.
-// |exe_path| is the full path to the SwReporter to execute and |version| is its
-// version. The task runners are provided to allow tests to provide their own.
+// |command_line| is the command line to execute, including the full path to
+// the SwReporter to execute, and |version| is its version. The task runners are
+// provided to allow tests to provide their own.
void RunSwReporter(
csharp 2016/08/11 18:58:02 Why not merge this and the next function and make
Joe Mason 2016/08/15 17:24:40 I removed Experimental from the function name but
const base::FilePath& exe_path,
const base::Version& version,
const scoped_refptr<base::TaskRunner>& main_thread_task_runner,
const scoped_refptr<base::TaskRunner>& blocking_task_runner);
+// Try to run multiple invocations of the experimental sw_reporter component,
+// with different combinations of command line args. Each set of invocations is
+// treated as a normal scheduled launch of the sw_reporter for the purposes of
+// retries, as described in |RunSwReporter|.
+//
+// |invocation_queue| is a list of sw_reporter configurations which will be
+// launched in order. Once one has been executed, the reporter is considered to
+// have "run" - the remainder will also be executed as part of this run, but
+// then the reporter will not be run again for the specified period. If none of
+// the invocations in the queue execute, another queue can be tried by calling
+// this function again.
+//
+// See |RunSwReporter| for the meaning of the remaining parameters.
+//
+// The experimental sw_reporter never triggers the prompt, just reports results.
+void RunExperimentalSwReporters(
+ const std::vector<SwReporterInvocation>& invocation_queue,
+ const base::Version& version,
+ const scoped_refptr<base::TaskRunner>& main_thread_task_runner,
grt (UTC plus 2) 2016/08/10 06:47:02 since this function holds a reference to these two
Joe Mason 2016/08/15 17:24:40 Done.
+ const scoped_refptr<base::TaskRunner>& blocking_task_runner);
+
// Returns true iff Local State is successfully accessed and indicates the most
// recent Reporter run terminated with an exit code indicating the presence of
// UwS.

Powered by Google App Engine
This is Rietveld 408576698