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

Unified Diff: cc/blimp/client_picture_cache.h

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/BUILD.gn ('k') | cc/blimp/engine_picture_cache.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/blimp/client_picture_cache.h
diff --git a/cc/blimp/client_picture_cache.h b/cc/blimp/client_picture_cache.h
new file mode 100644
index 0000000000000000000000000000000000000000..ddee6a32dde862056786bb847c4caadcba9e6282
--- /dev/null
+++ b/cc/blimp/client_picture_cache.h
@@ -0,0 +1,46 @@
+// 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.
+
+#ifndef CC_BLIMP_CLIENT_PICTURE_CACHE_H_
+#define CC_BLIMP_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_BLIMP_CLIENT_PICTURE_CACHE_H_
« no previous file with comments | « cc/BUILD.gn ('k') | cc/blimp/engine_picture_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698