0

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}
This commit is contained in:
ki.stfu
2015-09-21 15:20:04 -07:00
committed by Commit bot
parent 277108add1
commit 9f9f5da774
2 changed files with 5 additions and 4 deletions

@ -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);

@ -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: