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

Side by Side Diff: blimp/engine/renderer/blimp_engine_picture_cache.h

Issue 2629743003: Remove all blimp engine code (Closed)
Patch Set: Use consistent comment style in //chrome Created 3 years, 11 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 unified diff | Download patch
OLDNEW
(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 BLIMP_ENGINE_RENDERER_BLIMP_ENGINE_PICTURE_CACHE_H_
6 #define BLIMP_ENGINE_RENDERER_BLIMP_ENGINE_PICTURE_CACHE_H_
7
8 #include <memory>
9 #include <unordered_map>
10 #include <vector>
11
12 #include "base/macros.h"
13 #include "blimp/common/compositor/reference_tracker.h"
14 #include "cc/blimp/engine_picture_cache.h"
15 #include "cc/blimp/picture_data.h"
16 #include "third_party/skia/include/core/SkPicture.h"
17
18 class SkPixelSerializer;
19
20 namespace blimp {
21 namespace engine {
22
23 // BlimpEnginePictureCache provides functionality for caching SkPictures before
24 // they are sent from the engine to the client. The cache is cleared after
25 // every time it is flushed which happens when CalculateCacheUpdateAndFlush()
26 // is called. The expected state of what the client already has cached is
27 // tracked. It is required to update this cache when an SkPicture
28 // starts being used and when it is not longer in use by calling
29 // MarkPictureForRegistration and MarkPictureForUnregistration respectively.
30 // The lifetime of a cache matches the lifetime of a specific compositor.
31 // All interaction with this class should happen on the main thread.
32 class BlimpEnginePictureCache : public cc::EnginePictureCache {
33 public:
34 explicit BlimpEnginePictureCache(SkPixelSerializer* pixel_serializer);
35 ~BlimpEnginePictureCache() override;
36
37 // cc::EnginePictureCache implementation.
38 void MarkUsed(const SkPicture* picture) override;
39 std::vector<cc::PictureData> CalculateCacheUpdateAndFlush() override;
40
41 private:
42 // Serializes the SkPicture and adds it to |pictures_|.
43 void Put(const SkPicture* picture);
44
45 // A serializer that be used to pass in to SkPicture::serialize(...) for
46 // serializing the SkPicture to a stream.
47 SkPixelSerializer* pixel_serializer_;
48
49 // The current cache of pictures. Used for temporarily storing pictures until
50 // the next call to CalculateCacheUpdateAndFlush(), at which point this map
51 // is cleared.
52 std::unordered_map<uint32_t, cc::PictureData> pictures_;
53
54 // The reference tracker maintains the reference count of used SkPictures.
55 ReferenceTracker reference_tracker_;
56
57 DISALLOW_COPY_AND_ASSIGN(BlimpEnginePictureCache);
58 };
59
60 } // namespace engine
61 } // namespace blimp
62
63 #endif // BLIMP_ENGINE_RENDERER_BLIMP_ENGINE_PICTURE_CACHE_H_
OLDNEW
« no previous file with comments | « blimp/engine/renderer/blimp_content_renderer_client.cc ('k') | blimp/engine/renderer/blimp_engine_picture_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698