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

Side by Side Diff: content/browser/service_worker/service_worker_version.cc

Issue 1178043002: Update ServiceWorker event handled status histogram (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "content/browser/service_worker/service_worker_version.h" 5 #include "content/browser/service_worker/service_worker_version.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after
389 389
390 } // namespace 390 } // namespace
391 391
392 const int ServiceWorkerVersion::kStartWorkerTimeoutMinutes = 5; 392 const int ServiceWorkerVersion::kStartWorkerTimeoutMinutes = 5;
393 const int ServiceWorkerVersion::kRequestTimeoutMinutes = 5; 393 const int ServiceWorkerVersion::kRequestTimeoutMinutes = 5;
394 394
395 class ServiceWorkerVersion::Metrics { 395 class ServiceWorkerVersion::Metrics {
396 public: 396 public:
397 Metrics() {} 397 Metrics() {}
398 ~Metrics() { 398 ~Metrics() {
399 ServiceWorkerMetrics::RecordEventStatus(fired_events, handled_events); 399 ServiceWorkerMetrics::RecordPerWorkerEventHandledStatus(fired_events,
400 handled_events);
400 } 401 }
401 402
402 void RecordEventStatus(bool handled) { 403 void RecordEventHandledStatus(bool handled) {
404 ServiceWorkerMetrics::RecordEventHandledStatus(handled);
403 ++fired_events; 405 ++fired_events;
404 if (handled) 406 if (handled)
405 ++handled_events; 407 ++handled_events;
406 } 408 }
407 409
408 private: 410 private:
409 size_t fired_events = 0; 411 size_t fired_events = 0;
410 size_t handled_events = 0; 412 size_t handled_events = 0;
411 DISALLOW_COPY_AND_ASSIGN(Metrics); 413 DISALLOW_COPY_AND_ASSIGN(Metrics);
412 }; 414 };
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1322 "ServiceWorkerVersion::OnFetchEventFinished", 1324 "ServiceWorkerVersion::OnFetchEventFinished",
1323 "Request id", request_id); 1325 "Request id", request_id);
1324 FetchCallback* callback = fetch_callbacks_.Lookup(request_id); 1326 FetchCallback* callback = fetch_callbacks_.Lookup(request_id);
1325 if (!callback) { 1327 if (!callback) {
1326 NOTREACHED() << "Got unexpected message: " << request_id; 1328 NOTREACHED() << "Got unexpected message: " << request_id;
1327 return; 1329 return;
1328 } 1330 }
1329 1331
1330 // TODO(kinuko): Record other event statuses too. 1332 // TODO(kinuko): Record other event statuses too.
1331 const bool handled = (result == SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE); 1333 const bool handled = (result == SERVICE_WORKER_FETCH_EVENT_RESULT_RESPONSE);
1332 metrics_->RecordEventStatus(handled); 1334 metrics_->RecordEventHandledStatus(handled);
1333 1335
1334 scoped_refptr<ServiceWorkerVersion> protect(this); 1336 scoped_refptr<ServiceWorkerVersion> protect(this);
1335 callback->Run(SERVICE_WORKER_OK, result, response); 1337 callback->Run(SERVICE_WORKER_OK, result, response);
1336 RemoveCallbackAndStopIfRedundant(&fetch_callbacks_, request_id); 1338 RemoveCallbackAndStopIfRedundant(&fetch_callbacks_, request_id);
1337 } 1339 }
1338 1340
1339 void ServiceWorkerVersion::OnSyncEventFinished( 1341 void ServiceWorkerVersion::OnSyncEventFinished(
1340 int request_id, 1342 int request_id,
1341 blink::WebServiceWorkerEventResult result) { 1343 blink::WebServiceWorkerEventResult result) {
1342 TRACE_EVENT1("ServiceWorker", 1344 TRACE_EVENT1("ServiceWorker",
(...skipping 696 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 return SERVICE_WORKER_ERROR_ABORT; 2041 return SERVICE_WORKER_ERROR_ABORT;
2040 default: 2042 default:
2041 return SERVICE_WORKER_ERROR_NETWORK; 2043 return SERVICE_WORKER_ERROR_NETWORK;
2042 } 2044 }
2043 } 2045 }
2044 2046
2045 return default_code; 2047 return default_code;
2046 } 2048 }
2047 2049
2048 } // namespace content 2050 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698