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 |
52 void FromProtobuf(const proto::RecordingSource& proto, | 53 // Updates the EnginePictureCache or ClientPictureCache about the SkPictures |
53 ImageSerializationProcessor* image_serialization_processor); | 54 // currently in use. |
55 void MarkForRegistration(); | |
vmpstr
2016/06/01 00:10:57
I think these should be private
nyquist
2016/06/04 00:24:58
Done.
| |
56 void MarkForUnregistration(); | |
54 | 57 |
55 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | 58 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, |
56 Region* invalidation, | 59 Region* invalidation, |
57 const gfx::Size& layer_size, | 60 const gfx::Size& layer_size, |
58 int frame_number, | 61 int frame_number, |
59 RecordingMode recording_mode); | 62 RecordingMode recording_mode); |
60 gfx::Size GetSize() const; | 63 gfx::Size GetSize() const; |
61 void SetEmptyBounds(); | 64 void SetEmptyBounds(); |
62 void SetSlowdownRasterScaleFactor(int factor); | 65 void SetSlowdownRasterScaleFactor(int factor); |
63 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | 66 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); |
64 void SetBackgroundColor(SkColor background_color); | 67 void SetBackgroundColor(SkColor background_color); |
65 void SetRequiresClear(bool requires_clear); | 68 void SetRequiresClear(bool requires_clear); |
66 | 69 |
67 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); | 70 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); |
68 | 71 |
72 void set_engine_picture_cache(EnginePictureCache* engine_picture_cache) { | |
vmpstr
2016/06/01 00:10:57
These setters can do more than just set a pointer
nyquist
2016/06/04 00:24:58
Done.
| |
73 engine_picture_cache_ = engine_picture_cache; | |
74 } | |
75 | |
76 void set_client_picture_cache(ClientPictureCache* client_picture_cache) { | |
77 client_picture_cache_ = client_picture_cache; | |
78 } | |
79 | |
69 // These functions are virtual for testing. | 80 // These functions are virtual for testing. |
70 virtual scoped_refptr<RasterSource> CreateRasterSource( | 81 virtual scoped_refptr<RasterSource> CreateRasterSource( |
71 bool can_use_lcd_text) const; | 82 bool can_use_lcd_text) const; |
72 virtual bool IsSuitableForGpuRasterization() const; | 83 virtual bool IsSuitableForGpuRasterization() const; |
73 | 84 |
74 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | 85 gfx::Rect recorded_viewport() const { return recorded_viewport_; } |
75 | 86 |
76 protected: | 87 protected: |
77 void Clear(); | 88 void Clear(); |
78 | 89 |
79 gfx::Rect recorded_viewport_; | 90 gfx::Rect recorded_viewport_; |
80 gfx::Size size_; | 91 gfx::Size size_; |
81 int slow_down_raster_scale_factor_for_debug_; | 92 int slow_down_raster_scale_factor_for_debug_; |
82 bool generate_discardable_images_metadata_; | 93 bool generate_discardable_images_metadata_; |
83 bool requires_clear_; | 94 bool requires_clear_; |
84 bool is_solid_color_; | 95 bool is_solid_color_; |
85 bool clear_canvas_with_debug_color_; | 96 bool clear_canvas_with_debug_color_; |
86 SkColor solid_color_; | 97 SkColor solid_color_; |
87 SkColor background_color_; | 98 SkColor background_color_; |
88 | 99 |
100 EnginePictureCache* engine_picture_cache_; | |
vmpstr
2016/06/01 00:10:57
I think this at least needs a comment explaining w
nyquist
2016/06/04 00:24:58
Done.
| |
101 ClientPictureCache* client_picture_cache_; | |
102 | |
89 scoped_refptr<DisplayItemList> display_list_; | 103 scoped_refptr<DisplayItemList> display_list_; |
90 size_t painter_reported_memory_usage_; | 104 size_t painter_reported_memory_usage_; |
91 | 105 |
92 private: | 106 private: |
93 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, | 107 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, |
94 const gfx::Rect& new_recorded_viewport, | 108 const gfx::Rect& new_recorded_viewport, |
95 Region* invalidation); | 109 Region* invalidation); |
96 void FinishDisplayItemListUpdate(); | 110 void FinishDisplayItemListUpdate(); |
97 | 111 |
98 friend class RasterSource; | 112 friend class RasterSource; |
99 | 113 |
100 void DetermineIfSolidColor(); | 114 void DetermineIfSolidColor(); |
101 | 115 |
102 InvalidationRegion invalidation_; | 116 InvalidationRegion invalidation_; |
103 | 117 |
104 DISALLOW_COPY_AND_ASSIGN(RecordingSource); | 118 DISALLOW_COPY_AND_ASSIGN(RecordingSource); |
105 }; | 119 }; |
106 | 120 |
107 } // namespace cc | 121 } // namespace cc |
108 | 122 |
109 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ | 123 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ |
OLD | NEW |