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

Unified Diff: content/browser/renderer_host/p2p/socket_dispatcher_host.cc

Issue 2963733002: Use TaskScheduler instead of PostTask in P2PSocketDispatcherHost. (Closed)
Patch Set: Move TaskRunner creation to .cc file. Created 3 years, 6 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 | « content/browser/renderer_host/p2p/socket_dispatcher_host.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/p2p/socket_dispatcher_host.cc
diff --git a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
index b3de3e5a4327538fedc1610d035705100d4124fa..d791db160e68f4150d52ad218382411212e37992 100644
--- a/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
+++ b/content/browser/renderer_host/p2p/socket_dispatcher_host.cc
@@ -10,6 +10,7 @@
#include "base/bind.h"
#include "base/memory/ptr_util.h"
+#include "base/task_scheduler/post_task.h"
#include "content/browser/bad_message.h"
#include "content/browser/renderer_host/p2p/socket_host.h"
#include "content/common/p2p_messages.h"
@@ -119,8 +120,9 @@ P2PSocketDispatcherHost::P2PSocketDispatcherHost(
url_context_(url_context),
monitoring_networks_(false),
dump_incoming_rtp_packet_(false),
- dump_outgoing_rtp_packet_(false) {
-}
+ dump_outgoing_rtp_packet_(false),
+ network_list_task_runner_(base::CreateSequencedTaskRunnerWithTraits(
+ {base::MayBlock(), base::TaskPriority::USER_VISIBLE})) {}
void P2PSocketDispatcherHost::OnChannelClosing() {
// Since the IPC sender is gone, close pending connections.
@@ -159,9 +161,8 @@ bool P2PSocketDispatcherHost::OnMessageReceived(const IPC::Message& message) {
void P2PSocketDispatcherHost::OnIPAddressChanged() {
// Notify the renderer about changes to list of network interfaces.
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE, base::Bind(
- &P2PSocketDispatcherHost::DoGetNetworkList, this));
+ network_list_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&P2PSocketDispatcherHost::DoGetNetworkList, this));
}
void P2PSocketDispatcherHost::StartRtpDump(
@@ -215,9 +216,8 @@ void P2PSocketDispatcherHost::OnStartNetworkNotifications() {
monitoring_networks_ = true;
}
- BrowserThread::PostTask(
- BrowserThread::FILE, FROM_HERE, base::Bind(
- &P2PSocketDispatcherHost::DoGetNetworkList, this));
+ network_list_task_runner_->PostTask(
+ FROM_HERE, base::Bind(&P2PSocketDispatcherHost::DoGetNetworkList, this));
}
void P2PSocketDispatcherHost::OnStopNetworkNotifications() {
@@ -367,7 +367,7 @@ net::IPAddress P2PSocketDispatcherHost::GetDefaultLocalAddress(int family) {
DCHECK(family == AF_INET || family == AF_INET6);
// Creation and connection of a UDP socket might be janky.
- DCHECK_CURRENTLY_ON(BrowserThread::FILE);
+ DCHECK(network_list_task_runner_->RunsTasksInCurrentSequence());
std::unique_ptr<net::DatagramClientSocket> socket(
net::ClientSocketFactory::GetDefaultFactory()->CreateDatagramClientSocket(
« no previous file with comments | « content/browser/renderer_host/p2p/socket_dispatcher_host.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698