diff options
author | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 18:34:13 +0000 |
---|---|---|
committer | mbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-11-06 18:34:13 +0000 |
commit | cbf87772bcc7dca13f0a69f80912754da8a51906 (patch) | |
tree | 5dca4008e706e0e1fada11df046f1db02fd11a29 /net/flip/flip_frame_builder.h | |
parent | 5b3dc11fec310fa867b4c87422d89c6045ebc451 (diff) | |
download | chromium_src-cbf87772bcc7dca13f0a69f80912754da8a51906.zip chromium_src-cbf87772bcc7dca13f0a69f80912754da8a51906.tar.gz chromium_src-cbf87772bcc7dca13f0a69f80912754da8a51906.tar.bz2 |
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/366014
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@31252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip/flip_frame_builder.h')
-rw-r--r-- | net/flip/flip_frame_builder.h | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/net/flip/flip_frame_builder.h b/net/flip/flip_frame_builder.h index fa59c45..32b6035 100644 --- a/net/flip/flip_frame_builder.h +++ b/net/flip/flip_frame_builder.h @@ -43,14 +43,9 @@ class FlipFrameBuilder { // Returns the size of the FlipFrameBuilder's data. int length() const { return length_; } - // Returns the data for this FlipFrameBuilder. - const FlipFrame* data() const { - return reinterpret_cast<FlipFrame*>(buffer_); - } - // Takes the buffer from the FlipFrameBuilder. FlipFrame* take() { - FlipFrame* rv = reinterpret_cast<FlipFrame*>(buffer_); + FlipFrame* rv = new FlipFrame(buffer_, true); buffer_ = NULL; capacity_ = 0; length_ = 0; |