Index: third_party/WebKit/Source/modules/fetch/Headers.cpp |
diff --git a/third_party/WebKit/Source/modules/fetch/Headers.cpp b/third_party/WebKit/Source/modules/fetch/Headers.cpp |
index 0b2b43392e82096c0f1a494c59ff116825db99d5..1670508e31b086249c01f97a86f5e51c9f6837df 100644 |
--- a/third_party/WebKit/Source/modules/fetch/Headers.cpp |
+++ b/third_party/WebKit/Source/modules/fetch/Headers.cpp |
@@ -9,9 +9,6 @@ |
#include "bindings/core/v8/V8IteratorResultValue.h" |
#include "core/dom/Iterator.h" |
#include "platform/loader/fetch/FetchUtils.h" |
-#include "wtf/NotFound.h" |
-#include "wtf/PassRefPtr.h" |
-#include "wtf/RefPtr.h" |
#include "wtf/text/WTFString.h" |
namespace blink { |
@@ -22,9 +19,7 @@ class HeadersIterationSource final |
: public PairIterable<String, String>::IterationSource { |
public: |
explicit HeadersIterationSource(const FetchHeaderList* headers) |
- : m_headers(headers->clone()), m_current(0) { |
- m_headers->sortAndCombine(); |
- } |
+ : m_headers(headers->sortAndCombine()), m_current(0) {} |
bool next(ScriptState* scriptState, |
String& key, |
@@ -33,22 +28,21 @@ class HeadersIterationSource final |
// This simply advances an index and returns the next value if any; the |
// iterated list is not exposed to script so it will never be mutated |
// during iteration. |
- if (m_current >= m_headers->size()) |
+ if (m_current >= m_headers.size()) |
return false; |
- const FetchHeaderList::Header& header = m_headers->entry(m_current++); |
+ const FetchHeaderList::Header& header = m_headers.at(m_current++); |
key = header.first; |
value = header.second; |
return true; |
} |
DEFINE_INLINE_VIRTUAL_TRACE() { |
- visitor->trace(m_headers); |
PairIterable<String, String>::IterationSource::trace(visitor); |
} |
private: |
- const Member<FetchHeaderList> m_headers; |
+ Vector<std::pair<String, String>> m_headers; |
size_t m_current; |
}; |
@@ -257,9 +251,8 @@ void Headers::fillWith(const Headers* object, ExceptionState& exceptionState) { |
// |headerListCopy| and then for each |header| in |headerListCopy|, |
// retaining order, append header's |name|/|header|'s value to |
// |headers|. Rethrow any exception." |
- for (size_t i = 0; i < object->m_headerList->list().size(); ++i) { |
- append(object->m_headerList->list()[i]->first, |
- object->m_headerList->list()[i]->second, exceptionState); |
+ for (const auto& header : object->m_headerList->list()) { |
+ append(header.first, header.second, exceptionState); |
if (exceptionState.hadException()) |
return; |
} |