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

Unified Diff: testing/embedder_test.cpp

Issue 2322523002: Cleanup page when unloading in embedder tests (Closed)
Patch Set: Created 4 years, 3 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 | « testing/embedder_test.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: testing/embedder_test.cpp
diff --git a/testing/embedder_test.cpp b/testing/embedder_test.cpp
index e10e2a81e8d57dc7effbcc02cbdc5bacbf1ac650..1ce0f36a45615bd87d1ec03192dac29b3ddcf1fa 100644
--- a/testing/embedder_test.cpp
+++ b/testing/embedder_test.cpp
@@ -255,6 +255,7 @@ FPDF_PAGE EmbedderTest::LoadPage(int page_number) {
FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_OPEN);
// Cache the page.
page_map_[page_number] = page;
+ page_reverse_map_[page] = page_number;
return page;
}
@@ -274,6 +275,13 @@ void EmbedderTest::UnloadPage(FPDF_PAGE page) {
FORM_DoPageAAction(page, form_handle_, FPDFPAGE_AACTION_CLOSE);
FORM_OnBeforeClosePage(page, form_handle_);
FPDF_ClosePage(page);
+
+ auto it = page_reverse_map_.find(page);
+ if (it == page_reverse_map_.end())
+ return;
+
+ page_map_.erase(it->second);
+ page_reverse_map_.erase(it);
}
FPDF_PAGE EmbedderTest::Delegate::GetPage(FPDF_FORMFILLINFO* info,
« no previous file with comments | « testing/embedder_test.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698