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

Unified Diff: net/dns/address_sorter_win.cc

Issue 2607283002: Use TaskScheduler instead of WorkerPool in address_sorter_win.cc. (Closed)
Patch Set: Add ScopedTaskScheduler. 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 | « net/dns/address_sorter_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/address_sorter_win.cc
diff --git a/net/dns/address_sorter_win.cc b/net/dns/address_sorter_win.cc
index 18e8721cd79ea3c01c058d0140ebfa687946093d..a085af5c3e216f28802c703dfb2caf37a2124e6e 100644
--- a/net/dns/address_sorter_win.cc
+++ b/net/dns/address_sorter_win.cc
@@ -13,7 +13,7 @@
#include "base/logging.h"
#include "base/macros.h"
#include "base/memory/free_deleter.h"
-#include "base/threading/worker_pool.h"
+#include "base/task_scheduler/post_task.h"
#include "net/base/address_list.h"
#include "net/base/ip_address.h"
#include "net/base/ip_endpoint.h"
@@ -39,7 +39,7 @@ class AddressSorterWin : public AddressSorter {
}
private:
- // Executes the SIO_ADDRESS_LIST_SORT ioctl on the WorkerPool, and
+ // Executes the SIO_ADDRESS_LIST_SORT ioctl asynchronously, and
// performs the necessary conversions to/from AddressList.
class Job : public base::RefCountedThreadSafe<Job> {
public:
@@ -73,21 +73,19 @@ class AddressSorterWin : public AddressSorter {
input_buffer_->Address[i].iSockaddrLength = addr_len;
}
- if (!base::WorkerPool::PostTaskAndReply(
- FROM_HERE,
- base::Bind(&Job::Run, this),
- base::Bind(&Job::OnComplete, this),
- false /* task is slow */)) {
- LOG(ERROR) << "WorkerPool::PostTaskAndReply failed";
- OnComplete();
- }
+ base::PostTaskWithTraitsAndReply(
+ FROM_HERE, base::TaskTraits()
+ .WithShutdownBehavior(
+ base::TaskShutdownBehavior::CONTINUE_ON_SHUTDOWN)
+ .MayBlock(),
+ base::Bind(&Job::Run, this), base::Bind(&Job::OnComplete, this));
}
private:
friend class base::RefCountedThreadSafe<Job>;
~Job() {}
- // Executed on the WorkerPool.
+ // Executed asynchronously in TaskScheduler.
void Run() {
SOCKET sock = socket(AF_INET6, SOCK_DGRAM, IPPROTO_UDP);
if (sock == INVALID_SOCKET)
« no previous file with comments | « net/dns/address_sorter_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698