Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(172)

Unified Diff: components/download/internal/config.h

Issue 2866483002: Configuration for download service. (Closed)
Patch Set: Work on reviews. Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/download/internal/BUILD.gn ('k') | components/download/internal/config.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/download/internal/config.h
diff --git a/components/download/internal/config.h b/components/download/internal/config.h
new file mode 100644
index 0000000000000000000000000000000000000000..c5b3b0d44d30a1cdfe17b5fc800b52f4adbbd64f
--- /dev/null
+++ b/components/download/internal/config.h
@@ -0,0 +1,65 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_DOWNLOAD_INTERNAL_CONFIG_H_
+#define COMPONENTS_DOWNLOAD_INTERNAL_CONFIG_H_
+
+#include <memory>
+
+#include "base/macros.h"
+#include "base/time/time.h"
+
+namespace download {
+
+// 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 file keep alive time.
+constexpr char kFileKeepAliveTimeMinutesConfig[] = "file_keep_alive_time";
+
+// 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();
+
+ // The maximum number of downloads the DownloadService can have currently in
+ // Active or Paused states.
+ int max_concurrent_downloads;
+
+ // The maximum number of downloads the DownloadService can have currently in
+ // only Active state.
+ int max_running_downloads;
+
+ // The maximum number of downloads that are scheduled but not yet in Active
+ // state, for each client using the download service.
+ int max_scheduled_downloads;
+
+ // The maximum number of retries before the download is aborted.
+ int max_retry_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;
+
+ private:
+ DISALLOW_COPY_AND_ASSIGN(Configuration);
+};
+
+} // namespace download
+
+#endif // COMPONENTS_DOWNLOAD_INTERNAL_CONFIG_H_
« no previous file with comments | « components/download/internal/BUILD.gn ('k') | components/download/internal/config.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698