Chromium Code Reviews| 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 08702920a734dcb463a7c53df1d9a3cf38145bbb..997d70ed303f3a2eb7e6b72f13026ca236890f0a 100644 |
| --- a/components/offline_pages/background/request_coordinator_event_logger.cc |
| +++ b/components/offline_pages/background/request_coordinator_event_logger.cc |
| @@ -29,7 +29,34 @@ static std::string OfflinerRequestStatusToString( |
| return "FOREGROUND_CANCELED"; |
| default: |
| DCHECK(false); |
| - return ""; |
| + return std::to_string(static_cast<int>(request_status)); |
| + } |
| +} |
| + |
| +static std::string BackgroundSavePageResultToString( |
| + RequestNotifier::BackgroundSavePageResult result) { |
| + switch (result) { |
| + case RequestNotifier::BackgroundSavePageResult::SUCCESS: |
| + return "SUCCESS"; |
| + case RequestNotifier::BackgroundSavePageResult::PRERENDER_FAILURE: |
| + return "PRERENDER_FAILURE"; |
| + case RequestNotifier::BackgroundSavePageResult::PRERENDER_CANCELED: |
| + return "PRERENDER_CANCELED"; |
| + case RequestNotifier::BackgroundSavePageResult::FOREGROUND_CANCELED: |
| + return "FOREGROUND_CANCELED"; |
| + case RequestNotifier::BackgroundSavePageResult::SAVE_FAILED: |
| + return "SAVE_FAILED"; |
| + case RequestNotifier::BackgroundSavePageResult::EXPIRED: |
| + return "EXPIRED"; |
| + case RequestNotifier::BackgroundSavePageResult::RETRY_COUNT_EXCEEDED: |
| + return "RETRY_COUNT_EXCEEDED"; |
| + case RequestNotifier::BackgroundSavePageResult::START_COUNT_EXCEEDED: |
| + return "START_COUNT_EXCEEDED"; |
| + case RequestNotifier::BackgroundSavePageResult::REMOVED: |
| + return "REMOVED"; |
| + default: |
| + DCHECK(false); |
|
Dmitry Titov
2016/09/12 19:43:13
NOTREACHED() is better to document an intent here.
dougarnett
2016/09/12 20:51:49
Done.
|
| + return std::to_string(static_cast<int>(result)); |
| } |
| } |
| @@ -44,27 +71,35 @@ static std::string UpdateRequestResultToString( |
| return "REQUEST_DOES_NOT_EXIST"; |
| default: |
| DCHECK(false); |
| - return ""; |
| + return std::to_string(static_cast<int>(result)); |
| } |
| } |
| } // namespace |
| -void RequestCoordinatorEventLogger::RecordSavePageRequestUpdated( |
| +void RequestCoordinatorEventLogger::RecordOfflinerResult( |
| const std::string& name_space, |
| 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 " + |
| + int64_t request_id) { |
| + RecordActivity("Background save attempt for " + name_space + ":" + |
| + std::to_string(request_id) + " - " + |
| OfflinerRequestStatusToString(new_status)); |
| } |
| +void RequestCoordinatorEventLogger::RecordDroppedSavePageRequest( |
| + const std::string& name_space, |
| + RequestNotifier::BackgroundSavePageResult result, |
| + int64_t request_id) { |
| + RecordActivity("Background save request removed " + name_space + ":" + |
| + std::to_string(request_id) + " - " + |
| + BackgroundSavePageResultToString(result)); |
| +} |
| + |
| void RequestCoordinatorEventLogger::RecordUpdateRequestFailed( |
| const std::string& name_space, |
| RequestQueue::UpdateRequestResult result) { |
| - RecordActivity("Updating queued request for namespace: " + name_space + |
| - " failed with result: " + UpdateRequestResultToString(result)); |
| + RecordActivity("Updating queued request for " + name_space + " failed - " + |
| + UpdateRequestResultToString(result)); |
| } |
| } // namespace offline_pages |