File: config.h

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (172 lines) | stat: -rw-r--r-- 6,565 bytes parent folder | download | duplicates (11)
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
// Copyright 2017 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_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_CONFIG_H_
#define COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_CONFIG_H_

#include <memory>

#include "base/time/time.h"

namespace download {

// Configuration name for max concurrent downloads.
constexpr char kBatteryQueryIntervalConfig[] = "battery_query_interval_seconds";

// Configuration name for download battery percentage.
constexpr char kDownloadBatteryPercentageConfig[] =
    "download_battery_percentage";

// Configuration name for max concurrent downloads.
constexpr char kMaxConcurrentDownloadsConfig[] = "max_concurrent_downloads";

// Configuration name for maximum running downloads.
constexpr char kMaxRunningDownloadsConfig[] = "max_running_downloads";

// Configuration name for maximum scheduled downloads.
constexpr char kMaxScheduledDownloadsConfig[] = "max_scheduled_downloads";

// Configuration name for maximum retry count.
constexpr char kMaxRetryCountConfig[] = "max_retry_count";

// Configuration name for maximum resumption count.
constexpr char kMaxResumptionCountConfig[] = "max_resumption_count";

// Configuration name for file keep alive time.
constexpr char kFileKeepAliveTimeMinutesConfig[] =
    "file_keep_alive_time_minutes";

// Configuration name for maximum duration that the file can be kept alive.
constexpr char kMaxFileKeepAliveTimeMinutesConfig[] =
    "max_file_keep_alive_time_minutes";

// Configuration name for file keep alive time.
constexpr char kFileCleanupWindowMinutesConfig[] = "file_cleanup_window";

// Configuration name for window start time.
constexpr char kWindowStartTimeSecondsConfig[] = "window_start_time_seconds";

// Configuration name for window end time.
constexpr char kWindowEndTimeSecondsConfig[] = "window_end_time_seconds";

// Configuration name for start up delay, measured in milliseconds.
constexpr char kNetworkStartupDelayMsConfig[] = "start_up_delay_ms";

// Configuration name for start up delay when triggered from a background task,
// measured in milliseconds.
constexpr char kNetworkStartupDelayBackgroundTaskMsConfig[] =
    "start_up_delay_background_task_ms";

// Configuration name for the delay to notify network status change, measured in
// milliseconds.
constexpr char kNetworkChangeDelayMsConfig[] = "network_change_delay_ms";

// Configuration name for the download resumption delay after a navigation
// completes, measured in seconds.
constexpr char kNavigationCompletionDelaySecondsConfig[] =
    "navigation_completion_delay_seconds";

// Configuration name for the timeout value from the start of a navigation after
// which if still no response, download service will resume. Measured in
// seconds.
constexpr char kNavigationTimeoutDelaySecondsConfig[] =
    "navigation_timeout_delay_seconds";

// Configuration name for the minimum timeout value after which an upload can be
// killed if the client still hasn't responded with the upload data. Measured in
// seconds.
constexpr char kPendingUploadTimeoutDelaySecondsConfig[] =
    "pending_upload_timeout_delay_seconds";

// Configuration name for the retry delay when the download is failed, measured
// in milliseconds.
constexpr char kDownloadRetryDelayMsConfig[] = "retry_delay_ms";

// Download service configuration.
//
// Loaded based on experiment parameters from the server. Use default values if
// no server configuration was detected.
struct Configuration {
 public:
  // Create the configuration.
  static std::unique_ptr<Configuration> CreateFromFinch();
  Configuration();

  Configuration(const Configuration&) = delete;
  Configuration& operator=(const Configuration&) = delete;

  // An interval to throttle battery status queries.
  base::TimeDelta battery_query_interval;

  // Minimum battery percentage to start the background task or start the
  // download when battery requirement is sensitive.
  int download_battery_percentage;

  // The maximum number of downloads the DownloadService can have currently in
  // Active or Paused states.
  uint32_t max_concurrent_downloads;

  // The maximum number of downloads the DownloadService can have currently in
  // only Active state.
  uint32_t max_running_downloads;

  // The maximum number of downloads that are scheduled for each client using
  // the download service.
  uint32_t max_scheduled_downloads;

  // The maximum number of retries before the download is aborted.
  uint32_t max_retry_count;

  // The maximum number of conceptually 'free' resumptions before the download
  // is aborted.  This is a failsafe to prevent constantly hammering the source.
  uint32_t max_resumption_count;

  // The time that the download service will keep the files around before
  // deleting them if the client hasn't handle the files.
  base::TimeDelta file_keep_alive_time;

  // The maximum time that the download service can keep the files around before
  // forcefully deleting them even if the client doesn't agree.
  base::TimeDelta max_file_keep_alive_time;

  // The length of the flexible time window during which the scheduler must
  // schedule a file cleanup task.
  base::TimeDelta file_cleanup_window;

  // The start window time in seconds for OS to schedule background task.
  // The OS will trigger the background task in this window.
  base::TimeDelta window_start_time;

  // The end window time in seconds for OS to schedule background task.
  // The OS will trigger the background task in this window.
  base::TimeDelta window_end_time;

  // The delay to initialize internal components to wait for network stack
  // ready.
  base::TimeDelta network_startup_delay;

  // The delay to initialize internal components to wait for network stack
  // ready when triggered from a background task.
  base::TimeDelta network_startup_delay_backgroud_task;

  // The delay to notify network status changes.
  base::TimeDelta network_change_delay;

  // The delay to notify about the navigation completion.
  base::TimeDelta navigation_completion_delay;

  // The timeout to wait for after a navigation starts.
  base::TimeDelta navigation_timeout_delay;

  // The minimum timeout after which upload entries waiting on data from their
  // clients might be killed.
  base::TimeDelta pending_upload_timeout_delay;

  // The delay to retry a download when the download is failed.
  base::TimeDelta download_retry_delay;
};

}  // namespace download

#endif  // COMPONENTS_DOWNLOAD_INTERNAL_BACKGROUND_SERVICE_CONFIG_H_