| 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 #include "cc/test/fake_engine_picture_cache.h" | |
| 6 | |
| 7 #include <map> | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "cc/blimp/picture_data.h" | |
| 11 #include "cc/playback/display_item_list.h" | |
| 12 #include "cc/test/picture_cache_model.h" | |
| 13 #include "third_party/skia/include/core/SkPicture.h" | |
| 14 | |
| 15 namespace cc { | |
| 16 | |
| 17 FakeEnginePictureCache::FakeEnginePictureCache(PictureCacheModel* model) | |
| 18 : model_(model) {} | |
| 19 | |
| 20 FakeEnginePictureCache::~FakeEnginePictureCache() {} | |
| 21 | |
| 22 void FakeEnginePictureCache::MarkAllSkPicturesAsUsed( | |
| 23 const DisplayItemList* display_list) { | |
| 24 if (!display_list) | |
| 25 return; | |
| 26 | |
| 27 for (auto it = display_list->begin(); it != display_list->end(); ++it) { | |
| 28 sk_sp<const SkPicture> picture = it->GetPicture(); | |
| 29 if (!picture) | |
| 30 continue; | |
| 31 | |
| 32 MarkUsed(picture.get()); | |
| 33 } | |
| 34 } | |
| 35 | |
| 36 const std::vector<uint32_t>& FakeEnginePictureCache::GetAllUsedPictureIds() { | |
| 37 return used_picture_ids_; | |
| 38 } | |
| 39 | |
| 40 void FakeEnginePictureCache::MarkUsed(const SkPicture* picture) { | |
| 41 if (model_) | |
| 42 model_->AddPicture(picture); | |
| 43 used_picture_ids_.push_back(picture->uniqueID()); | |
| 44 } | |
| 45 | |
| 46 std::vector<PictureData> | |
| 47 FakeEnginePictureCache::CalculateCacheUpdateAndFlush() { | |
| 48 return std::vector<PictureData>(); | |
| 49 } | |
| 50 | |
| 51 } // namespace cc | |
| OLD | NEW |