Commit d961adca authored by Makoto Shimazu's avatar Makoto Shimazu Committed by Commit Bot

Revert "Migrate off base::ThreadPool()-as-a-trait in /chrome/browser/apps"

This reverts commit a8436a80.

Reason for revert: This looks highly related to flakiness failure of MusicManagerPrivateTest.DeviceIdValueReturned on Mac builders. Let me revert this specualtively.

Original change's description:
> Migrate off base::ThreadPool()-as-a-trait in /chrome/browser/apps
> 
> This CL is a logical no-op.
> 
> It manually covers the use cases the script
> (https://crbug.com/1026641#c22) didn't cover in
> https://chromium-review.googlesource.com/c/chromium/src/+/2026350.
> 
> A few of the affected files were also migrated to
> content::GetUIThreadTaskRunner() whenever surrounding code consistency
> was at stake (but the bulk of that migration is staged to happen after
> this one so this wasn't a priority in this batch).
> 
> Most files intentionally kept base/task/post_task.h as an include. It is
> still required because of a cyclical dependency during the migration
> preventing base/task/thread_pool.h from implicitly providing
> base/task/task_traits.h to its users (callers that explicitly store
> TaskTraits and include task_traits.h don't have this problem). The
> post_task.h include will be cleaned up in a later phase.
> 
> This CL was uploaded by git cl split.
> 
> R=​dominickn@chromium.org
> 
> Bug: 1026641
> Change-Id: I459605163ef0c2a48b8e6e803721c5a16dd80ef6
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2078658
> Commit-Queue: Gabriel Charette <gab@chromium.org>
> Auto-Submit: Gabriel Charette <gab@chromium.org>
> Reviewed-by: Dominick Ng <dominickn@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#745669}

TBR=gab@chromium.org,dominickn@chromium.org

# Not skipping CQ checks because original CL landed > 1 day ago.

Bug: 1026641, 1057502
Change-Id: I166a8cacd4225787ca752577d8f1af3abb9fe117
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2081716Reviewed-by: default avatarMakoto Shimazu <shimazu@chromium.org>
Commit-Queue: Makoto Shimazu <shimazu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#745831}
parent 4e3184af
......@@ -44,13 +44,15 @@ class DeviceId {
// new MAC addresses at each reboot.
static bool IsValidMacAddress(const void* bytes, size_t size);
// The traits of the task on base::ThreadPool that retrieves the device id.
// The traits of the task that retrieves the device id.
//
// ThreadPool(): This should run on a background thread.
// MayBlock(): Since this requires fetching disk.
// TaskPriority: USER_VISIBLE. Though this might be conservative, depending
// on how GetDeviceId() is used.
static constexpr base::TaskTraits traits() {
return {base::MayBlock(), base::TaskPriority::USER_VISIBLE};
return {base::ThreadPool(), base::MayBlock(),
base::TaskPriority::USER_VISIBLE};
}
};
......
......@@ -20,7 +20,7 @@
#include "base/stl_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/thread_pool.h"
#include "base/task/post_task.h"
#include "base/threading/scoped_blocking_call.h"
#include "content/public/browser/browser_task_traits.h"
#include "content/public/browser/browser_thread.h"
......@@ -182,8 +182,8 @@ void GetRawDeviceIdImpl(const IsValidMacAddressCallback& is_valid_mac_address,
raw_device_id = mac_address + disk_id;
}
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(callback, raw_device_id));
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(callback, raw_device_id));
}
} // namespace
......@@ -192,7 +192,7 @@ void GetRawDeviceIdImpl(const IsValidMacAddressCallback& is_valid_mac_address,
void DeviceId::GetRawDeviceId(const IdCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::ThreadPool::PostTask(
base::PostTask(
FROM_HERE, traits(),
base::BindOnce(&GetRawDeviceIdImpl,
base::Bind(&DeviceId::IsValidMacAddress), callback));
......
......@@ -23,7 +23,7 @@
#include "base/scoped_native_library.h"
#include "base/strings/string_number_conversions.h"
#include "base/strings/string_util.h"
#include "base/task/thread_pool.h"
#include "base/task/post_task.h"
#include "base/threading/scoped_blocking_call.h"
#include "base/win/windows_version.h"
#include "content/public/browser/browser_task_traits.h"
......@@ -176,8 +176,8 @@ void GetMacAddress(const IsValidMacAddressCallback& is_valid_mac_address,
LOG(ERROR) << "Could not find appropriate MAC address.";
}
content::GetUIThreadTaskRunner({})->PostTask(
FROM_HERE, base::BindOnce(callback, mac_address));
base::PostTask(FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(callback, mac_address));
}
std::string GetRlzMachineId() {
......@@ -209,7 +209,7 @@ void GetMacAddressCallback(const DeviceId::IdCallback& callback,
void DeviceId::GetRawDeviceId(const IdCallback& callback) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
base::ThreadPool::PostTask(
base::PostTask(
FROM_HERE, traits(),
base::Bind(&GetMacAddress, base::Bind(&DeviceId::IsValidMacAddress),
base::Bind(&GetMacAddressCallback, callback)));
......
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