Commit d23655d1 authored by Eric Seckler's avatar Eric Seckler Committed by Commit Bot

content/chrome: Replace remaining references to BrowserThread::PostTask

Replace the remaining references to BrowserThread::PostTask with the
base::PostTaskWithTraits API.

These locations weren't covered by the global replacement patch as they
were either added recently or ignored by the script.

TBR=lazyboy@chromium.org

Bug: 878356
Change-Id: Id199777ae6bcb30ebb03b767f9cd8c6f981c6ac4
Reviewed-on: https://chromium-review.googlesource.com/1235727
Commit-Queue: Eric Seckler <eseckler@chromium.org>
Reviewed-by: default avatarMax Morin <maxmorin@chromium.org>
Reviewed-by: default avatarJochen Eisinger <jochen@chromium.org>
Reviewed-by: default avatarAlex Clarke <alexclarke@chromium.org>
Reviewed-by: default avatarColin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#592796}
parent 67004092
...@@ -172,8 +172,8 @@ class BrowserProcess { ...@@ -172,8 +172,8 @@ class BrowserProcess {
// //
// Can be NULL close to startup and shutdown. // Can be NULL close to startup and shutdown.
// //
// NOTE: If you want to post a task to the IO thread, use // NOTE: If you want to post a task to the IO thread, see
// BrowserThread::PostTask (or other variants). // browser_task_traits.h.
virtual IOThread* io_thread() = 0; virtual IOThread* io_thread() = 0;
// Replacement for IOThread (And ChromeNetLog). It owns and manages the // Replacement for IOThread (And ChromeNetLog). It owns and manages the
......
...@@ -159,7 +159,7 @@ void UIThreadTrampolineHelper(base::OnceClosure callback) { ...@@ -159,7 +159,7 @@ void UIThreadTrampolineHelper(base::OnceClosure callback) {
// Convenience method to create a callback that can be run on any thread and // Convenience method to create a callback that can be run on any thread and
// will post the given |callback| back to the UI thread. // will post the given |callback| back to the UI thread.
base::OnceClosure UIThreadTrampoline(base::OnceClosure callback) { base::OnceClosure UIThreadTrampoline(base::OnceClosure callback) {
// We could directly bind &BrowserThread::PostTask, but that would require // We could directly bind &base::PostTaskWithTraits, but that would require
// evaluating FROM_HERE when this method is called, as opposed to when the // evaluating FROM_HERE when this method is called, as opposed to when the
// task is actually posted. // task is actually posted.
return base::BindOnce(&UIThreadTrampolineHelper, std::move(callback)); return base::BindOnce(&UIThreadTrampolineHelper, std::move(callback));
......
...@@ -53,11 +53,10 @@ std::unique_ptr<PolicyCertVerifier> ...@@ -53,11 +53,10 @@ std::unique_ptr<PolicyCertVerifier>
PolicyCertService::CreatePolicyCertVerifier() { PolicyCertService::CreatePolicyCertVerifier() {
base::Closure callback = base::Bind( base::Closure callback = base::Bind(
&PolicyCertServiceFactory::SetUsedPolicyCertificates, user_id_); &PolicyCertServiceFactory::SetUsedPolicyCertificates, user_id_);
constexpr base::TaskTraits traits = {content::BrowserThread::UI};
cert_verifier_ = new PolicyCertVerifier( cert_verifier_ = new PolicyCertVerifier(
base::Bind(base::IgnoreResult(&content::BrowserThread::PostTask), base::Bind(base::IgnoreResult(&base::PostTaskWithTraits), FROM_HERE,
content::BrowserThread::UI, traits, callback));
FROM_HERE,
callback));
// Certs are forwarded to |cert_verifier_|, thus register here after // Certs are forwarded to |cert_verifier_|, thus register here after
// |cert_verifier_| is created. // |cert_verifier_| is created.
net_conf_updater_->AddPolicyProvidedCertsObserver(this); net_conf_updater_->AddPolicyProvidedCertsObserver(this);
......
...@@ -70,7 +70,7 @@ namespace chrome_browser_net { ...@@ -70,7 +70,7 @@ namespace chrome_browser_net {
namespace { namespace {
// Postable function to run a Closure on the UI thread. Since // Postable function to run a Closure on the UI thread. Since
// BrowserThread::PostTask returns a bool, it can't directly be posted to // base::PostTaskWithTraits returns a bool, it can't directly be posted to
// another thread. // another thread.
void RunClosureOnUIThread(const base::Closure& closure) { void RunClosureOnUIThread(const base::Closure& closure) {
base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closure); base::PostTaskWithTraits(FROM_HERE, {BrowserThread::UI}, closure);
......
...@@ -77,8 +77,8 @@ QuotaInternalsProxy::~QuotaInternalsProxy() {} ...@@ -77,8 +77,8 @@ QuotaInternalsProxy::~QuotaInternalsProxy() {}
if (!handler_) \ if (!handler_) \
return; \ return; \
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { \ if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { \
BrowserThread::PostTask( \ base::PostTaskWithTraits( \
BrowserThread::UI, FROM_HERE, \ FROM_HERE, {BrowserThread::UI}, \
base::BindOnce(&QuotaInternalsProxy::func, this, arg)); \ base::BindOnce(&QuotaInternalsProxy::func, this, arg)); \
return; \ return; \
} \ } \
......
...@@ -51,7 +51,7 @@ class KEYED_SERVICE_EXPORT RefcountedKeyedService ...@@ -51,7 +51,7 @@ class KEYED_SERVICE_EXPORT RefcountedKeyedService
// If you need your service to be deleted on a specific sequence (for example, // If you need your service to be deleted on a specific sequence (for example,
// you're converting a service that used content::DeleteOnThread<IO>), then // you're converting a service that used content::DeleteOnThread<IO>), then
// use this constructor with a reference to the SequencedTaskRunner (e.g., you // use this constructor with a reference to the SequencedTaskRunner (e.g., you
// can get it from content::BrowserThread::GetTaskRunnerForThread). // can get it from base::CreateSequencedTaskRunnerWithTraits).
explicit RefcountedKeyedService( explicit RefcountedKeyedService(
scoped_refptr<base::SequencedTaskRunner> task_runner); scoped_refptr<base::SequencedTaskRunner> task_runner);
......
...@@ -10,9 +10,11 @@ ...@@ -10,9 +10,11 @@
#include "base/logging.h" #include "base/logging.h"
#include "base/memory/read_only_shared_memory_region.h" #include "base/memory/read_only_shared_memory_region.h"
#include "base/metrics/histogram_macros.h" #include "base/metrics/histogram_macros.h"
#include "base/task/post_task.h"
#include "base/trace_event/trace_event.h" #include "base/trace_event/trace_event.h"
#include "content/browser/browser_main_loop.h" #include "content/browser/browser_main_loop.h"
#include "content/browser/media/media_internals.h" #include "content/browser/media/media_internals.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h" #include "content/public/browser/browser_thread.h"
#include "content/public/browser/content_browser_client.h" #include "content/public/browser/content_browser_client.h"
#include "content/public/browser/media_observer.h" #include "content/public/browser/media_observer.h"
...@@ -36,8 +38,8 @@ enum KeyboardMicAction { kRegister, kDeregister }; ...@@ -36,8 +38,8 @@ enum KeyboardMicAction { kRegister, kDeregister };
void UpdateKeyboardMicRegistration(KeyboardMicAction action) { void UpdateKeyboardMicRegistration(KeyboardMicAction action) {
if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) { if (!BrowserThread::CurrentlyOn(BrowserThread::UI)) {
BrowserThread::PostTask( base::PostTaskWithTraits(
BrowserThread::UI, FROM_HERE, FROM_HERE, {BrowserThread::UI},
base::BindOnce(&UpdateKeyboardMicRegistration, action)); base::BindOnce(&UpdateKeyboardMicRegistration, action));
return; return;
} }
......
...@@ -3,7 +3,7 @@ execution latency on the UI and IO threads of the browser process. ...@@ -3,7 +3,7 @@ execution latency on the UI and IO threads of the browser process.
There are four types of work executed on the UI and IO threads. There are four types of work executed on the UI and IO threads.
1) Both the UI and IO threads can have tasks posted to them via the Task 1) Both the UI and IO threads can have tasks posted to them via the Task
Scheduler [e.g. via content::BrowserThread::PostTask]. Scheduler [e.g. via base::PostTaskWithTraits with a BrowserThread::ID].
2) The UI thread processes native events directly from the message loop 2) The UI thread processes native events directly from the message loop
[NSEvents on macOS, MSGs on Windows, InputEvents on Android, XEvents on [NSEvents on macOS, MSGs on Windows, InputEvents on Android, XEvents on
X11, etc.] X11, etc.]
......
...@@ -335,7 +335,7 @@ void MockDisplaySourceConnectionDelegate::Connect( ...@@ -335,7 +335,7 @@ void MockDisplaySourceConnectionDelegate::Connect(
// Bind sink to udp socket at this stage // Bind sink to udp socket at this stage
// And store udp port to udp_port_ string in order to be used // And store udp port to udp_port_ string in order to be used
// In a message exchange. Then make a BrowserThread::PostTask // In a message exchange. Then make a base::PostTaskWithTraits
// on UI thread and call OnSinkConnected() to proceed with the test // on UI thread and call OnSinkConnected() to proceed with the test
base::PostTaskWithTraits( base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO}, FROM_HERE, {BrowserThread::IO},
......
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