Chromium Code Reviews| Index: cc/proto/client_picture_cache.h |
| diff --git a/cc/proto/client_picture_cache.h b/cc/proto/client_picture_cache.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..e3281e4322cff0e59a5fcdb0898791a9a192e7b1 |
| --- /dev/null |
| +++ b/cc/proto/client_picture_cache.h |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
|
vmpstr
2016/06/24 18:58:32
I don't think this file should live in cc/proto
|
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CC_PROTO_CLIENT_PICTURE_CACHE_H_ |
| +#define CC_PROTO_CLIENT_PICTURE_CACHE_H_ |
| + |
| +#include <vector> |
| + |
| +#include "third_party/skia/include/core/SkRefCnt.h" |
| + |
| +class SkPicture; |
| + |
| +namespace cc { |
| +struct PictureData; |
| + |
| +// 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_CLIENT_PICTURE_CACHE_H_ |