Pump V8 foreground tasks queued to platform message loop.
Make pdfium_test behave more similarly to what the chromium
embedder is actually doing. Note if any work happens on stderr
(so as not to cause diffs in text-based tests writing to stdout).
Change-Id: I6381401f73b24bcf82a0e25606807254428d9b02
Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/70392
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
diff --git a/samples/pdfium_test.cc b/samples/pdfium_test.cc
index d983526..45500dc 100644
--- a/samples/pdfium_test.cc
+++ b/samples/pdfium_test.cc
@@ -1214,6 +1214,17 @@
}
RenderPdf(filename, file_contents.get(), file_length, options, events);
+#ifdef PDF_ENABLE_V8
+ if (!options.disable_javascript) {
+ int task_count = 0;
+ while (v8::platform::PumpMessageLoop(platform.get(), isolate.get()))
+ ++task_count;
+
+ if (task_count)
+ fprintf(stderr, "Pumped %d tasks\n", task_count);
+ }
+#endif // PDF_ENABLE_V8
+
#ifdef ENABLE_CALLGRIND
if (options.callgrind_delimiters)
CALLGRIND_STOP_INSTRUMENTATION;