/* * Copyright 2025 Google LLC * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include "tools/graphite/precompile/PipelineCallbackHandler.h" namespace skiatools::graphite { void PipelineCallBackHandler::add(sk_sp payload) { SkAutoSpinlock lock{ fSpinLock }; const sk_sp* data = fMap.find({ payload.get() }); if (!data) { fMap.set(std::move(payload)); } } void PipelineCallBackHandler::retrieve( std::vector>* result) { SkAutoSpinlock lock{ fSpinLock }; result->reserve(fMap.count()); fMap.foreach([result](sk_sp* data) { result->push_back(*data); }); } void PipelineCallBackHandler::reset() { SkAutoSpinlock lock{ fSpinLock }; fMap.reset(); } } // namespace skiatools::graphite