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

Unified Diff: net/websockets/websocket_extension.cc

Issue 1324113002: Introduce WebSocketDeflateParameters. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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 | « net/websockets/websocket_deflate_stream_test.cc ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/websockets/websocket_extension.cc
diff --git a/net/websockets/websocket_extension.cc b/net/websockets/websocket_extension.cc
index edcd8e8657fbbcaa09ffc2234b305e44ec6b13d6..bf7a54bdbf3e17b79f4da23476525ea19d11a39e 100644
--- a/net/websockets/websocket_extension.cc
+++ b/net/websockets/websocket_extension.cc
@@ -4,6 +4,7 @@
#include "net/websockets/websocket_extension.h"
+#include <map>
#include <string>
#include "base/logging.h"
@@ -33,11 +34,15 @@ WebSocketExtension::~WebSocketExtension() {}
bool WebSocketExtension::Equals(const WebSocketExtension& other) const {
if (name_ != other.name_) return false;
if (parameters_.size() != other.parameters_.size()) return false;
- for (size_t i = 0; i < other.parameters_.size(); ++i) {
- if (!parameters_[i].Equals(other.parameters_[i]))
- return false;
+
+ std::multimap<std::string, std::string> this_parameters, other_parameters;
+ for (const auto& p : parameters_) {
+ this_parameters.insert(std::make_pair(p.name(), p.value()));
+ }
+ for (const auto& p : other.parameters_) {
+ other_parameters.insert(std::make_pair(p.name(), p.value()));
}
- return true;
+ return this_parameters == other_parameters;
}
} // namespace net
« no previous file with comments | « net/websockets/websocket_deflate_stream_test.cc ('k') | net/websockets/websocket_stream_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698