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

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

Issue 2822883002: Fix test slowness introduced by https://codereview.chromium.org/2771793003 (Closed)
Patch Set: Created 3 years, 8 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_icon_hasher.cc
diff --git a/chrome/browser/android/webapk/webapk_icon_hasher.cc b/chrome/browser/android/webapk/webapk_icon_hasher.cc
index 51a44322d5aa32bc25c50ad83de301f598dfe48b..afc12dcc353cb1ed04287293214a6c04f6422acd 100644
--- a/chrome/browser/android/webapk/webapk_icon_hasher.cc
+++ b/chrome/browser/android/webapk/webapk_icon_hasher.cc
@@ -39,6 +39,17 @@ void WebApkIconHasher::DownloadAndComputeMurmur2Hash(
net::URLRequestContextGetter* request_context_getter,
const GURL& icon_url,
const Murmur2HashCallback& callback) {
+ DownloadAndComputeMurmur2HashWithTimeout(request_context_getter, icon_url,
+ kDownloadTimeoutInMilliseconds,
+ callback);
+}
+
+// static
+void WebApkIconHasher::DownloadAndComputeMurmur2HashWithTimeout(
dominickn 2017/04/19 00:04:07 Nit: I would call this DownloadAndComputeMurmur2Ha
pkotwicz 2017/04/19 20:34:52 I don't thinkat that DownloadAndComputeMurmur2Hash
+ net::URLRequestContextGetter* request_context_getter,
+ const GURL& icon_url,
+ int timeout_ms,
+ const Murmur2HashCallback& callback) {
if (!icon_url.is_valid()) {
base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE,
base::Bind(callback, ""));
@@ -58,17 +69,17 @@ void WebApkIconHasher::DownloadAndComputeMurmur2Hash(
}
// The icon hasher will delete itself when it is done.
- new WebApkIconHasher(request_context_getter, icon_url, callback);
+ new WebApkIconHasher(request_context_getter, icon_url, timeout_ms, callback);
}
WebApkIconHasher::WebApkIconHasher(
net::URLRequestContextGetter* url_request_context_getter,
const GURL& icon_url,
+ int timeout_ms,
const Murmur2HashCallback& callback)
: callback_(callback) {
download_timeout_timer_.Start(
- FROM_HERE,
- base::TimeDelta::FromMilliseconds(kDownloadTimeoutInMilliseconds),
+ FROM_HERE, base::TimeDelta::FromMilliseconds(timeout_ms),
base::Bind(&WebApkIconHasher::OnDownloadTimedOut,
base::Unretained(this)));
« no previous file with comments | « chrome/browser/android/webapk/webapk_icon_hasher.h ('k') | chrome/browser/android/webapk/webapk_icon_hasher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698