| OLD | NEW |
| 1 // Copyright 2017 The Chromium OS Authors. All rights reserved. | 1 // Copyright 2017 The Chromium OS Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "compressor.h" | 5 #include "compressor.h" |
| 6 | 6 |
| 7 #include <cstring> | 7 #include <cstring> |
| 8 #include <ctime> | 8 #include <ctime> |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 42 int compressor_id, | 42 int compressor_id, |
| 43 JavaScriptMessageSenderInterface* message_sender) | 43 JavaScriptMessageSenderInterface* message_sender) |
| 44 : compressor_id_(compressor_id), | 44 : compressor_id_(compressor_id), |
| 45 message_sender_(message_sender), | 45 message_sender_(message_sender), |
| 46 worker_(instance_handle), | 46 worker_(instance_handle), |
| 47 callback_factory_(this) { | 47 callback_factory_(this) { |
| 48 requestor_ = new JavaScriptCompressorRequestor(this); | 48 requestor_ = new JavaScriptCompressorRequestor(this); |
| 49 compressor_stream_ = | 49 compressor_stream_ = |
| 50 new CompressorIOJavaScriptStream(requestor_); | 50 new CompressorIOJavaScriptStream(requestor_); |
| 51 compressor_archive_ = | 51 compressor_archive_ = |
| 52 new CompressorArchiveLibarchive(compressor_stream_); | 52 new CompressorArchiveMinizip(compressor_stream_); |
| 53 } | 53 } |
| 54 | 54 |
| 55 Compressor::~Compressor() { | 55 Compressor::~Compressor() { |
| 56 worker_.Join(); | 56 worker_.Join(); |
| 57 delete compressor_archive_; | 57 delete compressor_archive_; |
| 58 delete compressor_stream_; | 58 delete compressor_stream_; |
| 59 delete requestor_; | 59 delete requestor_; |
| 60 } | 60 } |
| 61 | 61 |
| 62 bool Compressor::Init() { | 62 bool Compressor::Init() { |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 151 | 151 |
| 152 void Compressor::CloseArchiveCallback(int32_t, bool has_error) { | 152 void Compressor::CloseArchiveCallback(int32_t, bool has_error) { |
| 153 if (!compressor_archive_->CloseArchive(has_error)) { | 153 if (!compressor_archive_->CloseArchive(has_error)) { |
| 154 message_sender_->SendCompressorError( | 154 message_sender_->SendCompressorError( |
| 155 compressor_id_, | 155 compressor_id_, |
| 156 compressor_archive_->error_message()); | 156 compressor_archive_->error_message()); |
| 157 return; | 157 return; |
| 158 } | 158 } |
| 159 message_sender_->SendCloseArchiveDone(compressor_id_); | 159 message_sender_->SendCloseArchiveDone(compressor_id_); |
| 160 } | 160 } |
| OLD | NEW |