[pdf] Call pp::PDF::Print() synchronously
Call pp::PDF::Print() synchronously in the Pepper viewer, instead of posting a task to the main thread. The old implementation was an artifact of the days when the PDF plugin was in-process and re-entrancy was a risk. But now that the plugin is out-of-process, pp::PDF::Print() already invokes the print dialog asynchronously across the process boundary to the renderer. Change-Id: Iabc0dcfc561492353cb666ad6569059e52d87ed6 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2964274 Commit-Queue: Daniel Hosseinian <dhoss@chromium.org> Reviewed-by: Lei Zhang <thestig@chromium.org> Cr-Commit-Position: refs/heads/master@{#894043}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
8690530ca5
commit
d824ce06dc
@@ -1252,10 +1252,7 @@ void OutOfProcessInstance::OnPrintPreviewLoaded() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessInstance::InvokePrintDialog() {
|
void OutOfProcessInstance::InvokePrintDialog() {
|
||||||
ScheduleTaskOnMainThread(FROM_HERE,
|
pp::PDF::Print(this);
|
||||||
base::BindOnce(&OutOfProcessInstance::OnPrint,
|
|
||||||
weak_factory_.GetWeakPtr()),
|
|
||||||
/*result=*/0, base::TimeDelta());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessInstance::SetContentRestrictions(int content_restrictions) {
|
void OutOfProcessInstance::SetContentRestrictions(int content_restrictions) {
|
||||||
@@ -1281,8 +1278,4 @@ void OutOfProcessInstance::UserMetricsRecordAction(const std::string& action) {
|
|||||||
pp::PDF::UserMetricsRecordAction(this, pp::Var(action));
|
pp::PDF::UserMetricsRecordAction(this, pp::Var(action));
|
||||||
}
|
}
|
||||||
|
|
||||||
void OutOfProcessInstance::OnPrint(int32_t /*unused_but_required*/) {
|
|
||||||
pp::PDF::Print(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace chrome_pdf
|
} // namespace chrome_pdf
|
||||||
|
@@ -188,9 +188,6 @@ class OutOfProcessInstance : public PdfViewPluginBase,
|
|||||||
// Called after a preview page has loaded or failed to load.
|
// Called after a preview page has loaded or failed to load.
|
||||||
void LoadNextPreviewPage();
|
void LoadNextPreviewPage();
|
||||||
|
|
||||||
// Callback to print without re-entrancy issues.
|
|
||||||
void OnPrint(int32_t /*unused_but_required*/);
|
|
||||||
|
|
||||||
// The Pepper image data that is in sync with mutable_image_data().
|
// The Pepper image data that is in sync with mutable_image_data().
|
||||||
pp::ImageData pepper_image_data_;
|
pp::ImageData pepper_image_data_;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user