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

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

Issue 2324493005: [Offline Pages] Adds event logs for requests dropped due to number of start or complete attempts. (Closed)
Patch Set: Fixed a new comment and also made the new comments a bit less fragile to specific logger method nam… Created 4 years, 3 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.cc
diff --git a/components/offline_pages/background/request_coordinator.cc b/components/offline_pages/background/request_coordinator.cc
index cddeedbf81b7d3e98bbc6d8881ff761295847556..0fb2277184008260f65fd2cbb727813205198428 100644
--- a/components/offline_pages/background/request_coordinator.cc
+++ b/components/offline_pages/background/request_coordinator.cc
@@ -94,7 +94,8 @@ RequestCoordinator::RequestCoordinator(std::unique_ptr<OfflinerPolicy> policy,
policy_->GetSinglePageTimeLimitInSeconds())),
weak_ptr_factory_(this) {
DCHECK(policy_ != nullptr);
- picker_.reset(new RequestPicker(queue_.get(), policy_.get(), this));
+ picker_.reset(
+ new RequestPicker(queue_.get(), policy_.get(), this, &event_logger_));
}
RequestCoordinator::~RequestCoordinator() {}
@@ -196,6 +197,9 @@ void RequestCoordinator::AbortRequestAttempt(SavePageRequest* request) {
if (request->started_attempt_count() >= policy_->GetMaxStartedTries()) {
RemoveAttemptedRequest(*request,
BackgroundSavePageResult::START_COUNT_EXCEEDED);
+ event_logger_.RecordDroppedSavePageRequest(
+ request->client_id().name_space,
+ BackgroundSavePageResult::START_COUNT_EXCEEDED, request->request_id());
Dmitry Titov 2016/09/12 19:43:13 I'd pull the constant into a local const variable
dougarnett 2016/09/12 20:51:49 Done.
} else {
queue_->UpdateRequest(
*request,
@@ -205,13 +209,14 @@ void RequestCoordinator::AbortRequestAttempt(SavePageRequest* request) {
}
void RequestCoordinator::RemoveAttemptedRequest(
- const SavePageRequest& request, BackgroundSavePageResult status) {
+ const SavePageRequest& request,
+ BackgroundSavePageResult result) {
std::vector<int64_t> remove_requests;
remove_requests.push_back(request.request_id());
queue_->RemoveRequests(remove_requests,
base::Bind(&RequestCoordinator::HandleRemovedRequests,
- weak_ptr_factory_.GetWeakPtr(), status));
- RecordAttemptCount(request, status);
+ weak_ptr_factory_.GetWeakPtr(), result));
+ RecordAttemptCount(request, result);
}
void RequestCoordinator::RemoveRequests(
@@ -476,8 +481,8 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
<< ", status: " << static_cast<int>(status) << ", " << __func__;
DCHECK_NE(status, Offliner::RequestStatus::UNKNOWN);
DCHECK_NE(status, Offliner::RequestStatus::LOADED);
- event_logger_.RecordSavePageRequestUpdated(request.client_id().name_space,
- status, request.request_id());
+ event_logger_.RecordOfflinerResult(request.client_id().name_space, status,
+ request.request_id());
last_offlining_status_ = status;
RecordOfflinerResultUMA(request.client_id(), last_offlining_status_);
watchdog_timer_.Stop();
@@ -504,6 +509,9 @@ void RequestCoordinator::OfflinerDoneCallback(const SavePageRequest& request,
// has not yet been updated when we are checking the if condition.
RemoveAttemptedRequest(request,
BackgroundSavePageResult::RETRY_COUNT_EXCEEDED);
+ event_logger_.RecordDroppedSavePageRequest(
+ request.client_id().name_space,
+ BackgroundSavePageResult::RETRY_COUNT_EXCEEDED, request.request_id());
} else {
// If we failed, but are not over the limit, update the request in the
// queue.

Powered by Google App Engine
This is Rietveld 408576698