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

Unified Diff: net/spdy/spdy_frame_reader.cc

Issue 12256004: Remove SpdySynReplyControlFrame and SpdyGoAwayControlFrame. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 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/spdy/spdy_frame_reader.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_frame_reader.cc
diff --git a/net/spdy/spdy_frame_reader.cc b/net/spdy/spdy_frame_reader.cc
index 57bf9ebb4682a5b62ee56ee65b100352c3431b64..3765c69420e5262adbdc7f717c096dfb41bfabc3 100644
--- a/net/spdy/spdy_frame_reader.cc
+++ b/net/spdy/spdy_frame_reader.cc
@@ -6,6 +6,7 @@
#include "base/sys_byteorder.h"
#include "net/spdy/spdy_frame_reader.h"
+#include "net/spdy/spdy_protocol.h"
namespace net {
@@ -15,6 +16,22 @@ SpdyFrameReader::SpdyFrameReader(const char* data, const size_t len)
ofs_(0) {
}
+bool SpdyFrameReader::ReadUInt8(uint8* result) {
+ // Make sure that we have the whole uint8.
+ if (!CanRead(1)) {
+ OnFailure();
+ return false;
+ }
+
+ // Read into result.
+ *result = *reinterpret_cast<const uint8*>(data_ + ofs_);
+
+ // Iterate.
+ ofs_ += 1;
+
+ return true;
+}
+
bool SpdyFrameReader::ReadUInt16(uint16* result) {
// Make sure that we have the whole uint16.
if (!CanRead(2)) {
@@ -47,6 +64,17 @@ bool SpdyFrameReader::ReadUInt32(uint32* result) {
return true;
}
+bool SpdyFrameReader::ReadUInt31(uint32* result) {
+ bool success = ReadUInt32(result);
+
+ // Zero out highest-order bit.
+ if (success) {
+ *result &= kStreamIdMask;
+ }
+
+ return success;
+}
+
bool SpdyFrameReader::ReadStringPiece16(base::StringPiece* result) {
// Read resultant length.
uint16 result_len;
@@ -109,6 +137,18 @@ bool SpdyFrameReader::ReadBytes(void* result, size_t size) {
return true;
}
+bool SpdyFrameReader::Seek(size_t size) {
+ if (!CanRead(size)) {
+ OnFailure();
+ return false;
+ }
+
+ // Iterate.
+ ofs_ += size;
+
+ return true;
+}
+
bool SpdyFrameReader::IsDoneReading() const {
return len_ == ofs_;
}
« no previous file with comments | « net/spdy/spdy_frame_reader.h ('k') | net/spdy/spdy_framer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698