Commit bdc0b81d authored by Lei Zhang's avatar Lei Zhang Committed by Commit Bot

Remove some unneeded checks in PrintManager subclasses.

AwPrintManager and PrintViewManagerBasic are the only subclasses of
PrintManager that use |pdf_writing_done_callback_|. The two classes do
not interact with one another, and no other code changes
|pdf_writing_done_callback_|. Given this, since both classes initializes
|pdf_writing_done_callback_|, there is no need to check if the callback
is null.

Change-Id: I73c8a309e3cb7fde0286950e0ef2be2211881373
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1885108
Commit-Queue: Lei Zhang <thestig@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710494}
parent 83be6f0f
......@@ -57,14 +57,14 @@ AwPrintManager::AwPrintManager(
fd_(file_descriptor) {
DCHECK(settings_);
pdf_writing_done_callback_ = std::move(callback);
DCHECK(pdf_writing_done_callback_);
cookie_ = 1; // Set a valid dummy cookie value.
}
AwPrintManager::~AwPrintManager() = default;
void AwPrintManager::PdfWritingDone(int page_count) {
if (pdf_writing_done_callback_)
pdf_writing_done_callback_.Run(page_count);
pdf_writing_done_callback_.Run(page_count);
// Invalidate the file descriptor so it doesn't get reused.
fd_ = -1;
}
......
......@@ -32,8 +32,7 @@ PrintViewManagerBasic::~PrintViewManagerBasic() {
#if defined(OS_ANDROID)
void PrintViewManagerBasic::PdfWritingDone(int page_count) {
if (pdf_writing_done_callback_)
pdf_writing_done_callback_.Run(page_count);
pdf_writing_done_callback_.Run(page_count);
}
#endif
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment