chromium/cc/trees/raster_context_provider_wrapper.h

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CC_TREES_RASTER_CONTEXT_PROVIDER_WRAPPER_H_
#define CC_TREES_RASTER_CONTEXT_PROVIDER_WRAPPER_H_

#include <memory>

#include "base/containers/flat_map.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_refptr.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "cc/cc_export.h"
#include "cc/trees/raster_capabilities.h"
#include "third_party/skia/include/core/SkColorType.h"

namespace viz {
class RasterContextProvider;
}  // namespace viz

namespace cc {

class RasterDarkModeFilter;
class GpuImageDecodeCache;

// A wrapper of a worker context that is responsible for creation and
// maintenance of GpuImageDecodeCache instances. These caches are created only
// when GPU rasterization is enabled and are meant to be shared across clients.
// If a parameter passed along with a request for a decode cache match to
// already existing cache, an existing cache is returned. This helps to share
// already decoded images between clients (eg 1+n browser windows).
// This class must be created, used and destroyed on the thread the underlying
// context is bound to. Or on a thread where the underlying context can be used
// if it supports locking.
class CC_EXPORT RasterContextProviderWrapper
    : public base::RefCountedThreadSafe<RasterContextProviderWrapper> {};

}  // namespace cc

#endif  // CC_TREES_RASTER_CONTEXT_PROVIDER_WRAPPER_H_