Skip to content

Commit

Permalink
Merge pull request #4991 from brave/add_custom_component_update_inter…
Browse files Browse the repository at this point in the history
…val_switch

Introduce custom interval for checking component update
  • Loading branch information
simonhong authored Mar 22, 2020
2 parents d164606 + b9e8932 commit af27b26
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
13 changes: 13 additions & 0 deletions browser/component_updater/brave_component_updater_configurator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@
#include <string>
#include <vector>

#include "base/command_line.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/sys_string_conversions.h"
#include "base/version.h"
#include "brave/common/brave_switches.h"
#include "build/build_config.h"
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/system_network_context_manager.h"
Expand Down Expand Up @@ -58,6 +61,16 @@ int BraveConfigurator::InitialDelay() const {
}

int BraveConfigurator::NextCheckDelay() const {
auto* command = base::CommandLine::ForCurrentProcess();
if (command->HasSwitch(switches::kComponentUpdateIntervalInSec)) {
int interval = 0;
if (base::StringToInt(command->GetSwitchValueASCII(
switches::kComponentUpdateIntervalInSec),
&interval)) {
DCHECK_GE(interval, 1);
return interval;
}
}
return configurator_impl_.NextCheckDelay();
}

Expand Down
3 changes: 3 additions & 0 deletions common/brave_switches.cc
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,7 @@ const char kFastWidevineBundleUpdate[] = "fast-widevine-bundle-update";

const char kUseGoUpdateDev[] = "use-dev-goupdater-url";

// Use custom update interval in sec
const char kComponentUpdateIntervalInSec[] = "component-update-interval-in-sec";

} // namespace switches
2 changes: 2 additions & 0 deletions common/brave_switches.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ extern const char kFastWidevineBundleUpdate[];

extern const char kUseGoUpdateDev[];

extern const char kComponentUpdateIntervalInSec[];

} // namespace switches

#endif // BRAVE_COMMON_BRAVE_SWITCHES_H_

0 comments on commit af27b26

Please sign in to comment.