#include "content/browser/service_worker/service_worker_metrics.h"
#include <limits>
#include <string>
#include "base/functional/bind.h"
#include "base/metrics/histogram_functions.h"
#include "base/metrics/histogram_macros.h"
#include "base/strings/strcat.h"
#include "base/strings/string_util.h"
#include "base/time/time.h"
#include "content/browser/service_worker/service_worker_context_wrapper.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/common/content_client.h"
#include "third_party/blink/public/common/service_worker/embedded_worker_status.h"
namespace content {
namespace {
const char* StartSituationToSuffix(
ServiceWorkerMetrics::StartSituation situation) { … }
const char* StartSituationToDeprecatedSuffix(
ServiceWorkerMetrics::StartSituation situation) { … }
const char* EventTypeToSuffix(ServiceWorkerMetrics::EventType event_type) { … }
}
const char* ServiceWorkerMetrics::EventTypeToString(EventType event_type) { … }
const char* ServiceWorkerMetrics::StartSituationToString(
StartSituation start_situation) { … }
void ServiceWorkerMetrics::CountReadResponseResult(
ServiceWorkerMetrics::ReadResponseResult result) { … }
void ServiceWorkerMetrics::CountWriteResponseResult(
ServiceWorkerMetrics::WriteResponseResult result) { … }
void ServiceWorkerMetrics::RecordStartInstalledWorkerStatus(
blink::ServiceWorkerStatusCode status,
EventType purpose) { … }
void ServiceWorkerMetrics::RecordRunAfterStartWorkerStatus(
blink::EmbeddedWorkerStatus running_status,
EventType purpose) { … }
void ServiceWorkerMetrics::RecordStartWorkerTime(base::TimeDelta time,
bool is_installed,
StartSituation start_situation,
EventType purpose) { … }
void ServiceWorkerMetrics::RecordActivateEventStatus(
blink::ServiceWorkerStatusCode status,
bool is_shutdown) { … }
void ServiceWorkerMetrics::RecordInstallEventStatus(
blink::ServiceWorkerStatusCode status,
uint32_t fetch_count) { … }
void ServiceWorkerMetrics::RecordEventDuration(EventType event,
base::TimeDelta time,
bool was_handled,
uint32_t fetch_count) { … }
void ServiceWorkerMetrics::RecordFetchEventStatus(
bool is_main_resource,
blink::ServiceWorkerStatusCode status) { … }
void ServiceWorkerMetrics::RecordStartWorkerTiming(const StartTimes& times,
StartSituation situation) { … }
void ServiceWorkerMetrics::RecordStartWorkerTimingClockConsistency(
CrossProcessTimeDelta type) { … }
void ServiceWorkerMetrics::RecordSkipServiceWorkerOnNavigation(
bool skip_service_worker) { … }
void ServiceWorkerMetrics::RecordFindRegistrationForClientUrlTime(
base::TimeDelta time) { … }
}