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

Unified Diff: net/quic/crypto/crypto_framer.cc

Issue 14816006: Land Recent QUIC changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added missing NET_PRIVATE_EXPORT to QuicWallTime Created 7 years, 7 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/quic/crypto/crypto_framer.h ('k') | net/quic/crypto/crypto_framer_test.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/quic/crypto/crypto_framer.cc
diff --git a/net/quic/crypto/crypto_framer.cc b/net/quic/crypto/crypto_framer.cc
index cbc10797488544ebe6852edbfbf140aae202330b..4b3ce64d89eba6c284978480f0679d8349561686 100644
--- a/net/quic/crypto/crypto_framer.cc
+++ b/net/quic/crypto/crypto_framer.cc
@@ -17,7 +17,7 @@ namespace net {
namespace {
-const size_t kCryptoTagSize = sizeof(uint32);
+const size_t kQuicTagSize = sizeof(uint32);
const size_t kCryptoEndOffsetSize = sizeof(uint32);
const size_t kNumEntriesSize = sizeof(uint16);
const size_t kValueLenSize = sizeof(uint16);
@@ -30,18 +30,14 @@ class OneShotVisitor : public CryptoFramerVisitorInterface {
error_(false) {
}
- virtual void OnError(CryptoFramer* framer) OVERRIDE {
- error_ = true;
- }
+ virtual void OnError(CryptoFramer* framer) OVERRIDE { error_ = true; }
virtual void OnHandshakeMessage(
const CryptoHandshakeMessage& message) OVERRIDE {
*out_ = message;
}
- bool error() const {
- return error_;
- }
+ bool error() const { return error_; }
private:
CryptoHandshakeMessage* const out_;
@@ -66,8 +62,7 @@ CryptoHandshakeMessage* CryptoFramer::ParseMessage(StringPiece in) {
CryptoFramer framer;
framer.set_visitor(&visitor);
- if (!framer.ProcessInput(in) ||
- visitor.error() ||
+ if (!framer.ProcessInput(in) || visitor.error() ||
framer.InputBytesRemaining()) {
return NULL;
}
@@ -86,10 +81,10 @@ bool CryptoFramer::ProcessInput(StringPiece input) {
switch (state_) {
case STATE_READING_TAG:
- if (reader.BytesRemaining() < kCryptoTagSize) {
+ if (reader.BytesRemaining() < kQuicTagSize) {
break;
}
- CryptoTag message_tag;
+ QuicTag message_tag;
reader.ReadUInt32(&message_tag);
message_.set_tag(message_tag);
state_ = STATE_READING_NUM_ENTRIES;
@@ -109,14 +104,14 @@ bool CryptoFramer::ProcessInput(StringPiece input) {
state_ = STATE_READING_TAGS_AND_LENGTHS;
values_len_ = 0;
case STATE_READING_TAGS_AND_LENGTHS: {
- if (reader.BytesRemaining() < num_entries_ * (kCryptoTagSize +
- kCryptoEndOffsetSize)) {
+ if (reader.BytesRemaining() <
+ num_entries_ * (kQuicTagSize + kCryptoEndOffsetSize)) {
break;
}
uint32 last_end_offset = 0;
for (unsigned i = 0; i < num_entries_; ++i) {
- CryptoTag tag;
+ QuicTag tag;
reader.ReadUInt32(&tag);
if (i > 0 && tag <= tags_and_lengths_[i-1].first) {
if (tag == tags_and_lengths_[i-1].first) {
@@ -145,7 +140,7 @@ bool CryptoFramer::ProcessInput(StringPiece input) {
if (reader.BytesRemaining() < values_len_) {
break;
}
- for (vector<pair<CryptoTag, size_t> >::const_iterator
+ for (vector<pair<QuicTag, size_t> >::const_iterator
it = tags_and_lengths_.begin(); it != tags_and_lengths_.end();
it++) {
StringPiece value;
@@ -168,14 +163,14 @@ QuicData* CryptoFramer::ConstructHandshakeMessage(
if (message.tag_value_map().size() > kMaxEntries) {
return NULL;
}
- size_t len = kCryptoTagSize; // message tag
- len += sizeof(uint16); // number of map entries
- len += sizeof(uint16); // padding.
- CryptoTagValueMap::const_iterator it = message.tag_value_map().begin();
+ size_t len = kQuicTagSize; // message tag
+ len += sizeof(uint16); // number of map entries
+ len += sizeof(uint16); // padding.
+ QuicTagValueMap::const_iterator it = message.tag_value_map().begin();
while (it != message.tag_value_map().end()) {
- len += kCryptoTagSize; // tag
+ len += kQuicTagSize; // tag
len += kCryptoEndOffsetSize; // end offset
- len += it->second.length(); // value
+ len += it->second.length(); // value
++it;
}
« no previous file with comments | « net/quic/crypto/crypto_framer.h ('k') | net/quic/crypto/crypto_framer_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698