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

Unified Diff: cc/layers/picture_layer.h

Issue 2141233002: cc: Clean up RecordingSource API (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: cc/layers/picture_layer.h
diff --git a/cc/layers/picture_layer.h b/cc/layers/picture_layer.h
index 447a936be981de3302a485e4d2ff0f2ec9a73db0..db890699d7d21efaa7a728f6365e8c86c68ccba4 100644
--- a/cc/layers/picture_layer.h
+++ b/cc/layers/picture_layer.h
@@ -11,14 +11,62 @@
#include "cc/debug/micro_benchmark_controller.h"
#include "cc/layers/layer.h"
+namespace {
vmpstr 2016/07/20 22:18:10 I don't think anonymous namespace in a header file
Menglin 2016/07/20 22:39:31 OK.
+
+#ifdef NDEBUG
+const bool kDefaultClearCanvasSetting = false;
+#else
+const bool kDefaultClearCanvasSetting = true;
+#endif
+
+} // namespace
+
namespace cc {
class ContentLayerClient;
-class RecordingSource;
+class DisplayItemList;
+class RasterSource;
class ResourceUpdateQueue;
+struct PictureLayerData {
vmpstr 2016/07/20 22:18:10 These should probably move to separate files.
Menglin 2016/07/20 22:39:31 Some header file just for these two structs?
vmpstr 2016/07/20 23:55:55 Or even a header per... The rule is usually one cl
+ PictureLayerData();
+ ~PictureLayerData();
+
+ gfx::Size size;
vmpstr 2016/07/20 22:18:10 Can you rename this to something more meaningful?
Menglin 2016/07/20 22:39:31 Looking at code here, I think it's the recorded re
vmpstr 2016/07/20 23:55:54 Yeah I think that's a good idea.
+ int slow_down_raster_scale_factor_for_debug = 0;
+ bool generate_discardable_images_metadata = false;
+ bool requires_clear = false;
+ bool is_solid_color = false;
+ bool clear_canvas_with_debug_color = kDefaultClearCanvasSetting;
+ SkColor solid_color = SK_ColorTRANSPARENT;
+ SkColor background_color = SK_ColorTRANSPARENT;
+};
+
+// Encapsulates all data received from the ContentLayerClient.
+struct ContentLayerClientData {
+ ContentLayerClientData();
+ ContentLayerClientData(const ContentLayerClientData&);
+ ~ContentLayerClientData();
+
+ gfx::Rect recorded_viewport;
+ scoped_refptr<DisplayItemList> display_list;
+ size_t painter_reported_memory_usage = 0;
+};
+
class CC_EXPORT PictureLayer : public Layer {
public:
+ // TODO(schenney) Remove RECORD_WITH_SK_NULL_CANVAS when we no longer
+ // support a non-Slimming Paint path.
+ enum RecordingMode {
+ RECORD_NORMALLY,
+ RECORD_WITH_SK_NULL_CANVAS,
+ RECORD_WITH_PAINTING_DISABLED,
+ RECORD_WITH_CACHING_DISABLED,
+ RECORD_WITH_CONSTRUCTION_DISABLED,
+ RECORD_WITH_SUBSEQUENCE_CACHING_DISABLED,
+ RECORDING_MODE_COUNT, // Must be the last entry.
+ };
+
static scoped_refptr<PictureLayer> Create(ContentLayerClient* client);
void ClearClient();
@@ -39,15 +87,34 @@ class CC_EXPORT PictureLayer : public Layer {
ContentLayerClient* client() { return inputs_.client; }
- RecordingSource* GetRecordingSourceForTesting() {
- return recording_source_.get();
- }
+ bool UpdateAndExpandInvalidation(
+ Region* invalidation,
+ const gfx::Size& layer_size,
+ PictureLayer::RecordingMode recording_mode,
+ PictureLayerData* layer_data,
+ ContentLayerClientData* client_data,
+ InvalidationRegion* invalidation_state) const;
+
+ void ResetLayerAndClientData();
+ void SetGenerateDiscardableImagesMetadata(bool generate_metadata);
+ void SetBackgroundColorSimple(SkColor background_color);
+ void SetRequiresClear(bool requires_clear);
+ void SetNeedsDisplayRectSimple(const gfx::Rect& layer_rect);
+ gfx::Size GetSizeInLayerData() const;
+ const DisplayItemList* GetDisplayItemList();
+
+ // These functions are virtual for testing.
+ virtual scoped_refptr<RasterSource> CreateRasterSource(
+ const PictureLayerData& layer_data,
+ const ContentLayerClientData& client_data,
+ bool can_use_lcd_text) const;
protected:
explicit PictureLayer(ContentLayerClient* client);
- // Allow tests to inject a recording source.
+ // Tests will pass in data instead of a RecordingSource.
PictureLayer(ContentLayerClient* client,
- std::unique_ptr<RecordingSource> source);
+ const PictureLayerData& layer_data,
+ const ContentLayerClientData& client_data);
~PictureLayer() override;
bool HasDrawableContent() const override;
@@ -58,12 +125,24 @@ class CC_EXPORT PictureLayer : public Layer {
bool is_mask() const { return is_mask_; }
+ PictureLayerData layer_data_;
+ ContentLayerClientData client_data_;
+
private:
friend class TestSerializationPictureLayer;
void DropRecordingSourceContentIfInvalid();
- std::unique_ptr<RecordingSource> recording_source_;
+ void UpdateInvalidationForNewViewport(const gfx::Rect& old_recorded_viewport,
+ const gfx::Rect& new_recorded_viewport,
+ Region* invalidation) const;
+
+ void FinishDisplayItemListUpdate(PictureLayerData* layer_data,
+ ContentLayerClientData* client_data) const;
+
+ void DetermineIfSolidColor(PictureLayerData* layer_data,
+ ContentLayerClientData* client_data) const;
+
devtools_instrumentation::
ScopedLayerObjectTracker instrumentation_object_tracker_;
@@ -80,6 +159,8 @@ class CC_EXPORT PictureLayer : public Layer {
Inputs inputs_;
+ InvalidationRegion invalidation_;
+
DISALLOW_COPY_AND_ASSIGN(PictureLayer);
};

Powered by Google App Engine
This is Rietveld 408576698