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

Unified Diff: core/fpdfdoc/cpdf_annot.cpp

Issue 2526543003: Use more unique_ptrs in CPDF_SyntaxParser and CPDF_Annot (Closed)
Patch Set: Created 4 years, 1 month 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 | « core/fpdfapi/parser/cpdf_syntax_parser.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_annot.cpp
diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp
index a7d2101364cb23144729345b4b76a7367dfdee2e..70c6b8d3c452704872a59d2aa912a863b593feac 100644
--- a/core/fpdfdoc/cpdf_annot.cpp
+++ b/core/fpdfdoc/cpdf_annot.cpp
@@ -6,6 +6,8 @@
#include "core/fpdfdoc/cpdf_annot.h"
+#include <utility>
+
#include "core/fpdfapi/page/cpdf_form.h"
#include "core/fpdfapi/page/cpdf_page.h"
#include "core/fpdfapi/parser/cpdf_array.h"
@@ -205,11 +207,13 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {
if (it != m_APMap.end())
return it->second.get();
- CPDF_Form* pNewForm =
- new CPDF_Form(m_pDocument, pPage->m_pResources, pStream);
+ auto pNewForm =
+ pdfium::MakeUnique<CPDF_Form>(m_pDocument, pPage->m_pResources, pStream);
pNewForm->ParseContent(nullptr, nullptr, nullptr);
- m_APMap[pStream] = pdfium::WrapUnique(pNewForm);
- return pNewForm;
+
+ CPDF_Form* pResult = pNewForm.get();
+ m_APMap[pStream] = std::move(pNewForm);
+ return pResult;
}
// Static.
« no previous file with comments | « core/fpdfapi/parser/cpdf_syntax_parser.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698