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

Unified Diff: content/browser/download/mhtml_generation_browsertest.cc

Issue 2890853002: Downloads: replace BrowserThread::FILE with task scheduler. (Closed)
Patch Set: Revert ScopedCOMInitializer invocations. Created 3 years, 5 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: content/browser/download/mhtml_generation_browsertest.cc
diff --git a/content/browser/download/mhtml_generation_browsertest.cc b/content/browser/download/mhtml_generation_browsertest.cc
index e13a93d2d6e825953dea97180d58fbd63c4b6962..078a2d4f5770549f175b6909cd5432dd5778cd7d 100644
--- a/content/browser/download/mhtml_generation_browsertest.cc
+++ b/content/browser/download/mhtml_generation_browsertest.cc
@@ -15,6 +15,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/test/histogram_tester.h"
#include "base/threading/thread_restrictions.h"
+#include "content/browser/download/download_task_runner.h"
#include "content/browser/renderer_host/render_process_host_impl.h"
#include "content/common/frame_messages.h"
#include "content/public/browser/mhtml_extra_parts.h"
@@ -276,12 +277,12 @@ class GenerateMHTMLAndExitRendererMessageFilter : public BrowserMessageFilter {
if (message.type() == FrameHostMsg_SerializeAsMHTMLResponse::ID) {
// After |return false| below, this IPC message will be handled by the
// product code as illustrated below. (1), (2), (3) depict points in time
- // when product code runs on UI and FILE threads. (X), (Y), (Z) depict
- // when we want test-injected tasks to run - for the repro, (Z) has to
- // happen between (1) and (3). (Y?) and (Z?) depict when test tasks can
- // theoretically happen and ruin the repro.
+ // when product code runs on UI thread and download sequence. (X), (Y),
+ // (Z) depict when we want test-injected tasks to run - for the repro, (Z)
+ // has to happen between (1) and (3). (Y?) and (Z?) depict when test
+ // tasks can theoretically happen and ruin the repro.
//
- // IO thread UI thread FILE thread
+ // IO thread UI thread download sequence
// --------- --------- -----------
// | | |
// WE ARE HERE | |
@@ -319,13 +320,14 @@ class GenerateMHTMLAndExitRendererMessageFilter : public BrowserMessageFilter {
// - From here post TaskX to UI thread. (X) is guaranteed to happen
// before timepoint (1) (because posting of (1) happens after
// |return false| / before we post TaskX below).
- // - From (X) post TaskY to FILE thread. Because this posting is done
- // before (1), we can guarantee that (Y) will happen before (2).
+ // - From (X) post TaskY to downlod sequence. Because this posting is
Avi (use Gerrit) 2017/07/21 17:30:08 typo: download
Sigurður Ásgeirsson 2017/07/21 17:38:20 Done.
+ // done before (1), we can guarantee that (Y) will happen before (2).
// - From (Y) post TaskZ to UI thread. Because this posting is done
// before (2), we can guarantee that (Z) will happen before (3).
// - We cannot really guarantee that (Y) and (Z) happen *after* (1) - i.e.
// execution at (Y?) and (Z?) instead is possible. In practice,
- // bouncing off of UI and FILE thread does mean (Z) happens after (1).
+ // bouncing off of UI and download sequence does mean (Z) happens
+ // after (1).
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE, base::Bind(
&GenerateMHTMLAndExitRendererMessageFilter::TaskX,
@@ -336,10 +338,9 @@ class GenerateMHTMLAndExitRendererMessageFilter : public BrowserMessageFilter {
};
void TaskX() {
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE, base::Bind(
- &GenerateMHTMLAndExitRendererMessageFilter::TaskY,
- base::Unretained(this)));
+ GetDownloadTaskRunner()->PostTask(
+ FROM_HERE, base::Bind(&GenerateMHTMLAndExitRendererMessageFilter::TaskY,
+ base::Unretained(this)));
}
void TaskY() {

Powered by Google App Engine
This is Rietveld 408576698