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

Unified Diff: Source/core/page/EventSource.cpp

Issue 112653006: Make calls to AtomicString(const String&) explicit in page/ (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Take feedback into consideration Created 6 years, 12 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
« no previous file with comments | « Source/core/page/EventSource.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/page/EventSource.cpp
diff --git a/Source/core/page/EventSource.cpp b/Source/core/page/EventSource.cpp
index fcb5e1c7bbff88d5404145c76f7c10ec86a5ec4a..42f8ab660f9eb6b602d528612510d8665417e391 100644
--- a/Source/core/page/EventSource.cpp
+++ b/Source/core/page/EventSource.cpp
@@ -281,8 +281,8 @@ void EventSource::didFinishLoading(unsigned long, double)
// Discard everything that has not been dispatched by now.
m_receiveBuf.clear();
m_data.clear();
- m_eventName = "";
- m_currentlyParsedEventId = String();
+ m_eventName = emptyAtom;
+ m_currentlyParsedEventId = nullAtom;
}
networkRequestEnded();
}
@@ -376,13 +376,13 @@ void EventSource::parseEventStreamLine(unsigned bufPos, int fieldLength, int lin
if (!m_data.isEmpty()) {
m_data.removeLast();
if (!m_currentlyParsedEventId.isNull()) {
- m_lastEventId.swap(m_currentlyParsedEventId);
- m_currentlyParsedEventId = String();
+ m_lastEventId = m_currentlyParsedEventId;
+ m_currentlyParsedEventId = nullAtom;
}
dispatchEvent(createMessageEvent());
}
if (!m_eventName.isEmpty())
- m_eventName = "";
+ m_eventName = emptyAtom;
} else if (fieldLength) {
bool noValue = fieldLength < 0;
@@ -401,11 +401,11 @@ void EventSource::parseEventStreamLine(unsigned bufPos, int fieldLength, int lin
if (valueLength)
m_data.append(&m_receiveBuf[bufPos], valueLength);
m_data.append('\n');
- } else if (field == "event")
- m_eventName = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : "";
- else if (field == "id")
- m_currentlyParsedEventId = valueLength ? String(&m_receiveBuf[bufPos], valueLength) : "";
- else if (field == "retry") {
+ } else if (field == "event") {
+ m_eventName = valueLength ? AtomicString(&m_receiveBuf[bufPos], valueLength) : "";
+ } else if (field == "id") {
+ m_currentlyParsedEventId = valueLength ? AtomicString(&m_receiveBuf[bufPos], valueLength) : "";
+ } else if (field == "retry") {
if (!valueLength)
m_reconnectDelay = defaultReconnectDelay;
else {
@@ -427,7 +427,7 @@ void EventSource::stop()
PassRefPtr<MessageEvent> EventSource::createMessageEvent()
{
RefPtr<MessageEvent> event = MessageEvent::create();
- event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : AtomicString(m_eventName), false, false, SerializedScriptValue::create(String(m_data)), m_eventStreamOrigin, m_lastEventId, 0, nullptr);
+ event->initMessageEvent(m_eventName.isEmpty() ? EventTypeNames::message : m_eventName, false, false, SerializedScriptValue::create(String(m_data)), m_eventStreamOrigin, m_lastEventId, 0, nullptr);
m_data.clear();
return event.release();
}
« no previous file with comments | « Source/core/page/EventSource.h ('k') | Source/core/page/Page.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698