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

Unified Diff: Source/core/html/forms/FormController.cpp

Issue 102103002: Have HashMap<KeyType, AtomicString>::get() return a const reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Use AtomicString::ConstructFromLiteral Created 7 years 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 | « Source/core/html/HTMLElement.cpp ('k') | Source/core/html/parser/XSSAuditor.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/html/forms/FormController.cpp
diff --git a/Source/core/html/forms/FormController.cpp b/Source/core/html/forms/FormController.cpp
index 43b6faba9c5bf9b4e848c4243ad2b46282f4488a..a3cd9b02100adaf59888746bc9f6ae9155ff087d 100644
--- a/Source/core/html/forms/FormController.cpp
+++ b/Source/core/html/forms/FormController.cpp
@@ -294,7 +294,7 @@ class FormKeyGenerator {
public:
static PassOwnPtr<FormKeyGenerator> create() { return adoptPtr(new FormKeyGenerator); }
- AtomicString formKey(const HTMLFormControlElementWithState&);
+ const AtomicString& formKey(const HTMLFormControlElementWithState&);
void willDeleteForm(HTMLFormElement*);
private:
@@ -342,11 +342,11 @@ static inline String formSignature(const HTMLFormElement& form)
return builder.toString();
}
-AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control)
+const AtomicString& FormKeyGenerator::formKey(const HTMLFormControlElementWithState& control)
{
HTMLFormElement* form = ownerFormForState(control);
if (!form) {
- DEFINE_STATIC_LOCAL(AtomicString, formKeyForNoOwner, ("No owner", AtomicString::ConstructFromLiteral));
+ DEFINE_STATIC_LOCAL(const AtomicString, formKeyForNoOwner, ("No owner", AtomicString::ConstructFromLiteral));
return formKeyForNoOwner;
}
FormToKeyMap::const_iterator it = m_formToKeyMap.find(form);
@@ -358,13 +358,12 @@ AtomicString FormKeyGenerator::formKey(const HTMLFormControlElementWithState& co
FormSignatureToNextIndexMap::AddResult result = m_formSignatureToNextIndexMap.add(signature, 0);
unsigned nextIndex = result.iterator->value++;
- StringBuilder builder;
- builder.append(signature);
- builder.appendLiteral(" #");
- builder.appendNumber(nextIndex);
- AtomicString formKey = builder.toAtomicString();
- m_formToKeyMap.add(form, formKey);
- return formKey;
+ StringBuilder formKeyBuilder;
+ formKeyBuilder.append(signature);
+ formKeyBuilder.appendLiteral(" #");
+ formKeyBuilder.appendNumber(nextIndex);
+ FormToKeyMap::AddResult addFormKeyresult = m_formToKeyMap.add(form, formKeyBuilder.toAtomicString());
+ return addFormKeyresult.iterator->value;
}
void FormKeyGenerator::willDeleteForm(HTMLFormElement* form)
« no previous file with comments | « Source/core/html/HTMLElement.cpp ('k') | Source/core/html/parser/XSSAuditor.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698