[pdf] Reset defer_page_unload to original value.
In the PdfiumEngine::GetMostVisiblePage() we force the system to defer page unloading because it can be called during a callback. That callback can be triggered from a ::HandleEvent() call. Currently we will always reset the defer_page_unload_ to false in ::GetMostVisiblePage(). This Cl updates the code to reset defer_page_unload_ to the value it contained prior to the call to ::GetMostVisiblePage(). Review-Url: https://codereview.chromium.org/2554563002 Cr-Commit-Position: refs/heads/master@{#436590}
This commit is contained in:
@ -12,6 +12,7 @@
|
||||
#include <memory>
|
||||
#include <set>
|
||||
|
||||
#include "base/auto_reset.h"
|
||||
#include "base/i18n/encoding_detection.h"
|
||||
#include "base/i18n/icu_string_conversions.h"
|
||||
#include "base/lazy_instance.h"
|
||||
@ -2470,9 +2471,8 @@ int PDFiumEngine::GetMostVisiblePage() {
|
||||
// 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;
|
||||
base::AutoReset<bool> defer_page_unload_guard(&defer_page_unload_, true);
|
||||
CalculateVisiblePages();
|
||||
defer_page_unload_ = false;
|
||||
return most_visible_page_;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user