Commit 2bd2b61a authored by Gabriel Charette's avatar Gabriel Charette Committed by Commit Bot

Mass-migrate users of base::ThreadPool() as a trait to base::ThreadPool:: API [blink]

Split blink/ from https://chromium-review.googlesource.com/c/chromium/src/+/2026350
as it had trouble landing in one go.

Added thread_pool.h to third_party/blink/renderer/DEPS

The following script was used to generate this CL (run on every C++
file in the codebase; processing .h before matching .cc/.mm):
https://bugs.chromium.org/p/chromium/issues/detail?id=1026641#c22
(intentionally ignores cleaning post_task.h for now).

TBR=haraken@chromium.org

Bug: 1026641
Change-Id: Ief6f3e47f9c31db794dcb7a791735de51c79a43f
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2075137Reviewed-by: default avatarGabriel Charette <gab@chromium.org>
Commit-Queue: Gabriel Charette <gab@chromium.org>
Cr-Commit-Position: refs/heads/master@{#744703}
parent 7dfbd139
...@@ -38,6 +38,7 @@ include_rules = [ ...@@ -38,6 +38,7 @@ include_rules = [
"+base/sys_byteorder.h", "+base/sys_byteorder.h",
"+base/system/sys_info.h", "+base/system/sys_info.h",
"+base/task/post_task.h", "+base/task/post_task.h",
"+base/task/thread_pool.h",
"+base/template_util.h", "+base/template_util.h",
"+base/test/metrics/histogram_tester.h", "+base/test/metrics/histogram_tester.h",
"+base/test/mock_callback.h", "+base/test/mock_callback.h",
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "third_party/blink/renderer/core/fileapi/file.h" #include "third_party/blink/renderer/core/fileapi/file.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "mojo/public/cpp/bindings/receiver_set.h" #include "mojo/public/cpp/bindings/receiver_set.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -26,7 +27,7 @@ class MockBlob : public FakeBlob { ...@@ -26,7 +27,7 @@ class MockBlob : public FakeBlob {
static void Create(File* file, base::Time modified_time) { static void Create(File* file, base::Time modified_time) {
mojo::PendingRemote<mojom::blink::Blob> remote; mojo::PendingRemote<mojom::blink::Blob> remote;
PostCrossThreadTask( PostCrossThreadTask(
*base::CreateSingleThreadTaskRunner({base::ThreadPool()}), FROM_HERE, *base::ThreadPool::CreateSingleThreadTaskRunner({}), FROM_HERE,
CrossThreadBindOnce( CrossThreadBindOnce(
[](const String& uuid, [](const String& uuid,
mojo::PendingReceiver<mojom::blink::Blob> receiver, mojo::PendingReceiver<mojom::blink::Blob> receiver,
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "base/bind.h" #include "base/bind.h"
#include "base/run_loop.h" #include "base/run_loop.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
#include "mojo/public/cpp/bindings/pending_remote.h" #include "mojo/public/cpp/bindings/pending_remote.h"
#include "mojo/public/cpp/bindings/remote.h" #include "mojo/public/cpp/bindings/remote.h"
...@@ -65,7 +66,7 @@ TEST(StorageControllerTest, CacheLimit) { ...@@ -65,7 +66,7 @@ TEST(StorageControllerTest, CacheLimit) {
StorageController::DomStorageConnection connection; StorageController::DomStorageConnection connection;
PostCrossThreadTask( PostCrossThreadTask(
*base::CreateSequencedTaskRunner({base::ThreadPool()}), FROM_HERE, *base::ThreadPool::CreateSequencedTaskRunner({}), FROM_HERE,
CrossThreadBindOnce( CrossThreadBindOnce(
[](mojo::PendingReceiver<mojom::blink::DomStorage> receiver) { [](mojo::PendingReceiver<mojom::blink::DomStorage> receiver) {
mojo::MakeSelfOwnedReceiver(std::make_unique<MockDomStorage>(), mojo::MakeSelfOwnedReceiver(std::make_unique<MockDomStorage>(),
...@@ -116,7 +117,7 @@ TEST(StorageControllerTest, CacheLimitSessionStorage) { ...@@ -116,7 +117,7 @@ TEST(StorageControllerTest, CacheLimitSessionStorage) {
Persistent<FakeAreaSource> source_area = Persistent<FakeAreaSource> source_area =
MakeGarbageCollected<FakeAreaSource>(kPageUrl); MakeGarbageCollected<FakeAreaSource>(kPageUrl);
auto task_runner = base::CreateSequencedTaskRunner({base::ThreadPool()}); auto task_runner = base::ThreadPool::CreateSequencedTaskRunner({});
auto mock_dom_storage = std::make_unique<MockDomStorage>(); auto mock_dom_storage = std::make_unique<MockDomStorage>();
MockDomStorage* dom_storage_ptr = mock_dom_storage.get(); MockDomStorage* dom_storage_ptr = mock_dom_storage.get();
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "base/single_thread_task_runner.h" #include "base/single_thread_task_runner.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/task_traits.h" #include "base/task/task_traits.h"
#include "base/task/thread_pool.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h" #include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/webdatabase/web_database.mojom-blink.h" #include "third_party/blink/public/mojom/webdatabase/web_database.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
...@@ -38,9 +39,8 @@ mojom::blink::WebDatabaseHost& WebDatabaseHost::GetWebDatabaseHost() { ...@@ -38,9 +39,8 @@ mojom::blink::WebDatabaseHost& WebDatabaseHost::GetWebDatabaseHost() {
if (!shared_remote_) { if (!shared_remote_) {
DCHECK(pending_remote_); DCHECK(pending_remote_);
shared_remote_ = mojo::SharedRemote<mojom::blink::WebDatabaseHost>( shared_remote_ = mojo::SharedRemote<mojom::blink::WebDatabaseHost>(
std::move(pending_remote_), std::move(pending_remote_), base::ThreadPool::CreateSequencedTaskRunner(
base::CreateSequencedTaskRunner( {base::WithBaseSyncPrimitives()}));
{base::ThreadPool(), base::WithBaseSyncPrimitives()}));
} }
return *shared_remote_; return *shared_remote_;
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include "base/numerics/safe_conversions.h" #include "base/numerics/safe_conversions.h"
#include "base/task/post_task.h" #include "base/task/post_task.h"
#include "base/task/thread_pool.h"
#include "mojo/public/cpp/bindings/self_owned_receiver.h" #include "mojo/public/cpp/bindings/self_owned_receiver.h"
#include "third_party/blink/public/platform/platform.h" #include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/instrumentation/histogram.h" #include "third_party/blink/renderer/platform/instrumentation/histogram.h"
...@@ -117,8 +118,8 @@ constexpr size_t BlobBytesProvider::kMaxConsolidatedItemSizeInBytes; ...@@ -117,8 +118,8 @@ constexpr size_t BlobBytesProvider::kMaxConsolidatedItemSizeInBytes;
// static // static
BlobBytesProvider* BlobBytesProvider::CreateAndBind( BlobBytesProvider* BlobBytesProvider::CreateAndBind(
mojo::PendingReceiver<mojom::blink::BytesProvider> receiver) { mojo::PendingReceiver<mojom::blink::BytesProvider> receiver) {
auto task_runner = base::CreateSequencedTaskRunner( auto task_runner = base::ThreadPool::CreateSequencedTaskRunner(
{base::ThreadPool(), base::MayBlock(), base::TaskPriority::USER_VISIBLE}); {base::MayBlock(), base::TaskPriority::USER_VISIBLE});
auto provider = base::WrapUnique(new BlobBytesProvider(task_runner)); auto provider = base::WrapUnique(new BlobBytesProvider(task_runner));
auto* result = provider.get(); auto* result = provider.get();
// TODO(mek): Consider binding BytesProvider on the IPC thread instead, only // TODO(mek): Consider binding BytesProvider on the IPC thread instead, only
......
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