// Copyright 2016 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 FLUTTER_COMMON_THREADS_H_ #define FLUTTER_COMMON_THREADS_H_ #include "lib/fxl/tasks/task_runner.h" #define ASSERT_IS_PLATFORM_THREAD \ FXL_DCHECK(::blink::Threads::Platform()->RunsTasksOnCurrentThread()); #define ASSERT_IS_GPU_THREAD \ FXL_DCHECK(::blink::Threads::Gpu()->RunsTasksOnCurrentThread()); #define ASSERT_IS_UI_THREAD \ FXL_DCHECK(::blink::Threads::UI()->RunsTasksOnCurrentThread()); #define ASSERT_IS_IO_THREAD \ FXL_DCHECK(::blink::Threads::IO()->RunsTasksOnCurrentThread()); namespace blink { class Threads { public: Threads(); Threads(fxl::RefPtr platform, fxl::RefPtr gpu, fxl::RefPtr ui, fxl::RefPtr io); ~Threads(); static const fxl::RefPtr& Platform(); static const fxl::RefPtr& Gpu(); static const fxl::RefPtr& UI(); static const fxl::RefPtr& IO(); static void Set(const Threads& settings); private: static const Threads& Get(); fxl::RefPtr platform_; fxl::RefPtr gpu_; fxl::RefPtr ui_; fxl::RefPtr io_; }; } // namespace blink #endif // FLUTTER_COMMON_THREADS_H_