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

Unified Diff: chrome/browser/android/webapk/webapk_installer.cc

Issue 2771793003: Move timeout timer into WebApkIconHasher (Closed)
Patch Set: Remove weakptr and use unretained Created 3 years, 9 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
Index: chrome/browser/android/webapk/webapk_installer.cc
diff --git a/chrome/browser/android/webapk/webapk_installer.cc b/chrome/browser/android/webapk/webapk_installer.cc
index 5f23acf86f51212850dc2912a46da91c3c53fb28..2f24da1b1cf7ab5d8d4257f4e10afcbc6eacd6f6 100644
--- a/chrome/browser/android/webapk/webapk_installer.cc
+++ b/chrome/browser/android/webapk/webapk_installer.cc
@@ -450,27 +450,15 @@ void WebApkInstaller::OnURLFetchComplete(const net::URLFetcher* source) {
}
void WebApkInstaller::DownloadAppIconAndComputeMurmur2Hash() {
- // Safeguard. WebApkIconHasher crashes if asked to fetch an invalid URL.
- if (!shortcut_info_.best_primary_icon_url.is_valid()) {
- OnResult(WebApkInstallResult::FAILURE);
- return;
- }
-
- timer_.Start(
- FROM_HERE, base::TimeDelta::FromMilliseconds(download_timeout_ms_),
- base::Bind(&WebApkInstaller::OnResult, weak_ptr_factory_.GetWeakPtr(),
- WebApkInstallResult::FAILURE));
-
- icon_hasher_.reset(new WebApkIconHasher());
- icon_hasher_->DownloadAndComputeMurmur2Hash(
+ icon_hasher_.reset(new WebApkIconHasher(
request_context_getter_, shortcut_info_.best_primary_icon_url,
base::Bind(&WebApkInstaller::OnGotIconMurmur2Hash,
- weak_ptr_factory_.GetWeakPtr()));
+ weak_ptr_factory_.GetWeakPtr())));
+ icon_hasher_->DownloadAndComputeMurmur2Hash();
}
void WebApkInstaller::OnGotIconMurmur2Hash(
const std::string& icon_murmur2_hash) {
- timer_.Stop();
icon_hasher_.reset();
// An empty hash indicates that |icon_hasher_| encountered an error.

Powered by Google App Engine
This is Rietveld 408576698