[PDF] Avoid unneeded cache invalidation in PDFiumRange::SetCharCount()
Currently, PDFiumRange::SetCharCount() will unconditionally mark the PDFiumRange instance's cached screen rects as dirty. This is unnecessary if the character count has not changed. Check for this condition and turn SetCharCount() into a no-op. Change-Id: I699d916b155d8e237774d7b408474e304bd07daa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6230982 Reviewed-by: Andy Phan <andyphan@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/main@{#1416281}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
b7347c9b6d
commit
254bd3158d
@ -63,6 +63,10 @@ PDFiumRange& PDFiumRange::operator=(PDFiumRange&&) noexcept = default;
|
||||
PDFiumRange::~PDFiumRange() = default;
|
||||
|
||||
void PDFiumRange::SetCharCount(int char_count) {
|
||||
if (char_count == char_count_) {
|
||||
return;
|
||||
}
|
||||
|
||||
char_count_ = char_count;
|
||||
#if DCHECK_IS_ON()
|
||||
int dummy_index = 0;
|
||||
|
Reference in New Issue
Block a user