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

Unified Diff: remoting/base/compressor_zlib.cc

Issue 5382008: Refactor ZLib and Verbatim encoders. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 10 years 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/compressor_zlib.h ('k') | remoting/base/encoder_row_based.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/compressor_zlib.cc
diff --git a/remoting/base/compressor_zlib.cc b/remoting/base/compressor_zlib.cc
index 6f7007319685f87f04d89a5f79ea0b4244ba26ed..0128361a16699c0f0cb59131ac6ef9cad1e0b7a9 100644
--- a/remoting/base/compressor_zlib.cc
+++ b/remoting/base/compressor_zlib.cc
@@ -21,6 +21,17 @@
namespace remoting {
CompressorZlib::CompressorZlib() {
+ Reset();
+}
+
+CompressorZlib::~CompressorZlib() {
+ deflateEnd(stream_.get());
+}
+
+void CompressorZlib::Reset() {
+ if (stream_.get())
+ deflateEnd(stream_.get());
+
stream_.reset(new z_stream());
stream_->next_in = Z_NULL;
@@ -31,10 +42,6 @@ CompressorZlib::CompressorZlib() {
deflateInit(stream_.get(), Z_BEST_SPEED);
}
-CompressorZlib::~CompressorZlib() {
- deflateEnd(stream_.get());
-}
-
bool CompressorZlib::Process(const uint8* input_data, int input_size,
uint8* output_data, int output_size,
CompressorFlush flush, int* consumed,
« no previous file with comments | « remoting/base/compressor_zlib.h ('k') | remoting/base/encoder_row_based.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698