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

Side by Side Diff: third_party/WebKit/Source/modules/eventsource/EventSourceParser.cpp

Issue 2614663008: Migrate WTF::Vector::append() to ::push_back() [part 13 of N] (Closed)
Patch Set: Created 3 years, 11 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "modules/eventsource/EventSourceParser.h" 5 #include "modules/eventsource/EventSourceParser.h"
6 6
7 #include "core/EventTypeNames.h" 7 #include "core/EventTypeNames.h"
8 #include "modules/eventsource/EventSource.h" 8 #include "modules/eventsource/EventSource.h"
9 #include "wtf/ASCIICType.h" 9 #include "wtf/ASCIICType.h"
10 #include "wtf/Assertions.h" 10 #include "wtf/Assertions.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 91 }
92 size_t fieldValueSize = m_line.size() - fieldValueStart; 92 size_t fieldValueSize = m_line.size() - fieldValueStart;
93 String fieldName = fromUTF8(m_line.data(), fieldNameEnd); 93 String fieldName = fromUTF8(m_line.data(), fieldNameEnd);
94 if (fieldName == "event") { 94 if (fieldName == "event") {
95 m_eventType = 95 m_eventType =
96 AtomicString(fromUTF8(m_line.data() + fieldValueStart, fieldValueSize)); 96 AtomicString(fromUTF8(m_line.data() + fieldValueStart, fieldValueSize));
97 return; 97 return;
98 } 98 }
99 if (fieldName == "data") { 99 if (fieldName == "data") {
100 m_data.append(m_line.data() + fieldValueStart, fieldValueSize); 100 m_data.append(m_line.data() + fieldValueStart, fieldValueSize);
101 m_data.append('\n'); 101 m_data.push_back('\n');
102 return; 102 return;
103 } 103 }
104 if (fieldName == "id") { 104 if (fieldName == "id") {
105 m_id = 105 m_id =
106 AtomicString(fromUTF8(m_line.data() + fieldValueStart, fieldValueSize)); 106 AtomicString(fromUTF8(m_line.data() + fieldValueStart, fieldValueSize));
107 return; 107 return;
108 } 108 }
109 if (fieldName == "retry") { 109 if (fieldName == "retry") {
110 bool hasOnlyDigits = true; 110 bool hasOnlyDigits = true;
111 for (size_t i = fieldValueStart; i < m_line.size() && hasOnlyDigits; ++i) 111 for (size_t i = fieldValueStart; i < m_line.size() && hasOnlyDigits; ++i)
(...skipping 15 matching lines...) Expand all
127 127
128 String EventSourceParser::fromUTF8(const char* bytes, size_t size) { 128 String EventSourceParser::fromUTF8(const char* bytes, size_t size) {
129 return m_codec->decode(bytes, size, WTF::DataEOF); 129 return m_codec->decode(bytes, size, WTF::DataEOF);
130 } 130 }
131 131
132 DEFINE_TRACE(EventSourceParser) { 132 DEFINE_TRACE(EventSourceParser) {
133 visitor->trace(m_client); 133 visitor->trace(m_client);
134 } 134 }
135 135
136 } // namespace blink 136 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698