blob: c81de74ade2bcf57c3bf992a96e885a35503c239 [file] [log] [blame]
// Copyright 2020 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.
#ifndef CC_PAINT_SKOTTIE_TRANSFER_CACHE_ENTRY_H_
#define CC_PAINT_SKOTTIE_TRANSFER_CACHE_ENTRY_H_
#include "base/containers/span.h"
#include "base/memory/ref_counted_memory.h"
#include "cc/paint/transfer_cache_entry.h"
namespace cc {
class SkottieWrapper;
// Client/ServiceSkottieTransferCacheEntry implements a transfer cache entry
// for transferring skottie data.
class CC_PAINT_EXPORT ClientSkottieTransferCacheEntry
: public ClientTransferCacheEntryBase<TransferCacheEntryType::kSkottie> {
public:
explicit ClientSkottieTransferCacheEntry(
scoped_refptr<SkottieWrapper> skottie);
~ClientSkottieTransferCacheEntry() final;
uint32_t Id() const final;
// ClientTransferCacheEntry implementation:
uint32_t SerializedSize() const final;
bool Serialize(base::span<uint8_t> data) const final;
private:
scoped_refptr<SkottieWrapper> skottie_;
};
class CC_PAINT_EXPORT ServiceSkottieTransferCacheEntry
: public ServiceTransferCacheEntryBase<TransferCacheEntryType::kSkottie> {
public:
ServiceSkottieTransferCacheEntry();
~ServiceSkottieTransferCacheEntry() final;
// ServiceTransferCacheEntry implementation:
size_t CachedSize() const final;
bool Deserialize(GrContext* context, base::span<const uint8_t> data) final;
const scoped_refptr<SkottieWrapper>& skottie() const { return skottie_; }
private:
scoped_refptr<SkottieWrapper> skottie_;
uint32_t cached_size_ = 0;
};
} // namespace cc
#endif // CC_PAINT_SKOTTIE_TRANSFER_CACHE_ENTRY_H_