OLD | NEW |
---|---|
(Empty) | |
1 // 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
| |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CC_PROTO_CLIENT_PICTURE_CACHE_H_ | |
6 #define CC_PROTO_CLIENT_PICTURE_CACHE_H_ | |
7 | |
8 #include <vector> | |
9 | |
10 #include "third_party/skia/include/core/SkRefCnt.h" | |
11 | |
12 class SkPicture; | |
13 | |
14 namespace cc { | |
15 struct PictureData; | |
16 | |
17 // ClientPictureCache provides functionaltiy for marking when SkPictures are in | |
18 // use an when they stop being in use. PictureCacheUpdates are provided | |
19 // with all new SkPictures that a client needs and the respective unique IDs | |
20 // used on the engine. The SkPictures are kept in memory until they are no | |
21 // longer in use. | |
22 class ClientPictureCache { | |
23 public: | |
24 virtual ~ClientPictureCache() {} | |
25 | |
26 // MarkUsed must be called when the client has started using an SkPicture that | |
27 // was sent to from the engine. | |
28 virtual void MarkUsed(uint32_t engine_picture_id) = 0; | |
29 | |
30 // Retrieves an SkPicture from the in-memory cache. It is required that the | |
31 // provided ID is the same as the unique ID that is given through the cache | |
32 // update. | |
33 virtual sk_sp<const SkPicture> GetPicture(uint32_t engine_picture_id) = 0; | |
34 | |
35 // Called when a PictureCacheUpdate has been retrieved from the engine. This | |
36 // must contain all the new SkPictures that are in use. | |
37 virtual void ApplyCacheUpdate(const std::vector<PictureData>& pictures) = 0; | |
38 | |
39 // Flushes the current state of the cache, removing unused SkPictures. Must be | |
40 // called after deserialization is finished. | |
41 virtual void Flush() = 0; | |
42 }; | |
43 | |
44 } // namespace cc | |
45 | |
46 #endif // CC_PROTO_CLIENT_PICTURE_CACHE_H_ | |
OLD | NEW |