| Index: cc/proto/picture_cache.h
|
| diff --git a/cc/proto/picture_cache.h b/cc/proto/picture_cache.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..197561a90002bef00e76e9ec991e0beb0b767dc3
|
| --- /dev/null
|
| +++ b/cc/proto/picture_cache.h
|
| @@ -0,0 +1,66 @@
|
| +// 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.
|
| +
|
| +#ifndef CC_PROTO_PICTURE_CACHE_H_
|
| +#define CC_PROTO_PICTURE_CACHE_H_
|
| +
|
| +#include <string>
|
| +#include <vector>
|
| +
|
| +#include "base/memory/ptr_util.h"
|
| +#include "cc/base/cc_export.h"
|
| +#include "third_party/skia/include/core/SkData.h"
|
| +#include "third_party/skia/include/core/SkRefCnt.h"
|
| +
|
| +class SkPicture;
|
| +
|
| +namespace cc {
|
| +struct PictureData;
|
| +
|
| +// EnginePictureCache provides functionaltiy for marking when SkPictures are in
|
| +// use an when they stop being in use. Based on this, a PictureCacheUpdate can
|
| +// be retrieved that includes all the new items since last time it was called.
|
| +// This PictureCacheUpdate is then supposed to be sent to the client.
|
| +class EnginePictureCache {
|
| + public:
|
| + virtual ~EnginePictureCache() {}
|
| +
|
| + // MarkUsed must be called when an SkPicture needs to available on the client.
|
| + virtual void MarkUsed(const SkPicture* picture) = 0;
|
| +
|
| + // Called when a PictureCacheUpdate is going to be sent to the client. This
|
| + // must contain all the new SkPictures that are in use since last call.
|
| + virtual std::vector<PictureData> CalculateCacheUpdateAndFlush() = 0;
|
| +};
|
| +
|
| +// ClientPictureCache provides functionaltiy for marking when SkPictures are in
|
| +// use an when they stop being in use. PictureCacheUpdates are provided
|
| +// with all new SkPictures that a client needs and the respective unique IDs
|
| +// used on the engine. The SkPictures are kept in memory until they are no
|
| +// longer in use.
|
| +class ClientPictureCache {
|
| + public:
|
| + virtual ~ClientPictureCache() {}
|
| +
|
| + // MarkUsed must be called when the client has started using an SkPicture that
|
| + // was sent to from the engine.
|
| + virtual void MarkUsed(uint32_t engine_picture_id) = 0;
|
| +
|
| + // Retrieves an SkPicture from the in-memory cache. It is required that the
|
| + // provided ID is the same as the unique ID that is given through the cache
|
| + // update.
|
| + virtual sk_sp<const SkPicture> GetPicture(uint32_t engine_picture_id) = 0;
|
| +
|
| + // Called when a PictureCacheUpdate has been retrieved from the engine. This
|
| + // must contain all the new SkPictures that are in use.
|
| + virtual void ApplyCacheUpdate(const std::vector<PictureData>& pictures) = 0;
|
| +
|
| + // Flushes the current state of the cache, removing unused SkPictures. Must be
|
| + // called after deserialization is finished.
|
| + virtual void Flush() = 0;
|
| +};
|
| +
|
| +} // namespace cc
|
| +
|
| +#endif // CC_PROTO_PICTURE_CACHE_H_
|
|
|