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 09b928f27b13ae7acc106fe11c37bd3b5e1052f6..7956ea65f1d4a3fc0b205fd722dc2278c9cefb9e 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) |
- : headers_(headers->Clone()), current_(0) { |
- headers_->SortAndCombine(); |
- } |
+ : headers_(headers->SortAndCombine()), current_(0) {} |
bool Next(ScriptState* script_state, |
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 (current_ >= headers_->size()) |
+ if (current_ >= headers_.size()) |
return false; |
- const FetchHeaderList::Header& header = headers_->Entry(current_++); |
+ const FetchHeaderList::Header& header = headers_.at(current_++); |
key = header.first; |
value = header.second; |
return true; |
} |
DEFINE_INLINE_VIRTUAL_TRACE() { |
- visitor->Trace(headers_); |
PairIterable<String, String>::IterationSource::Trace(visitor); |
} |
private: |
- const Member<FetchHeaderList> headers_; |
+ Vector<std::pair<String, String>> headers_; |
size_t current_; |
}; |
@@ -257,9 +251,8 @@ void Headers::FillWith(const Headers* object, ExceptionState& exception_state) { |
// |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->header_list_->List().size(); ++i) { |
- append(object->header_list_->List()[i]->first, |
- object->header_list_->List()[i]->second, exception_state); |
+ for (const auto& header : object->header_list_->List()) { |
+ append(header.first, header.second, exception_state); |
if (exception_state.HadException()) |
return; |
} |