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

Unified Diff: pdf/pdfium/pdfium_page.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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
Index: pdf/pdfium/pdfium_page.cc
diff --git a/pdf/pdfium/pdfium_page.cc b/pdf/pdfium/pdfium_page.cc
index c7e53393331ec021073af5f2afc69a08e4354f59..7a17e7fc359c7dc76fe8f97664b0c4d7c375fde8 100644
--- a/pdf/pdfium/pdfium_page.cc
+++ b/pdf/pdfium/pdfium_page.cc
@@ -9,6 +9,7 @@
#include <algorithm>
#include <memory>
+#include <utility>
#include "base/logging.h"
#include "base/strings/string_number_conversions.h"
@@ -308,14 +309,16 @@ base::Value* PDFiumPage::GetAccessibleContentAsValue(int rotation) {
line.push_back('-');
}
- base::DictionaryValue* text_node = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> text_node(
+ new base::DictionaryValue());
text_node->SetString(kTextNodeType, kTextNodeTypeText);
text_node->SetString(kTextNodeText, line);
base::ListValue* text_nodes = new base::ListValue();
- text_nodes->Append(text_node);
+ text_nodes->Append(std::move(text_node));
- base::DictionaryValue* line_node = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> line_node(
+ new base::DictionaryValue());
line_node->SetDouble(kTextBoxLeft, line_rect.x());
line_node->SetDouble(kTextBoxTop, line_rect.y());
line_node->SetDouble(kTextBoxWidth, line_rect.width());
@@ -323,7 +326,7 @@ base::Value* PDFiumPage::GetAccessibleContentAsValue(int rotation) {
line_node->SetDouble(kTextBoxFontSize,
FPDFText_GetFontSize(text_page, i));
line_node->Set(kTextBoxNodes, text_nodes);
- text->Append(line_node);
+ text->Append(std::move(line_node));
line.clear();
line_rect = pp::Rect();
« no previous file with comments | « net/quic/quic_connection_logger.cc ('k') | tools/json_schema_compiler/test/additional_properties_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698