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

Unified Diff: net/spdy/spdy_framer.cc

Issue 2544343003: Use wire values in SpdySettingsIds. (Closed)
Patch Set: Created 4 years 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/quic/core/quic_headers_stream_test.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_framer.cc
diff --git a/net/spdy/spdy_framer.cc b/net/spdy/spdy_framer.cc
index 975b453beb4665bad0a5dd3bb08e1753b7135943..6bbadf470579f631ae759f965fb4a08d05da9a5a 100644
--- a/net/spdy/spdy_framer.cc
+++ b/net/spdy/spdy_framer.cc
@@ -1351,26 +1351,22 @@ size_t SpdyFramer::ProcessSettingsFramePayload(const char* data,
}
bool SpdyFramer::ProcessSetting(const char* data) {
- int id_field;
- SpdySettingsIds id;
- uint8_t flags = 0;
- uint32_t value;
-
// Extract fields.
// Maintain behavior of old SPDY 2 bug with byte ordering of flags/id.
- id_field = base::NetToHost16(*(reinterpret_cast<const uint16_t*>(data)));
- value = base::NetToHost32(*(reinterpret_cast<const uint32_t*>(data + 2)));
+ int id_field = base::NetToHost16(*(reinterpret_cast<const uint16_t*>(data)));
+ int32_t value =
+ base::NetToHost32(*(reinterpret_cast<const uint32_t*>(data + 2)));
// Validate id.
- if (!SpdyConstants::IsValidSettingId(id_field)) {
+ SpdySettingsIds setting_id;
+ if (!SpdyConstants::ParseSettingsId(id_field, &setting_id)) {
DLOG(WARNING) << "Unknown SETTINGS ID: " << id_field;
// Ignore unknown settings for extensibility.
return true;
}
- id = SpdyConstants::ParseSettingId(id_field);
// Validation succeeded. Pass on to visitor.
- visitor_->OnSetting(id, flags, value);
+ visitor_->OnSetting(setting_id, /*flags=*/0, value);
return true;
}
@@ -1918,9 +1914,8 @@ SpdySerializedFrame SpdyFramer::SerializeSettings(
DCHECK_EQ(GetSettingsMinimumSize(), builder.length());
for (SpdySettingsIR::ValueMap::const_iterator it = values->begin();
- it != values->end();
- ++it) {
- int setting_id = SpdyConstants::SerializeSettingId(it->first);
+ it != values->end(); ++it) {
+ int setting_id = it->first;
DCHECK_GE(setting_id, 0);
builder.WriteUInt16(static_cast<uint16_t>(setting_id));
builder.WriteUInt32(it->second.value);
« no previous file with comments | « net/quic/core/quic_headers_stream_test.cc ('k') | net/spdy/spdy_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698