chromium/cc/paint/transfer_cache_entry.h

// Copyright 2017 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_TRANSFER_CACHE_ENTRY_H_
#define CC_PAINT_TRANSFER_CACHE_ENTRY_H_

#include <memory>

#include "base/containers/span.h"
#include "cc/paint/paint_export.h"

class GrDirectContext;

namespace skgpu::graphite {
class Recorder;
}  // namespace skgpu::graphite

namespace cc {

// To add a new transfer cache entry type:
//  - Add a type name to the TransferCacheEntryType enum.
//  - Implement a ClientTransferCacheEntry and ServiceTransferCacheEntry for
//    your new type.
//  - Update ServiceTransferCacheEntry::Create in transfer_cache_entry.cc.
enum class TransferCacheEntryType : uint32_t {};

// An interface used on the client to serialize a transfer cache entry
// into raw bytes that can be sent to the service.
class CC_PAINT_EXPORT ClientTransferCacheEntry {};

// An interface which receives the raw data sent by the client and
// deserializes it into the appropriate service-side object.
class CC_PAINT_EXPORT ServiceTransferCacheEntry {};

// Helpers to simplify subclassing.
template <class Base, TransferCacheEntryType EntryType>
class TransferCacheEntryBase : public Base {};

ClientTransferCacheEntryBase;

ServiceTransferCacheEntryBase;

}  // namespace cc

#endif  // CC_PAINT_TRANSFER_CACHE_ENTRY_H_