| Index: third_party/WebKit/Source/core/workers/WorkerTaskRunners.h
|
| diff --git a/third_party/WebKit/Source/core/workers/WorkerTaskRunners.h b/third_party/WebKit/Source/core/workers/WorkerTaskRunners.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..b8f5e8b98fe34964065e74d131580b2c065296ed
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerTaskRunners.h
|
| @@ -0,0 +1,47 @@
|
| +// Copyright 2017 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.
|
| +
|
| +#ifndef WorkerTaskRunners_h
|
| +#define WorkerTaskRunners_h
|
| +
|
| +#include <memory>
|
| +#include "core/CoreExport.h"
|
| +#include "core/dom/TaskRunnerHelper.h"
|
| +#include "platform/wtf/HashMap.h"
|
| +#include "platform/wtf/Noncopyable.h"
|
| +#include "platform/wtf/PassRefPtr.h"
|
| +#include "platform/wtf/RefPtr.h"
|
| +#include "platform/wtf/ThreadSafeRefCounted.h"
|
| +
|
| +namespace blink {
|
| +
|
| +class WebTaskRunner;
|
| +class WorkerOrWorkletGlobalScope;
|
| +
|
| +// Represents a set of task runners of the worker/worklet global context. This
|
| +// could be accessed from any threads and must be initialized on the thread
|
| +// where the context is running.
|
| +class CORE_EXPORT WorkerTaskRunners final
|
| + : public ThreadSafeRefCounted<WorkerTaskRunners> {
|
| + WTF_MAKE_NONCOPYABLE(WorkerTaskRunners);
|
| +
|
| + public:
|
| + static RefPtr<WorkerTaskRunners> Create(WorkerOrWorkletGlobalScope*);
|
| +
|
| + RefPtr<WebTaskRunner> Get(TaskType);
|
| +
|
| + private:
|
| + using TaskRunnerHashMap = HashMap<TaskType,
|
| + RefPtr<WebTaskRunner>,
|
| + WTF::IntHash<TaskType>,
|
| + TaskTypeTraits>;
|
| +
|
| + explicit WorkerTaskRunners(WorkerOrWorkletGlobalScope*);
|
| +
|
| + TaskRunnerHashMap task_runners_;
|
| +};
|
| +
|
| +} // namespace blink
|
| +
|
| +#endif // WorkerTaskRunners_h
|
|
|