0

Change parameter types from pointer to regular reference in //pdf/.

Change parameter type from std::vector<>* to regular references to
comply with the style guide for OnPaint(), DoPaint() and
PrepareForFirstPaint().

Change-Id: I660482c52b8138721bc9981b8a07acbf82c1bf97
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2674303
Commit-Queue: Hui Yingst <nigi@chromium.org>
Reviewed-by: Daniel Hosseinian <dhoss@chromium.org>
Cr-Commit-Position: refs/heads/master@{#850774}
This commit is contained in:
Hui Yingst
2021-02-04 21:23:58 +00:00
committed by Chromium LUCI CQ
parent 4b0e6043e2
commit 2d79289d15
4 changed files with 18 additions and 18 deletions

@ -214,7 +214,7 @@ void PaintManager::DoPaint() {
}
PaintAggregator::PaintUpdate update = aggregator_.GetPendingUpdate();
client_->OnPaint(update.paint_rects, &ready_rects, &pending_rects);
client_->OnPaint(update.paint_rects, ready_rects, pending_rects);
if (ready_rects.empty() && pending_rects.empty())
return; // Nothing was painted, don't schedule a flush.

@ -69,8 +69,8 @@ class PaintManager {
//
// Calling Invalidate/Scroll is not allowed while inside an OnPaint
virtual void OnPaint(const std::vector<gfx::Rect>& paint_rects,
std::vector<PaintReadyRect>* ready,
std::vector<gfx::Rect>* pending) = 0;
std::vector<PaintReadyRect>& ready,
std::vector<gfx::Rect>& pending) = 0;
// Schedules work to be executed on a main thread after a specific delay.
// The `result` parameter will be passed as the argument to the `callback`.

@ -86,8 +86,8 @@ void PdfViewPluginBase::HandleMessage(const base::Value& message) {
}
void PdfViewPluginBase::OnPaint(const std::vector<gfx::Rect>& paint_rects,
std::vector<PaintReadyRect>* ready,
std::vector<gfx::Rect>* pending) {
std::vector<PaintReadyRect>& ready,
std::vector<gfx::Rect>& pending) {
base::AutoReset<bool> auto_reset_in_paint(&in_paint_, true);
DoPaint(paint_rects, ready, pending);
}
@ -238,8 +238,8 @@ void PdfViewPluginBase::HandleSetTwoUpViewMessage(const base::Value& message) {
}
void PdfViewPluginBase::DoPaint(const std::vector<gfx::Rect>& paint_rects,
std::vector<PaintReadyRect>* ready,
std::vector<gfx::Rect>* pending) {
std::vector<PaintReadyRect>& ready,
std::vector<gfx::Rect>& pending) {
if (image_data_.drawsNothing()) {
DCHECK(plugin_size_.IsEmpty());
return;
@ -269,11 +269,11 @@ void PdfViewPluginBase::DoPaint(const std::vector<gfx::Rect>& paint_rects,
engine()->Paint(pdf_rect, image_data_, pdf_ready, pdf_pending);
for (gfx::Rect& ready_rect : pdf_ready) {
ready_rect.Offset(available_area_.OffsetFromOrigin());
ready->push_back(PaintReadyRect(ready_rect, GetPluginImageData()));
ready.push_back(PaintReadyRect(ready_rect, GetPluginImageData()));
}
for (gfx::Rect& pending_rect : pdf_pending) {
pending_rect.Offset(available_area_.OffsetFromOrigin());
pending->push_back(pending_rect);
pending.push_back(pending_rect);
}
}
@ -284,7 +284,7 @@ void PdfViewPluginBase::DoPaint(const std::vector<gfx::Rect>& paint_rects,
if (rect.y() < first_page_ypos) {
gfx::Rect region = gfx::IntersectRects(
rect, gfx::Rect(gfx::Size(plugin_size_.width(), first_page_ypos)));
ready->push_back(PaintReadyRect(region, GetPluginImageData()));
ready.push_back(PaintReadyRect(region, GetPluginImageData()));
image_data_.erase(background_color_, gfx::RectToSkIRect(region));
}
@ -295,7 +295,7 @@ void PdfViewPluginBase::DoPaint(const std::vector<gfx::Rect>& paint_rects,
if (!intersection.IsEmpty()) {
image_data_.erase(background_part.color,
gfx::RectToSkIRect(intersection));
ready->push_back(PaintReadyRect(intersection, GetPluginImageData()));
ready.push_back(PaintReadyRect(intersection, GetPluginImageData()));
}
}
}
@ -306,7 +306,7 @@ void PdfViewPluginBase::DoPaint(const std::vector<gfx::Rect>& paint_rects,
}
void PdfViewPluginBase::PrepareForFirstPaint(
std::vector<PaintReadyRect>* ready) {
std::vector<PaintReadyRect>& ready) {
if (!first_paint_)
return;
@ -314,7 +314,7 @@ void PdfViewPluginBase::PrepareForFirstPaint(
first_paint_ = false;
image_data_.eraseColor(background_color_);
gfx::Rect rect(gfx::SkISizeToSize(image_data_.dimensions()));
ready->push_back(
ready.push_back(
PaintReadyRect(rect, GetPluginImageData(), /*flush_now=*/true));
}

@ -45,8 +45,8 @@ class PdfViewPluginBase : public PDFEngine::Client,
// PaintManager::Client
void OnPaint(const std::vector<gfx::Rect>& paint_rects,
std::vector<PaintReadyRect>* ready,
std::vector<gfx::Rect>* pending) override;
std::vector<PaintReadyRect>& ready,
std::vector<gfx::Rect>& pending) override;
protected:
struct BackgroundPart {
@ -170,12 +170,12 @@ class PdfViewPluginBase : public PDFEngine::Client,
// Paints the given invalid area of the plugin to the given graphics device.
// PaintManager::Client::OnPaint() should be its only caller.
void DoPaint(const std::vector<gfx::Rect>& paint_rects,
std::vector<PaintReadyRect>* ready,
std::vector<gfx::Rect>* pending);
std::vector<PaintReadyRect>& ready,
std::vector<gfx::Rect>& pending);
// The preparation when painting on the image data buffer for the first
// time.
void PrepareForFirstPaint(std::vector<PaintReadyRect>* ready);
void PrepareForFirstPaint(std::vector<PaintReadyRect>& ready);
// Callback to clear deferred invalidates after painting finishes.
void ClearDeferredInvalidates(int32_t /*unused_but_required*/);