| Index: chrome/browser/prerender/prerender_test_utils.cc
|
| diff --git a/chrome/browser/prerender/prerender_test_utils.cc b/chrome/browser/prerender/prerender_test_utils.cc
|
| index 5cd4402eab27784729705a2c2315b295998c2100..abded1130aa8f308e7d8cd03b5ef85343dab4949 100644
|
| --- a/chrome/browser/prerender/prerender_test_utils.cc
|
| +++ b/chrome/browser/prerender/prerender_test_utils.cc
|
| @@ -177,10 +177,12 @@
|
|
|
| class HangingFirstRequestInterceptor : public net::URLRequestInterceptor {
|
| public:
|
| - HangingFirstRequestInterceptor(
|
| - const base::FilePath& file,
|
| - base::Callback<void(net::URLRequest*)> callback)
|
| - : file_(file), callback_(callback), first_run_(true) {}
|
| + HangingFirstRequestInterceptor(const base::FilePath& file,
|
| + base::Closure callback)
|
| + : file_(file),
|
| + callback_(callback),
|
| + first_run_(true) {
|
| + }
|
| ~HangingFirstRequestInterceptor() override {}
|
|
|
| net::URLRequestJob* MaybeInterceptRequest(
|
| @@ -188,8 +190,10 @@
|
| net::NetworkDelegate* network_delegate) const override {
|
| if (first_run_) {
|
| first_run_ = false;
|
| - if (!callback_.is_null())
|
| - callback_.Run(request);
|
| + if (!callback_.is_null()) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::UI, FROM_HERE, callback_);
|
| + }
|
| return new HangingURLRequestJob(request, network_delegate);
|
| }
|
| return new net::URLRequestMockHTTPJob(
|
| @@ -202,7 +206,7 @@
|
|
|
| private:
|
| base::FilePath file_;
|
| - base::Callback<void(net::URLRequest*)> callback_;
|
| + base::Closure callback_;
|
| mutable bool first_run_;
|
| };
|
|
|
| @@ -246,17 +250,6 @@
|
|
|
| void FinishedProcessingCheck() override { NOTREACHED(); }
|
| };
|
| -
|
| -void CreateHangingFirstRequestInterceptorOnIO(
|
| - const GURL& url,
|
| - const base::FilePath& file,
|
| - base::Callback<void(net::URLRequest*)> callback_io) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| - std::unique_ptr<net::URLRequestInterceptor> interceptor(
|
| - new HangingFirstRequestInterceptor(file, callback_io));
|
| - net::URLRequestFilter::GetInstance()->AddUrlInterceptor(
|
| - url, std::move(interceptor));
|
| -}
|
|
|
| } // namespace
|
|
|
| @@ -808,15 +801,13 @@
|
| file, content::BrowserThread::GetBlockingPool()));
|
| }
|
|
|
| -void CreateHangingFirstRequestInterceptor(
|
| - const GURL& url,
|
| - const base::FilePath& file,
|
| - base::Callback<void(net::URLRequest*)> callback_io) {
|
| - DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
|
| - content::BrowserThread::PostTask(
|
| - content::BrowserThread::IO, FROM_HERE,
|
| - base::Bind(&CreateHangingFirstRequestInterceptorOnIO, url, file,
|
| - callback_io));
|
| +void CreateHangingFirstRequestInterceptorOnIO(
|
| + const GURL& url, const base::FilePath& file, base::Closure callback) {
|
| + CHECK(BrowserThread::CurrentlyOn(BrowserThread::IO));
|
| + std::unique_ptr<net::URLRequestInterceptor> interceptor(
|
| + new HangingFirstRequestInterceptor(file, callback));
|
| + net::URLRequestFilter::GetInstance()->AddUrlInterceptor(
|
| + url, std::move(interceptor));
|
| }
|
|
|
| } // namespace test_utils
|
|
|