blob: 3366d417fff6101e6f922be37c4cf87ab5d69f1f [file] [log] [blame]
// Copyright 2015 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 "base/location.h"
#include "base/sequenced_task_runner.h"
#include "base/task/task_traits.h"
#include "third_party/blink/renderer/platform/platform_export.h"
#include "third_party/blink/renderer/platform/wtf/functional.h"
namespace blink {
namespace worker_pool {
// These are a thin wrapper around base::ThreadPool to ensure that all
// callers use WTF::CrossThreadBindOnce instead of base::Bind to ensure that
// all non-thread-safe objects are copied properly.
// All tasks that do not care about which thread they are running on
// (e.g. compressing/uncompressing tasks) use this API.
// Tasks that have to run on a specific thread (e.g. main thread, compositor
// thread, dedicated worker thread) should be posted via other means
// (e.g. FrameScheduler for main thread tasks).
PLATFORM_EXPORT void PostTask(const base::Location&, CrossThreadOnceClosure);
PLATFORM_EXPORT void PostTaskWithTraits(const base::Location&,
const base::TaskTraits&,
// TODO(altimin): Expose CreateSequencedTaskRunnerWithTraits when the
// need arises.
} // namespace worker_pool
} // namespace blink