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(); |
} |