Service Worker: in Unregister, wait until after the active worker no longer controls...
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_metrics.h
blobdeea3b3f1c4758920bde182e05d8aaf5cd806536
1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_
8 #include "base/macros.h"
9 #include "content/browser/service_worker/service_worker_database.h"
11 namespace content {
13 class ServiceWorkerMetrics {
14 public:
15 enum ReadResponseResult {
16 READ_OK,
17 READ_HEADERS_ERROR,
18 READ_DATA_ERROR,
19 NUM_READ_RESPONSE_RESULT_TYPES,
22 enum WriteResponseResult {
23 WRITE_OK,
24 WRITE_HEADERS_ERROR,
25 WRITE_DATA_ERROR,
26 NUM_WRITE_RESPONSE_RESULT_TYPES,
29 // Used for ServiceWorkerDiskCache.
30 static void CountInitDiskCacheResult(bool result);
31 static void CountReadResponseResult(ReadResponseResult result);
32 static void CountWriteResponseResult(WriteResponseResult result);
34 // Used for ServiceWorkerDatabase.
35 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status);
36 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status);
37 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status);
39 // Counts the number of page loads controlled by a Service Worker.
40 static void CountControlledPageLoad();
42 private:
43 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
46 } // namespace content
48 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_