Commit d5cf623f authored by fdoray's avatar fdoray Committed by Commit bot

Use TaskScheduler instead of blocking pool in chrome_download_manager_delegate.cc.

The following traits are used:

Priority: Inherited (default)
  The priority is inherited from the calling context (i.e. TaskTraits
  are initialized with the priority of the current task).

Shutdown behavior: SKIP_ON_SHUTDOWN (default)
  Tasks posted with this mode that have not started executing at
  shutdown will never run. However, any task that has already begun
  executing when shutdown is invoked will be allowed to continue and
  will block shutdown until completion.

  Note: Previously, the task was posted to the blocking pool with
  BLOCK_SHUTDOWN (default in SequencedWorkerPool).

May Block:
  Tasks posted with MayBlock() may block. This includes but is not
  limited to tasks that wait on synchronous file I/O operations:
  read or write a file from disk, interact with a pipe or a socket,
  rename or delete a file, enumerate files in a directory, etc. This
  trait isn't required for the mere use of locks.

BUG=667892

Review-Url: https://codereview.chromium.org/2623313002
Cr-Commit-Position: refs/heads/master@{#443231}
parent 6f9dd03c
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "base/rand_util.h" #include "base/rand_util.h"
#include "base/strings/utf_string_conversions.h" #include "base/strings/utf_string_conversions.h"
#include "base/task_runner.h" #include "base/task_runner.h"
#include "base/task_runner_util.h" #include "base/task_scheduler/post_task.h"
#include "base/threading/sequenced_worker_pool.h" #include "base/threading/sequenced_worker_pool.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "build/build_config.h" #include "build/build_config.h"
...@@ -176,7 +176,7 @@ void CheckDownloadUrlDone( ...@@ -176,7 +176,7 @@ void CheckDownloadUrlDone(
#endif // FULL_SAFE_BROWSING #endif // FULL_SAFE_BROWSING
// Called on the blocking pool to determine the MIME type for |path|. // Called asynchronously to determine the MIME type for |path|.
std::string GetMimeType(const base::FilePath& path) { std::string GetMimeType(const base::FilePath& path) {
std::string mime_type; std::string mime_type;
net::GetMimeTypeFromFile(path, &mime_type); net::GetMimeTypeFromFile(path, &mime_type);
...@@ -676,10 +676,9 @@ void ChromeDownloadManagerDelegate::GetFileMimeType( ...@@ -676,10 +676,9 @@ void ChromeDownloadManagerDelegate::GetFileMimeType(
const base::FilePath& path, const base::FilePath& path,
const GetFileMimeTypeCallback& callback) { const GetFileMimeTypeCallback& callback) {
DCHECK_CURRENTLY_ON(BrowserThread::UI); DCHECK_CURRENTLY_ON(BrowserThread::UI);
base::PostTaskAndReplyWithResult(BrowserThread::GetBlockingPool(), base::PostTaskWithTraitsAndReplyWithResult(
FROM_HERE, FROM_HERE, base::TaskTraits().MayBlock(), base::Bind(&GetMimeType, path),
base::Bind(&GetMimeType, path), callback);
callback);
} }
#if defined(FULL_SAFE_BROWSING) #if defined(FULL_SAFE_BROWSING)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment