Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(150)

Unified Diff: pdf/pdfium/pdfium_engine.cc

Issue 2418533002: [pdf] Defer page unloading in JS callback. (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pdf/pdfium/pdfium_engine.cc
diff --git a/pdf/pdfium/pdfium_engine.cc b/pdf/pdfium/pdfium_engine.cc
index f3ae32c109488f52f10438a9ddf030c339d2c431..878ee20a7c325e6ac076a520d5db86af9c4b9ba4 100644
--- a/pdf/pdfium/pdfium_engine.cc
+++ b/pdf/pdfium/pdfium_engine.cc
@@ -2287,7 +2287,13 @@ int PDFiumEngine::GetMostVisiblePage() {
if (in_flight_visible_page_)
return *in_flight_visible_page_;
+ // We can call GetMostVisiblePage through a callback from PDFium. We have
+ // to defer the page deletion otherwise we could potentially delete the page
+ // that originated the calling JS request and destroy the objects that are
+ // currently being used.
+ defer_page_unload_ = true;
CalculateVisiblePages();
+ defer_page_unload_ = false;
return most_visible_page_;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698