OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_PLAYBACK_RECORDING_SOURCE_H_ | 5 #ifndef CC_PLAYBACK_RECORDING_SOURCE_H_ |
6 #define CC_PLAYBACK_RECORDING_SOURCE_H_ | 6 #define CC_PLAYBACK_RECORDING_SOURCE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "cc/base/cc_export.h" | 14 #include "cc/base/cc_export.h" |
15 #include "cc/base/invalidation_region.h" | 15 #include "cc/base/invalidation_region.h" |
16 #include "third_party/skia/include/core/SkColor.h" | 16 #include "third_party/skia/include/core/SkColor.h" |
17 #include "ui/gfx/geometry/rect.h" | 17 #include "ui/gfx/geometry/rect.h" |
18 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
19 | 19 |
20 namespace cc { | 20 namespace cc { |
21 | 21 |
22 namespace proto { | 22 namespace proto { |
23 class RecordingSource; | 23 class RecordingSource; |
24 } // namespace proto | 24 } // namespace proto |
25 | 25 |
26 class ClientPictureCache; | |
26 class ContentLayerClient; | 27 class ContentLayerClient; |
27 class DisplayItemList; | 28 class DisplayItemList; |
29 class EnginePictureCache; | |
28 class RasterSource; | 30 class RasterSource; |
29 class ImageSerializationProcessor; | |
30 class Region; | 31 class Region; |
31 | 32 |
32 class CC_EXPORT RecordingSource { | 33 class CC_EXPORT RecordingSource { |
33 public: | 34 public: |
34 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer | 35 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer |
35 // support a non-Slimming Paint path. | 36 // support a non-Slimming Paint path. |
36 enum RecordingMode { | 37 enum RecordingMode { |
37 RECORD_NORMALLY, | 38 RECORD_NORMALLY, |
38 RECORD_WITH_SK_NULL_CANVAS, | 39 RECORD_WITH_SK_NULL_CANVAS, |
39 RECORD_WITH_PAINTING_DISABLED, | 40 RECORD_WITH_PAINTING_DISABLED, |
40 RECORD_WITH_CACHING_DISABLED, | 41 RECORD_WITH_CACHING_DISABLED, |
41 RECORD_WITH_CONSTRUCTION_DISABLED, | 42 RECORD_WITH_CONSTRUCTION_DISABLED, |
42 RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED, | 43 RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED, |
43 RECORDING_MODE_COUNT, // Must be the last entry. | 44 RECORDING_MODE_COUNT, // Must be the last entry. |
44 }; | 45 }; |
45 | 46 |
46 RecordingSource(); | 47 RecordingSource(); |
47 virtual ~RecordingSource(); | 48 virtual ~RecordingSource(); |
48 | 49 |
49 void ToProtobuf( | 50 void ToProtobuf(proto::RecordingSource* proto) const; |
50 proto::RecordingSource* proto, | 51 void FromProtobuf(const proto::RecordingSource& proto); |
51 ImageSerializationProcessor* image_serialization_processor) const; | |
52 void FromProtobuf(const proto::RecordingSource& proto, | |
53 ImageSerializationProcessor* image_serialization_processor); | |
54 | 52 |
55 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | 53 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, |
56 Region* invalidation, | 54 Region* invalidation, |
57 const gfx::Size& layer_size, | 55 const gfx::Size& layer_size, |
58 int frame_number, | 56 int frame_number, |
59 RecordingMode recording_mode); | 57 RecordingMode recording_mode); |
60 gfx::Size GetSize() const; | 58 gfx::Size GetSize() const; |
61 void SetEmptyBounds(); | 59 void SetEmptyBounds(); |
62 void SetSlowdownRasterScaleFactor(int factor); | 60 void SetSlowdownRasterScaleFactor(int factor); |
63 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | 61 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); |
64 void SetBackgroundColor(SkColor background_color); | 62 void SetBackgroundColor(SkColor background_color); |
65 void SetRequiresClear(bool requires_clear); | 63 void SetRequiresClear(bool requires_clear); |
66 | 64 |
67 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); | 65 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); |
68 | 66 |
67 void SetEnginePictureCache(EnginePictureCache* engine_picture_cache); | |
68 | |
69 void SetClientPictureCache(ClientPictureCache* client_picture_cache); | |
70 | |
69 // These functions are virtual for testing. | 71 // These functions are virtual for testing. |
70 virtual scoped_refptr<RasterSource> CreateRasterSource( | 72 virtual scoped_refptr<RasterSource> CreateRasterSource( |
71 bool can_use_lcd_text) const; | 73 bool can_use_lcd_text) const; |
72 virtual bool IsSuitableForGpuRasterization() const; | 74 virtual bool IsSuitableForGpuRasterization() const; |
73 | 75 |
74 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | 76 gfx::Rect recorded_viewport() const { return recorded_viewport_; } |
75 | 77 |
76 protected: | 78 protected: |
77 void Clear(); | 79 void Clear(); |
78 | 80 |
(...skipping 13 matching lines...) Expand all Loading... | |
92 private: | 94 private: |
93 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, | 95 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, |
94 const gfx::Rect& new_recorded_viewport, | 96 const gfx::Rect& new_recorded_viewport, |
95 Region* invalidation); | 97 Region* invalidation); |
96 void FinishDisplayItemListUpdate(); | 98 void FinishDisplayItemListUpdate(); |
97 | 99 |
98 friend class RasterSource; | 100 friend class RasterSource; |
99 | 101 |
100 void DetermineIfSolidColor(); | 102 void DetermineIfSolidColor(); |
101 | 103 |
104 // Updates the EnginePictureCache about the SkPictures currently in use. | |
105 void MarkForRegistrationEngine(); | |
vmpstr
2016/06/16 22:09:59
Similarly here... is it possible to expose the ite
nyquist
2016/06/24 11:11:14
Done.
| |
106 void MarkForUnregistrationEngine(); | |
107 | |
108 // Updates the ClientPictureCache about the SkPictures currently in use. | |
109 void MarkForRegistrationClient(); | |
110 void MarkForUnregistrationClient(); | |
111 | |
112 // EnginePictureCache is used when the RecordingSource is instantiated on an | |
113 // engine, and the ClientPictureCache is only used on the client. They are | |
114 // never used together, but since the APIs are not the same, there needs | |
115 // to be two different members. Both caches are used to track which | |
116 // SkPictures are in use within the RecordingSource. | |
117 EnginePictureCache* engine_picture_cache_; | |
118 ClientPictureCache* client_picture_cache_; | |
119 | |
102 InvalidationRegion invalidation_; | 120 InvalidationRegion invalidation_; |
103 | 121 |
104 DISALLOW_COPY_AND_ASSIGN(RecordingSource); | 122 DISALLOW_COPY_AND_ASSIGN(RecordingSource); |
105 }; | 123 }; |
106 | 124 |
107 } // namespace cc | 125 } // namespace cc |
108 | 126 |
109 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ | 127 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ |
OLD | NEW |