Supervised user whitelists: Cleanup
[chromium-blink-merge.git] / content / browser / service_worker / service_worker_metrics.h
blob705deb7df191530b2639cdfb720abf7f0b38dfc6
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 class GURL;
13 namespace content {
15 class ServiceWorkerMetrics {
16 public:
17 enum ReadResponseResult {
18 READ_OK,
19 READ_HEADERS_ERROR,
20 READ_DATA_ERROR,
21 NUM_READ_RESPONSE_RESULT_TYPES,
24 enum WriteResponseResult {
25 WRITE_OK,
26 WRITE_HEADERS_ERROR,
27 WRITE_DATA_ERROR,
28 NUM_WRITE_RESPONSE_RESULT_TYPES,
31 enum DeleteAndStartOverResult {
32 DELETE_OK,
33 DELETE_DATABASE_ERROR,
34 DELETE_DISK_CACHE_ERROR,
35 NUM_DELETE_AND_START_OVER_RESULT_TYPES,
38 // Used for ServiceWorkerDiskCache.
39 static void CountInitDiskCacheResult(bool result);
40 static void CountReadResponseResult(ReadResponseResult result);
41 static void CountWriteResponseResult(WriteResponseResult result);
43 // Used for ServiceWorkerDatabase.
44 static void CountOpenDatabaseResult(ServiceWorkerDatabase::Status status);
45 static void CountReadDatabaseResult(ServiceWorkerDatabase::Status status);
46 static void CountWriteDatabaseResult(ServiceWorkerDatabase::Status status);
47 static void RecordDestroyDatabaseResult(ServiceWorkerDatabase::Status status);
49 // Used for ServiceWorkerStorage.
50 static void RecordDeleteAndStartOverResult(DeleteAndStartOverResult result);
52 // Counts the number of page loads controlled by a Service Worker.
53 static void CountControlledPageLoad(const GURL& url);
55 // Records the result of trying to start a worker. |is_installed| indicates
56 // whether the version has been installed.
57 static void RecordStartWorkerStatus(ServiceWorkerStatusCode status,
58 bool is_installed);
60 // Records the time taken to successfully start a worker. |is_installed|
61 // indicates whether the version has been installed.
62 static void RecordStartWorkerTime(const base::TimeDelta& time,
63 bool is_installed);
65 private:
66 DISALLOW_IMPLICIT_CONSTRUCTORS(ServiceWorkerMetrics);
69 } // namespace content
71 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_METRICS_H_