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_COMMON_SERVICE_WORKER_SERVICE_WORKER_STATUS_CODE_H_
6 #define CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_STATUS_CODE_H_
8 #include "content/common/content_export.h"
12 // Generic service worker operation statuses.
13 // This enum is used in UMA histograms, so don't change the order or remove
15 enum ServiceWorkerStatusCode
{
16 // Operation succeeded.
19 // Generic operation error (more specific error code should be used in
21 SERVICE_WORKER_ERROR_FAILED
,
23 // Operation was aborted (e.g. due to context or child process shutdown).
24 SERVICE_WORKER_ERROR_ABORT
,
26 // Starting a new service worker script context failed.
27 SERVICE_WORKER_ERROR_START_WORKER_FAILED
,
29 // Could not find a renderer process to run a service worker.
30 SERVICE_WORKER_ERROR_PROCESS_NOT_FOUND
,
32 // Generic error code to indicate the specified item is not found.
33 SERVICE_WORKER_ERROR_NOT_FOUND
,
35 // Generic error code to indicate the specified item already exists.
36 SERVICE_WORKER_ERROR_EXISTS
,
38 // Install event handling failed.
39 SERVICE_WORKER_ERROR_INSTALL_WORKER_FAILED
,
41 // Activate event handling failed.
42 SERVICE_WORKER_ERROR_ACTIVATE_WORKER_FAILED
,
44 // Sending an IPC to the worker failed (often due to child process is
46 SERVICE_WORKER_ERROR_IPC_FAILED
,
48 // Operation is failed by network issue.
49 SERVICE_WORKER_ERROR_NETWORK
,
51 // Operation is failed by security issue.
52 SERVICE_WORKER_ERROR_SECURITY
,
54 // Event handling failed (event.waitUntil Promise rejected).
55 SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED
,
57 // An error triggered by invalid worker state.
58 SERVICE_WORKER_ERROR_STATE
,
60 // The Service Worker took too long to finish a task.
61 SERVICE_WORKER_ERROR_TIMEOUT
,
63 // An error occurred during initial script evaluation.
64 SERVICE_WORKER_ERROR_SCRIPT_EVALUATE_FAILED
,
66 // Generic error to indicate failure to read/write the disk cache.
67 SERVICE_WORKER_ERROR_DISK_CACHE
,
69 // The worker is in REDUNDANT state.
70 SERVICE_WORKER_ERROR_REDUNDANT
,
72 SERVICE_WORKER_ERROR_MAX_VALUE
75 CONTENT_EXPORT
const char* ServiceWorkerStatusToString(
76 ServiceWorkerStatusCode code
);
78 } // namespace content
80 #endif // CONTENT_COMMON_SERVICE_WORKER_SERVICE_WORKER_STATUS_CODE_H_