1 // Copyright 2016 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.
4 
5 #ifndef THIRD_PARTY_BLINK_PUBLIC_COMMON_LOADER_LOADING_BEHAVIOR_FLAG_H_
6 #define THIRD_PARTY_BLINK_PUBLIC_COMMON_LOADER_LOADING_BEHAVIOR_FLAG_H_
7 
8 namespace blink {
9 
10 // This enum tracks certain behavior Blink exhibits when loading a page. This is
11 // for use in metrics collection by the loading team, to evaluate experimental
12 // features and potential areas of improvement in the loading stack. The main
13 // consumer is the page_load_metrics component, which sends bit flags to the
14 // browser process for histogram splitting.
15 enum LoadingBehaviorFlag {
16   kLoadingBehaviorNone = 0,
17   // Indicates that the page used the document.write evaluator to preload scan
18   // for resources inserted via document.write.
19   // DEPRECATED, feature has been turned down.
20   kLoadingBehaviorDocumentWriteEvaluator = 1 << 0,
21   // Indicates that the page is controlled by a Service Worker.
22   kLoadingBehaviorServiceWorkerControlled = 1 << 1,
23   // Indicates that the page has a synchronous, cross-origin document.written
24   // script.
25   kLoadingBehaviorDocumentWriteBlock = 1 << 2,
26   // Indicates that the page is a reload and has a synchronous, cross-origin
27   // document.written script.
28   kLoadingBehaviorDocumentWriteBlockReload = 1 << 3,
29   // The page loaded external CSS that generated a PreloadRequest via the
30   // CSSPreloaderResourceClient.
31   kLoadingBehaviorCSSPreloadFound = 1 << 4,
32   // Indicates that the page has a synchronous, same-origin document.written
33   // script with different protocol.
34   kLoadingBehaviorDocumentWriteBlockDifferentScheme = 1 << 5,
35   // Indicates that a subresource on the page matched the subresource filtering
36   // rules.
37   kLoadingBehaviorSubresourceFilterMatch = 1 << 6,
38   // Indicates that the page is an AMP document, with <html amp> tag.
39   kLoadingBehaviorAmpDocumentLoaded = 1 << 7,
40   // Indicates that the page uses the Next.js JavaScript framework (via a
41   // window variable)
42   kLoadingBehaviorNextJSFrameworkUsed = 1 << 8,
43   // Indicates that an async script was ready to execute before the script
44   // element's node document has finished parsing.
45   kLoadingBehaviorAsyncScriptReadyBeforeDocumentFinishedParsing = 1 << 9,
46   // Indicates that competing low priority requests were delayed. See
47   // https://crbug.com/1112515 for details.
48   kLoadingBehaviorCompetingLowPriorityRequestsDelayed = 1 << 10,
49 };
50 
51 }  // namespace blink
52 
53 #endif  // THIRD_PARTY_BLINK_PUBLIC_COMMON_LOADER_LOADING_BEHAVIOR_FLAG_H_
54