// 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. #include "flutter/common/threads.h" #include namespace blink { namespace { Threads* g_threads = nullptr; } // namespace Threads::Threads() {} Threads::Threads(fxl::RefPtr platform, fxl::RefPtr gpu, fxl::RefPtr ui, fxl::RefPtr io) : platform_(std::move(platform)), gpu_(std::move(gpu)), ui_(std::move(ui)), io_(std::move(io)) {} Threads::~Threads() {} const fxl::RefPtr& Threads::Platform() { return Get().platform_; } const fxl::RefPtr& Threads::Gpu() { return Get().gpu_; } const fxl::RefPtr& Threads::UI() { return Get().ui_; } const fxl::RefPtr& Threads::IO() { return Get().io_; } const Threads& Threads::Get() { FXL_CHECK(g_threads); return *g_threads; } void Threads::Set(const Threads& threads) { FXL_CHECK(!g_threads); g_threads = new Threads(); *g_threads = threads; } } // namespace blink