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

Side by Side Diff: net/reporting/reporting_delivery_agent.cc

Issue 2900553004: Reporting: Add histograms. (Closed)
Patch Set: rebase Created 3 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/reporting/reporting_delivery_agent.h" 5 #include "net/reporting/reporting_delivery_agent.h"
6 6
7 #include <map> 7 #include <map>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 endpoint, json, 163 endpoint, json,
164 base::Bind(&ReportingDeliveryAgentImpl::OnUploadComplete, 164 base::Bind(&ReportingDeliveryAgentImpl::OnUploadComplete,
165 weak_factory_.GetWeakPtr(), 165 weak_factory_.GetWeakPtr(),
166 base::MakeUnique<Delivery>(endpoint, reports))); 166 base::MakeUnique<Delivery>(endpoint, reports)));
167 } 167 }
168 } 168 }
169 169
170 void OnUploadComplete(const std::unique_ptr<Delivery>& delivery, 170 void OnUploadComplete(const std::unique_ptr<Delivery>& delivery,
171 ReportingUploader::Outcome outcome) { 171 ReportingUploader::Outcome outcome) {
172 if (outcome == ReportingUploader::Outcome::SUCCESS) { 172 if (outcome == ReportingUploader::Outcome::SUCCESS) {
173 cache()->RemoveReports(delivery->reports); 173 cache()->RemoveReports(delivery->reports,
174 ReportingReport::Outcome::DELIVERED);
174 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, true); 175 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, true);
175 } else { 176 } else {
176 cache()->IncrementReportsAttempts(delivery->reports); 177 cache()->IncrementReportsAttempts(delivery->reports);
177 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, false); 178 endpoint_manager()->InformOfEndpointRequest(delivery->endpoint, false);
178 } 179 }
179 180
180 if (outcome == ReportingUploader::Outcome::REMOVE_ENDPOINT) 181 if (outcome == ReportingUploader::Outcome::REMOVE_ENDPOINT)
181 cache()->RemoveClientsForEndpoint(delivery->endpoint); 182 cache()->RemoveClientsForEndpoint(delivery->endpoint);
182 183
183 for (const ReportingReport* report : delivery->reports) { 184 for (const ReportingReport* report : delivery->reports) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 216
216 // static 217 // static
217 std::unique_ptr<ReportingDeliveryAgent> ReportingDeliveryAgent::Create( 218 std::unique_ptr<ReportingDeliveryAgent> ReportingDeliveryAgent::Create(
218 ReportingContext* context) { 219 ReportingContext* context) {
219 return base::MakeUnique<ReportingDeliveryAgentImpl>(context); 220 return base::MakeUnique<ReportingDeliveryAgentImpl>(context);
220 } 221 }
221 222
222 ReportingDeliveryAgent::~ReportingDeliveryAgent() {} 223 ReportingDeliveryAgent::~ReportingDeliveryAgent() {}
223 224
224 } // namespace net 225 } // namespace net
OLDNEW
« no previous file with comments | « net/reporting/reporting_cache_unittest.cc ('k') | net/reporting/reporting_delivery_agent_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698