// Copyright 2018 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_PAINT_PAINT_CACHE_H_ #define CC_PAINT_PAINT_CACHE_H_ #include <map> #include <set> #include <utility> #include <vector> #include "base/containers/lru_cache.h" #include "cc/paint/paint_export.h" #include "third_party/abseil-cpp/absl/container/inlined_vector.h" #include "third_party/skia/include/core/SkPath.h" #include "third_party/skia/include/core/SkTextBlob.h" namespace cc { // PaintCache is used to cache high frequency small paint data types, like // SkTextBlob and SkPath in the GPU service. The ClientPaintCache budgets and // controls the cache state in the ServicePaintCache, regularly purging old // entries returned in ClientPaintCache::Purge from the service side cache. In // addition to this, the complete cache is cleared during the raster context // idle cleanup. This effectively means that the cache budget is used as working // memory that is only kept while we are actively rasterizing. // // The entries are serialized by the caller during paint op serialization, and // the cache assumes the deserialization and purging to be done in order for // accurately tracking the service side state in ServicePaintCache. // // Note that while TransferCache should be used for large data types that would // benefit from a shared cache budgeted across all clients, using a client // controlled PaintCache with a tighter budget is better for these data types // since it avoids the need for cross-process ref-counting required by the // TransferCache. PaintCacheId; PaintCacheIds; enum class PaintCacheDataType : uint32_t { … }; enum class PaintCacheEntryState : uint32_t { … }; constexpr size_t PaintCacheDataTypeCount = …; class CC_PAINT_EXPORT ClientPaintCache { … }; class CC_PAINT_EXPORT ServicePaintCache { … }; } // namespace cc #endif // CC_PAINT_PAINT_CACHE_H_