| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CC_PLAYBACK_RECORDING_SOURCE_H_ | |
| 6 #define CC_PLAYBACK_RECORDING_SOURCE_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 #include <memory> | |
| 11 | |
| 12 #include "base/macros.h" | |
| 13 #include "base/memory/ref_counted.h" | |
| 14 #include "cc/base/cc_export.h" | |
| 15 #include "cc/base/invalidation_region.h" | |
| 16 #include "third_party/skia/include/core/SkColor.h" | |
| 17 #include "ui/gfx/geometry/rect.h" | |
| 18 #include "ui/gfx/geometry/size.h" | |
| 19 | |
| 20 namespace cc { | |
| 21 | |
| 22 namespace proto { | |
| 23 class RecordingSource; | |
| 24 } // namespace proto | |
| 25 | |
| 26 class ClientPictureCache; | |
| 27 class ContentLayerClient; | |
| 28 class DisplayItemList; | |
| 29 class RasterSource; | |
| 30 class Region; | |
| 31 | |
| 32 class CC_EXPORT RecordingSource { | |
| 33 public: | |
| 34 // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer | |
| 35 // support a non-Slimming Paint path. | |
| 36 enum RecordingMode { | |
| 37 RECORD_NORMALLY, | |
| 38 RECORD_WITH_SK_NULL_CANVAS, | |
| 39 RECORD_WITH_PAINTING_DISABLED, | |
| 40 RECORD_WITH_CACHING_DISABLED, | |
| 41 RECORD_WITH_CONSTRUCTION_DISABLED, | |
| 42 RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED, | |
| 43 RECORDING_MODE_COUNT, // Must be the last entry. | |
| 44 }; | |
| 45 | |
| 46 RecordingSource(); | |
| 47 virtual ~RecordingSource(); | |
| 48 | |
| 49 void ToProtobuf(proto::RecordingSource* proto) const; | |
| 50 void FromProtobuf(const proto::RecordingSource& proto, | |
| 51 ClientPictureCache* client_picture_cache, | |
| 52 std::vector<uint32_t>* used_engine_picture_ids); | |
| 53 | |
| 54 bool UpdateAndExpandInvalidation(ContentLayerClient* painter, | |
| 55 Region* invalidation, | |
| 56 const gfx::Size& layer_size, | |
| 57 int frame_number, | |
| 58 RecordingMode recording_mode); | |
| 59 gfx::Size GetSize() const; | |
| 60 void SetEmptyBounds(); | |
| 61 void SetSlowdownRasterScaleFactor(int factor); | |
| 62 void SetGenerateDiscardableImagesMetadata(bool generate_metadata); | |
| 63 void SetBackgroundColor(SkColor background_color); | |
| 64 void SetRequiresClear(bool requires_clear); | |
| 65 | |
| 66 void SetNeedsDisplayRect(const gfx::Rect& layer_rect); | |
| 67 | |
| 68 // These functions are virtual for testing. | |
| 69 virtual scoped_refptr<RasterSource> CreateRasterSource( | |
| 70 bool can_use_lcd_text) const; | |
| 71 virtual bool IsSuitableForGpuRasterization() const; | |
| 72 | |
| 73 gfx::Rect recorded_viewport() const { return recorded_viewport_; } | |
| 74 | |
| 75 const DisplayItemList* GetDisplayItemList(); | |
| 76 | |
| 77 protected: | |
| 78 void Clear(); | |
| 79 | |
| 80 gfx::Rect recorded_viewport_; | |
| 81 gfx::Size size_; | |
| 82 int slow_down_raster_scale_factor_for_debug_; | |
| 83 bool generate_discardable_images_metadata_; | |
| 84 bool requires_clear_; | |
| 85 bool is_solid_color_; | |
| 86 bool clear_canvas_with_debug_color_; | |
| 87 SkColor solid_color_; | |
| 88 SkColor background_color_; | |
| 89 | |
| 90 scoped_refptr<DisplayItemList> display_list_; | |
| 91 size_t painter_reported_memory_usage_; | |
| 92 | |
| 93 private: | |
| 94 void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport, | |
| 95 const gfx::Rect& new_recorded_viewport, | |
| 96 Region* invalidation); | |
| 97 void FinishDisplayItemListUpdate(); | |
| 98 | |
| 99 friend class RasterSource; | |
| 100 | |
| 101 void DetermineIfSolidColor(); | |
| 102 | |
| 103 InvalidationRegion invalidation_; | |
| 104 | |
| 105 DISALLOW_COPY_AND_ASSIGN(RecordingSource); | |
| 106 }; | |
| 107 | |
| 108 } // namespace cc | |
| 109 | |
| 110 #endif // CC_PLAYBACK_RECORDING_SOURCE_H_ | |
| OLD | NEW |