summaryrefslogtreecommitdiffstats
path: root/pdf
diff options
context:
space:
mode:
authorki.stfu <ki.stfu@gmail.com>2015-09-21 15:20:04 -0700
committerCommit bot <commit-bot@chromium.org>2015-09-21 22:21:47 +0000
commit9f9f5da774a8449eb00fe49e4b97916f3d3ed07d (patch)
treef8aca32f4374f98f2bb74bfbe7af54d668f138a6 /pdf
parent277108add19203ab9ab14c9043006fbe05ca61b7 (diff)
downloadchromium_src-9f9f5da774a8449eb00fe49e4b97916f3d3ed07d.zip
chromium_src-9f9f5da774a8449eb00fe49e4b97916f3d3ed07d.tar.gz
chromium_src-9f9f5da774a8449eb00fe49e4b97916f3d3ed07d.tar.bz2
Cleanup: Pass std::string as const reference from pdf/
Passing std::string by reference can prevent extra copying of object. BUG=367418 TEST= R=jam@chromium.org,jochen@chromium.org Review URL: https://codereview.chromium.org/1345393005 Cr-Commit-Position: refs/heads/master@{#350044}
Diffstat (limited to 'pdf')
-rw-r--r--pdf/pdfium/pdfium_page.cc5
-rw-r--r--pdf/pdfium/pdfium_page.h4
2 files changed, 5 insertions, 4 deletions
diff --git a/pdf/pdfium/pdfium_page.cc b/pdf/pdfium/pdfium_page.cc
index 93e7645..fe1a07e 100644
--- a/pdf/pdfium/pdfium_page.cc
+++ b/pdf/pdfium/pdfium_page.cc
@@ -240,14 +240,15 @@ base::Value* PDFiumPage::GetTextBoxAsValue(double page_height,
return node;
}
-base::Value* PDFiumPage::CreateTextNode(std::string text) {
+base::Value* PDFiumPage::CreateTextNode(const std::string& text) {
base::DictionaryValue* node = new base::DictionaryValue();
node->SetString(kTextNodeType, kTextNodeTypeText);
node->SetString(kTextNodeText, text);
return node;
}
-base::Value* PDFiumPage::CreateURLNode(std::string text, std::string url) {
+base::Value* PDFiumPage::CreateURLNode(const std::string& text,
+ const std::string& url) {
base::DictionaryValue* node = new base::DictionaryValue();
node->SetString(kTextNodeType, kTextNodeTypeURL);
node->SetString(kTextNodeText, text);
diff --git a/pdf/pdfium/pdfium_page.h b/pdf/pdfium/pdfium_page.h
index 3cca04c..eee57e0 100644
--- a/pdf/pdfium/pdfium_page.h
+++ b/pdf/pdfium/pdfium_page.h
@@ -109,8 +109,8 @@ class PDFiumPage {
base::Value* GetTextBoxAsValue(double page_height, double left, double top,
double right, double bottom, int rotation);
// Helper functions for JSON generation
- base::Value* CreateTextNode(std::string text);
- base::Value* CreateURLNode(std::string text, std::string url);
+ base::Value* CreateTextNode(const std::string& text);
+ base::Value* CreateURLNode(const std::string& text, const std::string& url);
class ScopedLoadCounter {
public: