diff options
author | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 19:48:42 +0000 |
---|---|---|
committer | ajwong@chromium.org <ajwong@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-04 19:48:42 +0000 |
commit | 8ea7a167522a24be192e958af46a41d49e78504c (patch) | |
tree | 571cf839290beed90019a744c3a096be89cc67d1 /remoting/base/decompressor_zlib.cc | |
parent | b552f1787ca864e458e4c14e6012c20b423161a5 (diff) | |
download | chromium_src-8ea7a167522a24be192e958af46a41d49e78504c.zip chromium_src-8ea7a167522a24be192e958af46a41d49e78504c.tar.gz chromium_src-8ea7a167522a24be192e958af46a41d49e78504c.tar.bz2 |
This is a monster CL.
It started as an attempt to put the decoder onto another thread. However, this became complicated due to multiple object ownership transfers and coupling between the decode layer and the network layer; the decoder's states were highly coupled with how the network packets were processed.
This could probably be broken up slightly, but at this point, it's easier to just commit as a whole The refactor includes:
1) Making the decoder interface unaware of "network packet" types.
2) Making the network layer process packets in order.
3) Threading through asynchronous APIs all over the place.
4) Simplifying the rectangle update protocol.
5) Cleaning up object lifetime and ownership semantics between the decode layer and the renderer.
As of right now, the Verbatim format is still broken on the encode side because it uses the old protocol.
BUG=52883, 57351
TEST=still connects to chromoting_simple_host
Review URL: http://codereview.chromium.org/3305001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61402 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/base/decompressor_zlib.cc')
-rw-r--r-- | remoting/base/decompressor_zlib.cc | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/remoting/base/decompressor_zlib.cc b/remoting/base/decompressor_zlib.cc index e3060bd..bb4a83d 100644 --- a/remoting/base/decompressor_zlib.cc +++ b/remoting/base/decompressor_zlib.cc @@ -21,18 +21,16 @@ namespace remoting { DecompressorZlib::DecompressorZlib() { - stream_.reset(new z_stream()); - - stream_->next_in = Z_NULL; - stream_->zalloc = Z_NULL; - stream_->zfree = Z_NULL; - stream_->opaque = Z_NULL; - - inflateInit(stream_.get()); + InitStream(); } DecompressorZlib::~DecompressorZlib() { + Reset(); +} + +void DecompressorZlib::Reset() { inflateEnd(stream_.get()); + InitStream(); } bool DecompressorZlib::Process(const uint8* input_data, int input_size, @@ -60,4 +58,15 @@ bool DecompressorZlib::Process(const uint8* input_data, int input_size, return ret == Z_OK || ret == Z_BUF_ERROR; } +void DecompressorZlib::InitStream() { + stream_.reset(new z_stream()); + + stream_->next_in = Z_NULL; + stream_->zalloc = Z_NULL; + stream_->zfree = Z_NULL; + stream_->opaque = Z_NULL; + + inflateInit(stream_.get()); +} + } // namespace remoting |