// 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 "third_party/skia/include/core/SkRefCnt.h"#include <mutex>#include <queue>namespaceblink{// A queue that holds Skia objects that must be destructed on the IO thread.classSkiaUnrefQueue{public:staticSkiaUnrefQueue&Get();voidUnref(SkRefCnt*object);private:SkiaUnrefQueue();voidDrain();staticSkiaUnrefQueueinstance_;std::mutexmutex_;std::deque<SkRefCnt*>objects_;booldrain_pending_;};template<typenameT>voidSkiaUnrefOnIOThread(sk_sp<T>*sp){T*object=sp->release();if(object){SkiaUnrefQueue::Get().Unref(object);}}}// namespace blink