summaryrefslogtreecommitdiffstats
path: root/net/flip/flip_framer.h
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 20:10:37 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-11-06 20:10:37 +0000
commitad80d5e5bc4b8924778b8418058761ef0ad19aa4 (patch)
tree44cb9166e556d835e2fd6ae62565ffb4e47429c8 /net/flip/flip_framer.h
parent3a20aba73b4d981971a285a4ea38a9d5890de02d (diff)
downloadchromium_src-ad80d5e5bc4b8924778b8418058761ef0ad19aa4.zip
chromium_src-ad80d5e5bc4b8924778b8418058761ef0ad19aa4.tar.gz
chromium_src-ad80d5e5bc4b8924778b8418058761ef0ad19aa4.tar.bz2
Take 2:
Rework the FlipProtocol to separate the C-like structs from the methods. Without this refactoring, we didn't have a clean way to allocate and deallocate FlipFrames. Now we can use the scoped_ptr cleanly. Summary of misc changes: * Merged in some small changes from the GFE side. * flip_protocol.h Changes substantially. We now have separate structs and classes. No longer can you cast from one frame type to another. All FlipFrame classes derive from FlipFrame. A FlipFrame owns a buffer which is used for the frame, and when you create the Frame, you can specify whether the FlipFrame will self-clean its buffer or not. This makes it cheap to instantiate a FlipFrame class on the stack and use it temporarily for accessing fields without having to do any copies or allocations. * You can't use sizeof(FlipFrame) anymore - that is now a class. Added a static "size()" method to each FlipFrame type for declaring its real size. * Refactored a couple of routines in flip_framer. These were previously in a huge state machine (ProcessInput), just copied the code into subroutines. * Added flip_protocol_test to the mix from the gfe side. Much of this is a refactoring from flip_framer_test. * Eliminated reinterpret_casts as much as I could and got rid of all uses of scoped_array for FlipFrames. BUG=none TEST=all flip tests reworked Review URL: http://codereview.chromium.org/376012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31277 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip/flip_framer.h')
-rw-r--r--net/flip/flip_framer.h16
1 files changed, 10 insertions, 6 deletions
diff --git a/net/flip/flip_framer.h b/net/flip/flip_framer.h
index d3cae28..b333176 100644
--- a/net/flip/flip_framer.h
+++ b/net/flip/flip_framer.h
@@ -30,7 +30,11 @@ namespace flip {
class FlipFramer;
class FlipFramerTest;
+
+namespace test {
class TestFlipVisitor;
+void FramerSetEnableCompressionHelper(FlipFramer* framer, bool compress);
+} // namespace test
// A datastructure for holding a set of headers from either a
// SYN_STREAM or SYN_REPLY frame.
@@ -58,9 +62,6 @@ class FlipFramerVisitorInterface {
virtual void OnStreamFrameData(flip::FlipStreamId stream_id,
const char* data,
size_t len) = 0;
-
- // TODO(fenix): Implement me!
- virtual void OnLameDuck() = 0;
};
class FlipFramer {
@@ -200,9 +201,11 @@ class FlipFramer {
protected:
FRIEND_TEST(FlipFramerTest, HeaderBlockBarfsOnOutOfOrderHeaders);
- friend class flip::TestFlipVisitor;
friend class net::FlipNetworkTransactionTest;
friend class net::HttpNetworkLayer; // This is temporary for the server.
+ friend class test::TestFlipVisitor;
+ friend void test::FramerSetEnableCompressionHelper(FlipFramer* framer,
+ bool compress);
// For ease of testing we can tweak compression on/off.
void set_enable_compression(bool value);
@@ -212,7 +215,9 @@ class FlipFramer {
// Internal breakout from ProcessInput. Returns the number of bytes
// consumed from the data.
size_t ProcessCommonHeader(const char* data, size_t len);
+ void ProcessControlFrameHeader();
size_t ProcessControlFramePayload(const char* data, size_t len);
+ size_t ProcessDataFramePayload(const char* data, size_t len);
// Initialize the ZLib state.
bool InitializeCompressor();
@@ -230,8 +235,7 @@ class FlipFramer {
// Given a frame, breakdown the variable payload length, the static header
// header length, and variable payload pointer.
bool GetFrameBoundaries(const FlipFrame* frame, int* payload_length,
- int* header_length,
- const unsigned char** payload) const;
+ int* header_length, const char** payload) const;
FlipState state_;
FlipError error_code_;