blob: db0116020ba96735d09a1199f60a3677acd9b4cd [file] [log] [blame]
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/browser/browser_thread.h"
#include <utility>
#include "base/callback.h"
#include "base/location.h"
#include "content/public/browser/browser_task_traits.h"
namespace content {
void RunOrPostTaskOnThread(const base::Location& location,
BrowserThread::ID thread_id,
base::OnceClosure task) {
if (BrowserThread::CurrentlyOn(thread_id)) {
std::move(task).Run();
return;
}
BrowserThread::GetTaskRunnerForThread(thread_id)->PostTask(location,
std::move(task));
}
} // namespace content