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

Unified Diff: remoting/base/decompressor_zlib.cc

Issue 3305001: Move decoder into separate thread, clean up API layering, and redo update protocl (Closed)
Patch Set: Fix compile error. Created 10 years, 2 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 | « remoting/base/decompressor_zlib.h ('k') | remoting/base/encode_decode_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/decompressor_zlib.cc
diff --git a/remoting/base/decompressor_zlib.cc b/remoting/base/decompressor_zlib.cc
index e3060bd8d38e425c4418926772375ea2d48d1afc..bb4a83d205d06029e0cca9d8361d94ed1387535d 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
« no previous file with comments | « remoting/base/decompressor_zlib.h ('k') | remoting/base/encode_decode_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698