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

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: Fix case of flags constants 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 d1a8872065e341e299c68b63a7a290a21a97e675..279d3e3b608d034c2353249c015c7b324ab98230 100644
--- a/chrome/browser/safe_browsing/srt_fetcher_win.h
+++ b/chrome/browser/safe_browsing/srt_fetcher_win.h
@@ -7,6 +7,7 @@
#include <limits.h>
+#include <queue>
#include <string>
#include "base/callback_forward.h"
@@ -50,9 +51,16 @@ struct SwReporterInvocation {
// ending in |suffix|. For the canonical version, |suffix| will be empty.
std::string suffix;
- // The experimental sw_reporter never triggers the prompt, just reports
- // results through UMA.
- bool is_experimental = false;
+ // Flags to control optional behaviours. By default all are enabled;
+ // experimental versions of the reporter will turn off the behaviours that
+ // are not yet supported.
+ using Flags = unsigned int;
grt (UTC plus 2) 2016/09/01 21:08:56 "unsigned int" is almost never what you want; see
Joe Mason 2016/09/02 02:24:30 Done.
+ enum : Flags {
+ FLAG_LOG_TO_RAPPOR = 0x1,
+ FLAG_LOG_TO_PREFS = 0x2,
+ FLAG_TRIGGER_PROMPT = 0x4,
+ };
+ Flags flags = FLAG_LOG_TO_RAPPOR | FLAG_LOG_TO_PREFS | FLAG_TRIGGER_PROMPT;
SwReporterInvocation();
@@ -63,18 +71,25 @@ struct SwReporterInvocation {
bool operator==(const SwReporterInvocation& other) const;
};
+using SwReporterQueue = std::queue<SwReporterInvocation>;
+
// 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
+// yet only one SwReporterQueue will run per specified period (either
// |kDaysBetweenSuccessfulSwReporterRuns| or
// |kDaysBetweenSwReporterRunsForPendingPrompt|) will actually happen.
grt (UTC plus 2) 2016/09/01 21:08:55 i think " will actually happen" should be removed.
Joe Mason 2016/09/02 02:24:30 Done.
-// |invocation| is the details of the SwReporter to execute, and |version| is
-// its version. The task runners are provided to allow tests to provide their
-// own.
-void RunSwReporter(const SwReporterInvocation& invocation,
- const base::Version& version,
- scoped_refptr<base::TaskRunner> main_thread_task_runner,
- scoped_refptr<base::TaskRunner> blocking_task_runner);
+//
+// Each "run" of the sw_reporter component may actually involve executing the
grt (UTC plus 2) 2016/09/01 21:08:55 suggestion: "...may aggregate the results of sever
Joe Mason 2016/09/02 02:24:30 Done.
+// tool several times with different command-lines, and aggregating the
+// results. |invocations| is the queue of SwReporters to execute as a single
+// "run". When a new try is scheduled the entire queue is executed.
+//
+// |version| is the version of the tool that will run. The task runners are
+// provided to allow tests to provide their own.
+void RunSwReporters(const SwReporterQueue& invocations,
+ const base::Version& version,
+ scoped_refptr<base::TaskRunner> main_thread_task_runner,
+ 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

Powered by Google App Engine
This is Rietveld 408576698