OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 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_TEST_PICTURE_CACHE_MODEL_H_ |
| 6 #define CC_TEST_PICTURE_CACHE_MODEL_H_ |
| 7 |
| 8 #include <stdint.h> |
| 9 |
| 10 #include <unordered_map> |
| 11 |
| 12 #include "base/macros.h" |
| 13 #include "third_party/skia/include/core/SkRefCnt.h" |
| 14 |
| 15 class SkPicture; |
| 16 |
| 17 namespace cc { |
| 18 |
| 19 // PictureCacheModel provides a way for sharing a cache between an engine |
| 20 // and the client. When the FakeEnginePictureCache and the ClientPictureCache |
| 21 // point to the same PictureCacheModel, the calls to AddPicture on the |
| 22 // engine make an SkPicture available through GetPicture on the client. |
| 23 class PictureCacheModel { |
| 24 public: |
| 25 PictureCacheModel(); |
| 26 ~PictureCacheModel(); |
| 27 |
| 28 void AddPicture(const SkPicture* picture); |
| 29 |
| 30 sk_sp<const SkPicture> GetPicture(uint32_t unique_id); |
| 31 |
| 32 private: |
| 33 std::unordered_map<uint32_t, sk_sp<const SkPicture>> pictures_; |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(PictureCacheModel); |
| 36 }; |
| 37 |
| 38 } // namespace cc |
| 39 |
| 40 #endif // CC_TEST_PICTURE_CACHE_MODEL_H_ |
OLD | NEW |