// 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 THIRD_PARTY_BLINK_PUBLIC_COMMON_SCHEDULER_WEB_SCHEDULER_TRACKED_FEATURE_H_ #define THIRD_PARTY_BLINK_PUBLIC_COMMON_SCHEDULER_WEB_SCHEDULER_TRACKED_FEATURE_H_ #include <stdint.h> #include <optional> #include <string> #include "base/containers/enum_set.h" #include "third_party/blink/public/common/common_export.h" namespace blink { namespace scheduler { // A list of features which influence scheduling behaviour (throttling / // freezing / back-forward cache) and which might be sent to the browser process // for metrics-related purposes. // When you add a feature, be sure to add it in the lists either to // kDisallowedFeatures or kAllowedFeatures in BackForwardCacheImpl. // When you remove a feature // - add its index in removed_features in // BackForwardCacheMetricsTest.AllFeaturesCovered. // - add it to the list in IsRemovedFeature if it appear in finch configs. enum class WebSchedulerTrackedFeature : uint32_t { … }; WebSchedulerTrackedFeatures; BLINK_COMMON_EXPORT std::string FeatureToHumanReadableString( WebSchedulerTrackedFeature feature); BLINK_COMMON_EXPORT std::string FeatureToShortString( WebSchedulerTrackedFeature feature); BLINK_COMMON_EXPORT std::optional<WebSchedulerTrackedFeature> StringToFeature( const std::string& str); // Returns true if there was previously a feature by this name. // It is not comprehensive, just enough to cover what was used in finch, // in order to stop warnings at startup. See https://crbug.com/1363846. BLINK_COMMON_EXPORT bool IsRemovedFeature(const std::string& feature); // Sticky features can't be unregistered and remain active for the rest of the // lifetime of the page. BLINK_COMMON_EXPORT bool IsFeatureSticky(WebSchedulerTrackedFeature feature); // All the sticky features. BLINK_COMMON_EXPORT WebSchedulerTrackedFeatures StickyFeatures(); // Disables wake up alignment permanently for the process. This is called when a // feature that is incompatible with wake up alignment is used. Thread-safe. BLINK_COMMON_EXPORT void DisableAlignWakeUpsForProcess(); BLINK_COMMON_EXPORT bool IsAlignWakeUpsDisabledForProcess(); } // namespace scheduler } // namespace blink #endif // THIRD_PARTY_BLINK_PUBLIC_COMMON_SCHEDULER_WEB_SCHEDULER_TRACKED_FEATURE_H_