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

Unified Diff: components/offline_pages/background/request_coordinator_event_logger.cc

Issue 2209813002: [Offline Pages] Moves Coordinator to using MarkAttemptStarted/MarkAttemptCompleted API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge 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: components/offline_pages/background/request_coordinator_event_logger.cc
diff --git a/components/offline_pages/background/request_coordinator_event_logger.cc b/components/offline_pages/background/request_coordinator_event_logger.cc
index 12ddf8c2fa177fff27972655814cb4ddbb699400..08702920a734dcb463a7c53df1d9a3cf38145bbb 100644
--- a/components/offline_pages/background/request_coordinator_event_logger.cc
+++ b/components/offline_pages/background/request_coordinator_event_logger.cc
@@ -2,19 +2,69 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include <string>
-
#include "components/offline_pages/background/request_coordinator_event_logger.h"
namespace offline_pages {
+namespace {
+
+static std::string OfflinerRequestStatusToString(
+ Offliner::RequestStatus request_status) {
+ switch (request_status) {
+ case Offliner::UNKNOWN:
+ return "UNKNOWN";
+ case Offliner::LOADED:
+ return "LOADED";
+ case Offliner::SAVED:
+ return "SAVED";
+ case Offliner::REQUEST_COORDINATOR_CANCELED:
+ return "REQUEST_COORDINATOR_CANCELED";
+ case Offliner::PRERENDERING_CANCELED:
+ return "PRERENDERING_CANCELED";
+ case Offliner::PRERENDERING_FAILED:
+ return "PRERENDERING_FAILED";
+ case Offliner::SAVE_FAILED:
+ return "SAVE_FAILED";
+ case Offliner::FOREGROUND_CANCELED:
+ return "FOREGROUND_CANCELED";
+ default:
+ DCHECK(false);
+ return "";
+ }
+}
+
+static std::string UpdateRequestResultToString(
+ RequestQueue::UpdateRequestResult result) {
+ switch (result) {
+ case RequestQueue::UpdateRequestResult::SUCCESS:
+ return "SUCCESS";
+ case RequestQueue::UpdateRequestResult::STORE_FAILURE:
+ return "STORE_FAILURE";
+ case RequestQueue::UpdateRequestResult::REQUEST_DOES_NOT_EXIST:
+ return "REQUEST_DOES_NOT_EXIST";
+ default:
+ DCHECK(false);
+ return "";
+ }
+}
+
+} // namespace
+
void RequestCoordinatorEventLogger::RecordSavePageRequestUpdated(
const std::string& name_space,
- const std::string& new_status,
+ Offliner::RequestStatus new_status,
int64_t id) {
RecordActivity("Save page request for ID: " + std::to_string(id) +
" and namespace: " + name_space +
- " has been updated with status " + new_status);
+ " has been updated with status " +
+ OfflinerRequestStatusToString(new_status));
+}
+
+void RequestCoordinatorEventLogger::RecordUpdateRequestFailed(
+ const std::string& name_space,
+ RequestQueue::UpdateRequestResult result) {
+ RecordActivity("Updating queued request for namespace: " + name_space +
+ " failed with result: " + UpdateRequestResultToString(result));
}
} // namespace offline_pages

Powered by Google App Engine
This is Rietveld 408576698