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; |
28 class RasterSource; | 29 class RasterSource; |
29 class ImageSerializationProcessor; | |
30 class Region; | 30 class Region; |
31 | 31 |
32 class CC_EXPORT RecordingSource { | 32 class CC_EXPORT RecordingSource { |
33 public: | 33 public: |
34 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer | 34 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer |
35 // support a non-Slimming Paint path. | 35 // support a non-Slimming Paint path. |
36 enum RecordingMode { | 36 enum RecordingMode { |
37 RECORD_NORMALLY, | 37 RECORD_NORMALLY, |
38 RECORD_WITH_SK_NULL_CANVAS, | 38 RECORD_WITH_SK_NULL_CANVAS, |
39 RECORD_WITH_PAINTING_DISABLED, | 39 RECORD_WITH_PAINTING_DISABLED, |
40 RECORD_WITH_CACHING_DISABLED, | 40 RECORD_WITH_CACHING_DISABLED, |
41 RECORD_WITH_CONSTRUCTION_DISABLED, | 41 RECORD_WITH_CONSTRUCTION_DISABLED, |
42 RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED, | 42 RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED, |
43 RECORDING_MODE_COUNT, // Must be the last entry. | 43 RECORDING_MODE_COUNT, // Must be the last entry. |
44 }; | 44 }; |
45 | 45 |
46 RecordingSource(); | 46 RecordingSource(); |
47 virtual ~RecordingSource(); | 47 virtual ~RecordingSource(); |
48 | 48 |
49 void ToProtobuf( | 49 void ToProtobuf(proto::RecordingSource* proto) const; |
50 proto::RecordingSource* proto, | |
51 ImageSerializationProcessor* image_serialization_processor) const; | |
52 void FromProtobuf(const proto::RecordingSource& proto, | 50 void FromProtobuf(const proto::RecordingSource& proto, |
53 ImageSerializationProcessor* image_serialization_processor); | 51 ClientPictureCache* client_picture_cache, |
| 52 std::vector<uint32_t>* used_engine_picture_ids); |
54 | 53 |
55 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | 54 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, |
56 Region* invalidation, | 55 Region* invalidation, |
57 const gfx::Size& layer_size, | 56 const gfx::Size& layer_size, |
58 int frame_number, | 57 int frame_number, |
59 RecordingMode recording_mode); | 58 RecordingMode recording_mode); |
60 gfx::Size GetSize() const; | 59 gfx::Size GetSize() const; |
61 void SetEmptyBounds(); | 60 void SetEmptyBounds(); |
62 void SetSlowdownRasterScaleFactor(int factor); | 61 void SetSlowdownRasterScaleFactor(int factor); |
63 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | 62 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); |
64 void SetBackgroundColor(SkColor background_color); | 63 void SetBackgroundColor(SkColor background_color); |
65 void SetRequiresClear(bool requires_clear); | 64 void SetRequiresClear(bool requires_clear); |
66 | 65 |
67 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); | 66 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); |
68 | 67 |
69 // These functions are virtual for testing. | 68 // These functions are virtual for testing. |
70 virtual scoped_refptr<RasterSource> CreateRasterSource( | 69 virtual scoped_refptr<RasterSource> CreateRasterSource( |
71 bool can_use_lcd_text) const; | 70 bool can_use_lcd_text) const; |
72 virtual bool IsSuitableForGpuRasterization() const; | 71 virtual bool IsSuitableForGpuRasterization() const; |
73 | 72 |
74 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | 73 gfx::Rect recorded_viewport() const { return recorded_viewport_; } |
75 | 74 |
| 75 const DisplayItemList* GetDisplayItemList(); |
| 76 |
76 protected: | 77 protected: |
77 void Clear(); | 78 void Clear(); |
78 | 79 |
79 gfx::Rect recorded_viewport_; | 80 gfx::Rect recorded_viewport_; |
80 gfx::Size size_; | 81 gfx::Size size_; |
81 int slow_down_raster_scale_factor_for_debug_; | 82 int slow_down_raster_scale_factor_for_debug_; |
82 bool generate_discardable_images_metadata_; | 83 bool generate_discardable_images_metadata_; |
83 bool requires_clear_; | 84 bool requires_clear_; |
84 bool is_solid_color_; | 85 bool is_solid_color_; |
85 bool clear_canvas_with_debug_color_; | 86 bool clear_canvas_with_debug_color_; |
(...skipping 14 matching lines...) Expand all Loading... |
100 void DetermineIfSolidColor(); | 101 void DetermineIfSolidColor(); |
101 | 102 |
102 InvalidationRegion invalidation_; | 103 InvalidationRegion invalidation_; |
103 | 104 |
104 DISALLOW_COPY_AND_ASSIGN(RecordingSource); | 105 DISALLOW_COPY_AND_ASSIGN(RecordingSource); |
105 }; | 106 }; |
106 | 107 |
107 } // namespace cc | 108 } // namespace cc |
108 | 109 |
109 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ | 110 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ |
OLD | NEW |