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

Unified Diff: chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc

Issue 2628673003: Use TaskScheduler instead of blocking pool in arc_downloads_watcher_service.cc. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc
diff --git a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc
index 7dfc420450e5c38bb353f392f156670a6b3aef8b..0c48e73ac5c2901ebc601e51d0e4cb8967a92719 100644
--- a/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc
+++ b/chrome/browser/chromeos/arc/downloads_watcher/arc_downloads_watcher_service.cc
@@ -18,6 +18,7 @@
#include "base/files/file_path_watcher.h"
#include "base/memory/ptr_util.h"
#include "base/strings/string_util.h"
+#include "base/task_scheduler/post_task.h"
#include "base/time/time.h"
#include "chrome/browser/download/download_prefs.h"
#include "chrome/browser/profiles/profile_manager.h"
@@ -276,8 +277,8 @@ void ArcDownloadsWatcherService::DownloadsWatcher::OnFilePathChanged(
void ArcDownloadsWatcherService::DownloadsWatcher::DelayBuildTimestampMap() {
DCHECK_CURRENTLY_ON(BrowserThread::FILE);
DCHECK(outstanding_task_);
- base::PostTaskAndReplyWithResult(
- BrowserThread::GetBlockingPool(), FROM_HERE,
+ base::PostTaskWithTraitsAndReplyWithResult(
+ FROM_HERE, base::TaskTraits().MayBlock(),
base::Bind(&BuildTimestampMapCallback, downloads_dir_),
base::Bind(&DownloadsWatcher::OnBuildTimestampMap,
weak_ptr_factory_.GetWeakPtr()));
@@ -301,15 +302,10 @@ void ArcDownloadsWatcherService::DownloadsWatcher::OnBuildTimestampMap(
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(callback_, base::Passed(std::move(string_paths))));
- if (last_notify_time_ > snapshot_time) {
- base::PostTaskAndReplyWithResult(
- BrowserThread::GetBlockingPool(), FROM_HERE,
- base::Bind(&BuildTimestampMapCallback, downloads_dir_),
- base::Bind(&DownloadsWatcher::OnBuildTimestampMap,
- weak_ptr_factory_.GetWeakPtr()));
- } else {
+ if (last_notify_time_ > snapshot_time)
+ DelayBuildTimestampMap();
+ else
outstanding_task_ = false;
- }
}
ArcDownloadsWatcherService::ArcDownloadsWatcherService(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698