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

Unified Diff: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp

Issue 2768143002: Back PaintRecord with PaintOpBuffer instead of SkPicture (Closed)
Patch Set: more const casting Created 3 years, 8 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: third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
index a703076d843449e1c822eebbbb27d2e0d3e3ffc9..0f9980266fa5593bd7375c8ef62c4066d50125e8 100644
--- a/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
+++ b/third_party/WebKit/Source/platform/graphics/paint/PaintController.cpp
@@ -16,6 +16,8 @@
#include <stdio.h>
#endif
+static constexpr int kMaxNumberOfSlowPathsBeforeVeto = 5;
+
namespace blink {
void PaintController::SetTracksRasterInvalidations(bool value) {
@@ -536,7 +538,7 @@ void PaintController::CommitNewDisplayItems(
!new_display_item_list_.IsEmpty())
GenerateChunkRasterInvalidationRects(new_paint_chunks_.LastChunk());
- SkPictureGpuAnalyzer gpu_analyzer;
+ int num_slow_paths = 0;
current_cache_generation_ =
DisplayItemClient::CacheGenerationOrInvalidationReason::Next();
@@ -555,8 +557,8 @@ void PaintController::CommitNewDisplayItems(
Vector<const DisplayItemClient*> skipped_cache_clients;
for (const auto& item : new_display_item_list_) {
// No reason to continue the analysis once we have a veto.
- if (gpu_analyzer.suitableForGpuRasterization())
- item.AnalyzeForGpuRasterization(gpu_analyzer);
+ if (num_slow_paths <= kMaxNumberOfSlowPathsBeforeVeto)
+ num_slow_paths += item.NumberOfSlowPaths();
// TODO(wkorman): Only compute and append visual rect for drawings.
new_display_item_list_.AppendVisualRect(
@@ -594,7 +596,7 @@ void PaintController::CommitNewDisplayItems(
new_display_item_list_.ShrinkToFit();
current_paint_artifact_ = PaintArtifact(
std::move(new_display_item_list_), new_paint_chunks_.ReleasePaintChunks(),
- gpu_analyzer.suitableForGpuRasterization());
+ num_slow_paths <= kMaxNumberOfSlowPathsBeforeVeto);
ResetCurrentListIndices();
out_of_order_item_indices_.clear();
out_of_order_chunk_indices_.clear();

Powered by Google App Engine
This is Rietveld 408576698