| Index: chrome/browser/component_updater/sth_set_component_installer.cc
|
| diff --git a/chrome/browser/component_updater/sth_set_component_installer.cc b/chrome/browser/component_updater/sth_set_component_installer.cc
|
| index b6ced0134ef16a261d8719e72d851bbaeb5ac705..b4294f865cff91adf3cb817a847965d70585c813 100644
|
| --- a/chrome/browser/component_updater/sth_set_component_installer.cc
|
| +++ b/chrome/browser/component_updater/sth_set_component_installer.cc
|
| @@ -16,8 +16,10 @@
|
| #include "base/values.h"
|
| #include "base/version.h"
|
| #include "chrome/browser/net/sth_distributor_provider.h"
|
| +#include "chrome/common/chrome_features.h"
|
| #include "components/component_updater/component_updater_paths.h"
|
| #include "components/safe_json/safe_json_parser.h"
|
| +#include "components/variations/variations_associated_data.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "crypto/sha2.h"
|
| #include "net/cert/ct_log_response_parser.h"
|
| @@ -51,7 +53,7 @@ const char kSTHSetFetcherManifestName[] = "Signed Tree Heads";
|
|
|
| STHSetComponentInstallerTraits::STHSetComponentInstallerTraits(
|
| net::ct::STHObserver* sth_observer)
|
| - : sth_observer_(sth_observer) {}
|
| + : sth_observer_(sth_observer), weak_ptr_factory_(this) {}
|
|
|
| STHSetComponentInstallerTraits::~STHSetComponentInstallerTraits() {}
|
|
|
| @@ -74,12 +76,19 @@ void STHSetComponentInstallerTraits::ComponentReady(
|
| const base::Version& version,
|
| const base::FilePath& install_dir,
|
| std::unique_ptr<base::DictionaryValue> manifest) {
|
| - if (!content::BrowserThread::PostBlockingPoolTask(
|
| - FROM_HERE,
|
| - base::Bind(&STHSetComponentInstallerTraits::LoadSTHsFromDisk,
|
| - base::Unretained(this), GetInstalledPath(install_dir),
|
| - version))) {
|
| - NOTREACHED();
|
| + const base::Closure load_sths_closure = base::Bind(
|
| + &STHSetComponentInstallerTraits::LoadSTHsFromDisk,
|
| + weak_ptr_factory_.GetWeakPtr(), GetInstalledPath(install_dir), version);
|
| +
|
| + if (variations::GetVariationParamValueByFeature(features::kSTHSetComponent,
|
| + "delayed_load") != "no") {
|
| + DVLOG(1) << "Delaying STHSet load until after start-up.";
|
| + content::BrowserThread::PostAfterStartupTask(
|
| + FROM_HERE, content::BrowserThread::GetBlockingPool(),
|
| + load_sths_closure);
|
| + } else {
|
| + DVLOG(1) << "Loading STHSet during start-up.";
|
| + content::BrowserThread::PostBlockingPoolTask(FROM_HERE, load_sths_closure);
|
| }
|
| }
|
|
|
|
|