Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5084)

Unified Diff: cc/test/fake_engine_picture_cache.cc

Issue 1982893002: [blimp] Add SkPicture caching support. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed comments from vmpstr, including adding //cc/blimp Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « cc/test/fake_engine_picture_cache.h ('k') | cc/test/fake_image_serialization_processor.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/test/fake_engine_picture_cache.cc
diff --git a/cc/test/fake_engine_picture_cache.cc b/cc/test/fake_engine_picture_cache.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2c7b839511f747a26fccd74b96b22217362a1793
--- /dev/null
+++ b/cc/test/fake_engine_picture_cache.cc
@@ -0,0 +1,51 @@
+// 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.
+
+#include "cc/test/fake_engine_picture_cache.h"
+
+#include <map>
+#include <memory>
+
+#include "cc/blimp/picture_data.h"
+#include "cc/playback/display_item_list.h"
+#include "cc/test/picture_cache_model.h"
+#include "third_party/skia/include/core/SkPicture.h"
+
+namespace cc {
+
+FakeEnginePictureCache::FakeEnginePictureCache(PictureCacheModel* model)
+ : model_(model) {}
+
+FakeEnginePictureCache::~FakeEnginePictureCache() {}
+
+void FakeEnginePictureCache::MarkAllSkPicturesAsUsed(
+ const DisplayItemList* display_list) {
+ if (!display_list)
+ return;
+
+ for (auto it = display_list->begin(); it != display_list->end(); ++it) {
+ sk_sp<const SkPicture> picture = it->GetPicture();
+ if (!picture)
+ continue;
+
+ MarkUsed(picture.get());
+ }
+}
+
+const std::vector<uint32_t>& FakeEnginePictureCache::GetAllUsedPictureIds() {
+ return used_picture_ids_;
+}
+
+void FakeEnginePictureCache::MarkUsed(const SkPicture* picture) {
+ if (model_)
+ model_->AddPicture(picture);
+ used_picture_ids_.push_back(picture->uniqueID());
+}
+
+std::vector<PictureData>
+FakeEnginePictureCache::CalculateCacheUpdateAndFlush() {
+ return std::vector<PictureData>();
+}
+
+} // namespace cc
« no previous file with comments | « cc/test/fake_engine_picture_cache.h ('k') | cc/test/fake_image_serialization_processor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698