1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377
|
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_
#define COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_
namespace optimization_guide {
// The types of decisions that can be made for an optimization type.
//
// Keep in sync with OptimizationGuideOptimizationTypeDecision in enums.xml.
enum class OptimizationTypeDecision {
kUnknown = 0,
// The optimization type was allowed for the page load by an optimization
// filter for the type.
kAllowedByOptimizationFilter = 1,
// The optimization type was not allowed for the page load by an optimization
// filter for the type.
kNotAllowedByOptimizationFilter = 2,
// An optimization filter for that type was on the device but was not loaded
// in time to make a decision. There is no guarantee that had the filter been
// loaded that the page load would have been allowed for the optimization
// type.
kHadOptimizationFilterButNotLoadedInTime = 3,
// The optimization type was allowed for the page load based on a hint.
kAllowedByHint = 4,
// A hint that matched the page load was present but the optimization type was
// not allowed to be applied.
kNotAllowedByHint = 5,
// A hint was available but there was not a page hint within that hint that
// matched the page load.
kNoMatchingPageHint = 6,
// A hint that matched the page load was on the device but was not loaded in
// time to make a decision. There is no guarantee that had the hint been
// loaded that the page load would have been allowed for the optimization
// type.
kHadHintButNotLoadedInTime = 7,
// No hints were available in the cache that matched the page load.
kNoHintAvailable = 8,
// The OptimizationGuideDecider was not initialized yet.
kDeciderNotInitialized = 9,
// A fetch to get the hint for the page load from the remote Optimization
// Guide Service was started, but was not available in time to make a
// decision.
kHintFetchStartedButNotAvailableInTime = 10,
// A fetch to get the hint for the page load from the remote Optimization
// Guide Service was started, but requested optimization type was not
// registered.
kRequestedUnregisteredType = 11,
// A fetch to get the hint for the page load from the remote Optimization
// Guide Service was started, but requested URL was invalid.
kInvalidURL = 12,
// Add new values above this line.
kMaxValue = kInvalidURL,
};
// The statuses for racing a hints fetch with the current navigation based
// on the availability of hints for both the current host and URL.
//
// Keep in sync with OptimizationGuideRaceNavigationFetchAttemptStatus in
// enums.xml.
enum class RaceNavigationFetchAttemptStatus {
kUnknown,
// The race was not attempted because hint information for the host and URL
// of the current navigation was already available.
kRaceNavigationFetchNotAttempted,
// The race was attempted for the host of the current navigation but not the
// URL.
kRaceNavigationFetchHost,
// The race was attempted for the URL of the current navigation but not the
// host.
kRaceNavigationFetchURL,
// The race was attempted for the host and URL of the current navigation.
kRaceNavigationFetchHostAndURL,
// A race for the current navigation's URL is already in progress.
kRaceNavigationFetchAlreadyInProgress,
// DEPRECATED: A race for the current navigation's URL was not attempted
// because there were too many concurrent page navigation fetches in flight.
kDeprecatedRaceNavigationFetchNotAttemptedTooManyConcurrentFetches,
// Add new values above this line.
kMaxValue =
kDeprecatedRaceNavigationFetchNotAttemptedTooManyConcurrentFetches,
};
// The statuses for a download file containing a prediction model when verified
// and processed.
//
// Keep in sync with OptimizationGuidePredictionModelDownloadStatus
// in enums.xml.
enum class PredictionModelDownloadStatus {
kUnknown = 0,
// The downloaded file was successfully verified and processed.
kSuccess = 1,
// The downloaded file was not a valid CRX file.
kFailedCrxVerification = 2,
// A temporary directory for unzipping the CRX file failed to be created.
kFailedUnzipDirectoryCreation = 3,
// The CRX file failed to be unzipped.
kFailedCrxUnzip = 4,
// The model info failed to be read from disk.
kFailedModelInfoFileRead = 5,
// The model info failed to be parsed.
kFailedModelInfoParsing = 6,
// The model file was not found in the CRX file.
kFailedModelFileNotFound = 7,
// The model file failed to be moved to a more permanent directory.
kFailedModelFileOtherError = 8,
// The model info was invalid.
kFailedModelInfoInvalid = 9,
// The CRX file was a valid CRX file but did not come from a valid publisher.
kFailedCrxInvalidPublisher = 10,
// The opt guide parent directory for storing models in does not exist.
kOptGuideDirectoryDoesNotExist = 11,
// The new directory to persist this model version's files could not be
// created.
kCouldNotCreateDirectory = 12,
// The model info was not saved to model store file.
kFailedModelInfoSaving = 13,
// The additional file was not found in the CRX file.
kFailedInvalidAdditionalFile = 14,
// Add new values above this line.
kMaxValue = kFailedInvalidAdditionalFile,
};
// Different events of the prediction model delivery lifecycle for an
// OptimizationTarget.
// Keep in sync with OptimizationGuideModelDeliveryEvent in enums.xml.
enum class ModelDeliveryEvent {
kUnknown = 0,
// The model was delivered from immediately or after a
// successful download.
kModelDeliveredAtRegistration = 1,
kModelDelivered = 2,
// GetModelsRequest was sent to the optimization guide server.
kGetModelsRequest = 3,
// Model was requested to be downloaded using download service.
kDownloadServiceRequest = 4,
// Download service started the model download.
kModelDownloadStarted = 5,
// Model got downloaded from the download service.
kModelDownloaded = 6,
// Download service was unavailable.
kDownloadServiceUnavailable = 7,
// GetModelsResponse failed.
kGetModelsResponseFailure = 8,
// Download URL received from model metadata is invalid
kDownloadURLInvalid = 9,
// Model download failed due to download service or verifying the downloaded
// model.
kModelDownloadFailure = 10,
// Loading the model from store failed.
kModelLoadFailed = 11,
// Model download was attempted after the model load failed.
kModelDownloadDueToModelLoadFailure = 12,
// Add new values above this line.
kMaxValue = kModelDownloadDueToModelLoadFailure,
};
// The various model quality user feedback.
enum class ModelQualityUserFeedback {
kUnknown = 0,
kThumbsDown = 1,
kThumbsUp = 2,
// Keep in sync with OptimizationGuideUserFeedback in
// tools/metrics/histograms/metadata/optimization/enums.xml.
kMaxValue = kThumbsUp,
};
// The various results of an access token request.
//
// Keep in sync with OptimizationGuideAccessTokenResult in enums.xml.
enum class OptimizationGuideAccessTokenResult {
kUnknown = 0,
// The access token was received successfully.
kSuccess = 1,
// User was not signed-in.
kUserNotSignedIn = 2,
// Failed with a transient error.
kTransientError = 3,
// Failed with a persistent error.
kPersistentError = 4,
// Add new values above this line.
kMaxValue = kPersistentError,
};
// Status of a request to fetch from the optimization guide service.
// This enum must remain synchronized with the enum
// |OptimizationGuideFetcherRequestStatus| in
// tools/metrics/histograms/enums.xml.
enum class FetcherRequestStatus {
// No fetch status known. Used in testing.
kUnknown,
// Fetch request was sent and a response received.
kSuccess,
// Fetch request was sent but no response received.
kResponseError,
// DEPRECATED: Fetch request not sent because of offline network status.
kDeprecatedNetworkOffline,
// Fetch request not sent because fetcher was busy with another request.
kFetcherBusy,
// Hints fetch request not sent because the host and URL lists were empty.
kNoHostsOrURLsToFetchHints,
// Hints fetch request not sent because no supported optimization types were
// provided.
kNoSupportedOptimizationTypesToFetchHints,
// Fetch request was canceled before completion.
kRequestCanceled,
// Fetch request was not started because user was not signed-in.
kUserNotSignedIn,
// Insert new values before this line.
kMaxValue = kUserNotSignedIn
};
// Status of a model quality logs upload request.
enum class ModelQualityLogsUploadStatus {
kUnknown = 0,
// Logs upload was successful.
kUploadSuccessful = 1,
// Upload is disabled due to logging feature not enabled.
kLoggingNotEnabled = 2,
// Upload was not successful because of network error.
kNetError = 3,
// Upload is disabled due to metrics reporting being disabled in
// chrome://settings.
kMetricsReportingDisabled = 4,
// Upload is disabled due to enterprise policy.
kDisabledDueToEnterprisePolicy = 5,
// Upload is disabled because the feature is not enabled for the user.
kFeatureNotEnabledForUser = 6,
// Insert new values before this line.
// This enum must remain synchronized with the enum
// |OptimizationGuideModelQualityLogsUploadStatus| in
// tools/metrics/histograms/metadata/optimization/enums.xml.
kMaxValue = kFeatureNotEnabledForUser,
};
// Performance class of this device.
//
// These values are persisted to logs and prefs. Entries should not be
// renumbered and numeric values should never be reused.
enum class OnDeviceModelPerformanceClass : int {
kUnknown = 0,
// See on_device_model::mojom::PerformanceClass for explanation of these.
kError = 1,
kVeryLow = 2,
kLow = 3,
kMedium = 4,
kHigh = 5,
kVeryHigh = 6,
// WARNING!: If you add a new performance class, please be aware of
// `IsPerformanceClassCompatibleWithOnDeviceModel`.
// The service crashed, so a valid value was not returned.
kServiceCrash = 7,
// GPU was blocklisted.
kGpuBlocked = 8,
// Native library failed to load.
kFailedToLoadLibrary = 9,
// This must be kept in sync with
// OnDeviceModelPerformanceClass in optimization/enums.xml.
// Insert new values before this line.
kMaxValue = kFailedToLoadLibrary,
};
// The validity of the model metadata packaged with the text safety model.
//
// These values are persisted to logs. Entries should not be renumbered and
// numeric values should never be reused.
enum class TextSafetyModelMetadataValidity {
kUnknown = 0,
// No metadata packaged with model.
kNoMetadata = 1,
// Metadata packaged with model is of the wrong type.
kMetadataWrongType = 2,
// Metadata packaged with model has no feature configs.
kNoFeatureConfigs = 3,
// Metadata was valid.
kValid = 4,
// This must be kept in sync with TextSafetyModelMetadataValidity in
// optimization/enums.xml.
kMaxValue = kValid,
};
enum class OnDeviceModelAdaptationAvailability {
// Adaptation model was available.
kAvailable = 0,
// Base model was not available.
kBaseModelUnavailable = 1,
// Base model spec was invalid, so adaptation model cannot be fetched.
kBaseModelSpecInvalid = 2,
// Adaptation model was not available.
kAdaptationModelUnavailable = 3,
// The received adaptation model was invalid.
kAdaptationModelInvalid = 4,
// The received adaptation model was incompatible with the base model.
kAdaptationModelIncompatible = 5,
// The execution config in the adaptation model was invalid.
kAdaptationModelExecutionConfigInvalid = 6,
// The model execution feature was not recently used.
kFeatureNotRecentlyUsed = 7,
// This must be kept in sync with OnDeviceModelAdaptationAvailability in
// optimization/enums.xml.
kMaxValue = kFeatureNotRecentlyUsed,
};
// The result of running validation prompts for the on-device model.
//
// Keep in sync with OnDeviceModelValidationResult in enums.xml.
enum class OnDeviceModelValidationResult {
kUnknown = 0,
// The validation is currently running or was interrupted.
kPending = 1,
// The validation test succeeded.
kSuccess = 2,
// The validation test produced non-matching output.
kNonMatchingOutput = 3,
// The service crashed while running the validation test.
kServiceCrash = 4,
// The validation test was interrupted by another session.
kInterrupted = 5,
// This must be kept in sync with OnDeviceModelValidationResult in
// optimization/enums.xml.
kMaxValue = kInterrupted,
};
// Whether a response is complete or not.
enum class ResponseCompleteness {
// This is a partial response, more output may follow.
kPartial,
// The response is complete and no more output will be produced.
kComplete,
};
} // namespace optimization_guide
#endif // COMPONENTS_OPTIMIZATION_GUIDE_CORE_OPTIMIZATION_GUIDE_ENUMS_H_
|