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

Unified Diff: components/download/internal/stats.h

Issue 2895953004: Add initial Controller to DownloadService (Closed)
Patch Set: Rebased Created 3 years, 7 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
« no previous file with comments | « components/download/internal/startup_status.cc ('k') | components/download/internal/stats.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/download/internal/stats.h
diff --git a/components/download/internal/stats.h b/components/download/internal/stats.h
new file mode 100644
index 0000000000000000000000000000000000000000..51427601b82c3738a93d14bb2cf80a522db8ef3a
--- /dev/null
+++ b/components/download/internal/stats.h
@@ -0,0 +1,81 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DOWNLOAD_INTERNAL_STATS_H_
+#define COMPONENTS_DOWNLOAD_INTERNAL_STATS_H_
+
+#include "components/download/public/clients.h"
+#include "components/download/public/download_params.h"
+
+namespace download {
+
+struct StartupStatus;
+
+namespace stats {
+
+// Please follow the following rules for all enums:
+// 1. Keep them in sync with the corresponding entry in enums.xml.
+// 2. Treat them as append only.
+// 3. Do not remove any enums. Only mark them as deprecated.
+
+// Enum used by UMA metrics to track which actions a Client is taking on the
+// service.
+enum class ServiceApiAction {
+ // Represents a call to DownloadService::StartDownload.
+ START_DOWNLOAD = 0,
+
+ // Represents a call to DownloadService::PauseDownload.
+ PAUSE_DOWNLOAD = 1,
+
+ // Represents a call to DownloadService::ResumeDownload.
+ RESUME_DOWNLOAD = 2,
+
+ // Represents a call to DownloadService::CancelDownload.
+ CANCEL_DOWNLOAD = 3,
+
+ // Represents a call to DownloadService::ChangeCriteria.
+ CHANGE_CRITERIA = 4,
+
+ // The last entry for the enum.
+ COUNT = 5,
+};
+
+// Enum used by UMA metrics to tie to specific actions taken on a Model. This
+// can be used to track failure events.
+enum class ModelAction {
+ // Represents an attempt to initialize the Model.
+ INITIALIZE = 0,
+
+ // Represents an attempt to add an Entry to the Model.
+ ADD = 1,
+
+ // Represents an attempt to update an Entry in the Model.
+ UPDATE = 2,
+
+ // Represents an attempt to remove an Entry from the Model.
+ REMOVE = 3,
+
+ // The last entry for the enum.
+ COUNT = 4,
+};
+
+// Logs the results of starting up the Controller. Will log each failure reason
+// if |status| contains more than one initialization failure.
+void LogControllerStartupStatus(const StartupStatus& status);
+
+// Logs an action taken on the service API.
+void LogServiceApiAction(DownloadClient client, ServiceApiAction action);
+
+// Logs the result of a StartDownload() attempt on the service.
+void LogStartDownloadResult(DownloadClient client,
+ DownloadParams::StartResult result);
+
+// Logs statistics about the result of a Model operation. Used to track failure
+// cases.
+void LogModelOperationResult(ModelAction action, bool success);
+
+} // namespace stats
+} // namespace download
+
+#endif // COMPONENTS_DOWNLOAD_INTERNAL_STATS_H_
« no previous file with comments | « components/download/internal/startup_status.cc ('k') | components/download/internal/stats.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698