Adding instrumentation to locate the source of jankiness
[chromium-blink-merge.git] / chrome / browser / prerender / prerender_field_trial.h
blobc7c32105793382041b45edfa0b51cd58d4da92a6
1 // Copyright (c) 2012 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 CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_
6 #define CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_
8 #include <string>
10 class Profile;
12 namespace base {
13 class CommandLine;
16 namespace prerender {
18 // Parse the --prerender= command line switch, which controls prerendering. If
19 // the switch is unset or is set to "auto" then the user is assigned to a
20 // field trial.
21 void ConfigurePrerender(const base::CommandLine& command_line);
23 // Returns true if the user has opted in or has been opted in to the
24 // prerendering from Omnibox experiment.
25 bool IsOmniboxEnabled(Profile* profile);
27 // Returns true if session storage namespace merging is not disabled.
28 bool ShouldMergeSessionStorageNamespaces();
30 // Returns true iff the Prerender Local Predictor is enabled.
31 bool IsLocalPredictorEnabled();
33 // Indicates whether to disable the local predictor due to unencrypted sync
34 // settings and configuration.
35 bool ShouldDisableLocalPredictorBasedOnSyncAndConfiguration(Profile* profile);
37 // Returns whether or not the local predictor is temporarily disabled, due
38 // to network predictive action settings and current network.
39 bool ShouldDisableLocalPredictorDueToPreferencesAndNetwork(Profile* profile);
41 // Returns true iff the LoggedIn Predictor is enabled.
42 bool IsLoggedInPredictorEnabled();
44 // Returns true iff the side-effect free whitelist is enabled.
45 bool IsSideEffectFreeWhitelistEnabled();
47 // Returns true if the local predictor should actually launch prerenders.
48 bool IsLocalPredictorPrerenderLaunchEnabled();
50 // Returns true if the local predictor should prerender, but only as control
51 // group. If the local predictor never launches prerenders, then this setting
52 // is irrelevant.
53 bool IsLocalPredictorPrerenderAlwaysControlEnabled();
55 // Returns true if the local predictor should prefetch rather than prerender.
56 bool IsLocalPredictorPrerenderPrefetchEnabled();
58 // Returns true if we should query the prerender service for the profile
59 // provided.
60 bool ShouldQueryPrerenderService(Profile* profile);
62 // Indicates whether we should query the prerender service for the current URL
63 // and candidate URLs, respectively.
64 bool ShouldQueryPrerenderServiceForCurrentURL();
65 bool ShouldQueryPrerenderServiceForCandidateURLs();
67 // Returns the URL prefix to be used for the prerender service. The only thing
68 // that will be appended is the urlencoded query json.
69 std::string GetPrerenderServiceURLPrefix();
71 // Returns the prerender service behavior ID that should be passed to the
72 // to the prerender service in requests.
73 int GetPrerenderServiceBehaviorID();
75 // Returns the fetch timeout to be used for the prerender service, in ms.
76 int GetPrerenderServiceFetchTimeoutMs();
78 // Returns the timeout for entries in the prefetch list, in seconds.
79 int GetPrerenderPrefetchListTimeoutSeconds();
81 // Returns the TTL to be used for the local predictor.
82 int GetLocalPredictorTTLSeconds();
84 // Returns the half-life time to use to decay local predictor prerender
85 // priorities.
86 int GetLocalPredictorPrerenderPriorityHalfLifeTimeSeconds();
88 // Returns the maximum number of concurrent prerenders the local predictor
89 // may maintain.
90 int GetLocalPredictorMaxConcurrentPrerenders();
92 // Returns the maximum number of concurrent prerenders the local predictor
93 // may launch concurrently.
94 int GetLocalPredictorMaxLaunchPrerenders();
96 // The following functions return whether certain LocalPredictor checks should
97 // be skipped, as indicated by the name.
98 bool SkipLocalPredictorFragment();
99 bool SkipLocalPredictorHTTPS();
100 bool SkipLocalPredictorWhitelist();
101 bool SkipLocalPredictorServiceWhitelist();
102 bool SkipLocalPredictorLoggedIn();
103 bool SkipLocalPredictorDefaultNoPrerender();
104 bool SkipLocalPredictorLocalCandidates();
105 bool SkipLocalPredictorServiceCandidates();
107 // Indicates whether no prerender cookie stores should be used for prerendering.
108 bool IsPrerenderCookieStoreEnabled();
110 } // namespace prerender
112 #endif // CHROME_BROWSER_PRERENDER_PRERENDER_FIELD_TRIAL_H_