Commit 323012cd authored by Antonio Gomes's avatar Antonio Gomes Committed by Commit Bot

Use worker_pool::PostTask in MediaStreamAudioProcessor

... instead of base::PostTask directly.

This allows to also remove the associated whitelisted entry in
audit_non_blink_usage.py.

Given that audio_service_audio_processor_proxy.cc also benefits from
it, the CrossThreadCopier template specialization to base::File is
added to cross_thread_copier.h directly, so there is no code
duplication.

BUG=704136
R=haraken@chromium.org

Change-Id: I62e62c32b2001c1cb77d8a8d2f1bcd658b2ad6f5
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1749135
Auto-Submit: Antonio Gomes <tonikitoo@igalia.com>
Commit-Queue: Kentaro Hara <haraken@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Cr-Commit-Position: refs/heads/master@{#686255}
parent 6edfd78a
......@@ -31,6 +31,7 @@
#include "third_party/blink/public/web/modules/webrtc/webrtc_audio_device_impl.h"
#include "third_party/blink/renderer/platform/mediastream/aec_dump_agent_impl.h"
#include "third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h"
#include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
#include "third_party/webrtc/api/audio/echo_canceller3_config.h"
#include "third_party/webrtc/api/audio/echo_canceller3_config_json.h"
......@@ -384,10 +385,10 @@ void MediaStreamAudioProcessor::OnStartDump(base::File dump_file) {
std::move(dump_file), worker_queue_.get());
} else {
// Post the file close to avoid blocking the main thread.
base::PostTask(
worker_pool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::LOWEST, base::MayBlock()},
base::BindOnce([](base::File) {}, std::move(dump_file)));
CrossThreadBindOnce([](base::File) {}, std::move(dump_file)));
}
}
......
......@@ -12,6 +12,7 @@ include_rules = [
"+third_party/blink/renderer/platform/heap",
"+third_party/blink/renderer/platform/platform_export.h",
"+third_party/blink/renderer/platform/scheduler/public/post_cross_thread_task.h",
"+third_party/blink/renderer/platform/scheduler/public/worker_pool.h",
"+third_party/blink/renderer/platform/wtf/uuid.h",
"+third_party/blink/renderer/platform/wtf",
]
......@@ -18,6 +18,8 @@
#include "base/timer/timer.h"
#include "build/build_config.h"
#include "third_party/blink/renderer/platform/mediastream/aec_dump_agent_impl.h"
#include "third_party/blink/renderer/platform/scheduler/public/worker_pool.h"
#include "third_party/blink/renderer/platform/wtf/cross_thread_functional.h"
namespace blink {
......@@ -59,10 +61,10 @@ void AudioServiceAudioProcessorProxy::OnStartDump(base::File dump_file) {
processor_controls_->StartEchoCancellationDump(std::move(dump_file));
} else {
// Post the file close to avoid blocking the main thread.
base::PostTask(
worker_pool::PostTask(
FROM_HERE,
{base::ThreadPool(), base::TaskPriority::LOWEST, base::MayBlock()},
base::BindOnce([](base::File) {}, std::move(dump_file)));
CrossThreadBindOnce([](base::File) {}, std::move(dump_file)));
}
}
......
......@@ -34,6 +34,7 @@
#include <memory>
#include <string>
#include <vector>
#include "base/files/file.h"
#include "base/memory/scoped_refptr.h"
#include "base/memory/weak_ptr.h"
#include "gpu/command_buffer/common/sync_token.h"
......@@ -133,6 +134,13 @@ struct CrossThreadCopier<base::Time>
STATIC_ONLY(CrossThreadCopier);
};
template <>
struct CrossThreadCopier<base::File> {
STATIC_ONLY(CrossThreadCopier);
using Type = base::File;
static Type Copy(Type pointer) { return pointer; }
};
template <>
struct CrossThreadCopier<gpu::SyncToken>
: public CrossThreadCopierPassThrough<gpu::SyncToken> {
......
......@@ -670,7 +670,6 @@ _CONFIG = [
'base::Lock',
'base::StringPrintf',
'base::TaskRunner',
'base::PostTask',
# TODO(crbug.com/704136): Switch to using frame-based task runners.
'base::ThreadTaskRunnerHandle',
'base::subtle::Atomic32',
......
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