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

Unified Diff: courgette/ensemble_apply.cc

Issue 1969543002: Unified usage of vector<unique_ptr<T>> (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
Index: courgette/ensemble_apply.cc
diff --git a/courgette/ensemble_apply.cc b/courgette/ensemble_apply.cc
index f740ba98e3a520a25689e75cfe35eac23f029f11..42d162458bd90f7ee568b135223a8ecb3e1f4e98 100644
--- a/courgette/ensemble_apply.cc
+++ b/courgette/ensemble_apply.cc
@@ -8,6 +8,7 @@
#include <stddef.h>
#include <stdint.h>
+#include <memory>
huangs 2016/05/11 04:49:23 NIT: new line to separate C-style and C++-style.
etiennep 2016/05/11 18:19:14 Done.
#include "base/files/file_util.h"
#include "base/files/memory_mapped_file.h"
@@ -26,7 +27,7 @@ namespace courgette {
class EnsemblePatchApplication {
public:
EnsemblePatchApplication();
- ~EnsemblePatchApplication();
+ ~EnsemblePatchApplication() = default;
Status ReadHeader(SourceStream* header_stream);
@@ -68,7 +69,7 @@ class EnsemblePatchApplication {
uint32_t target_checksum_;
uint32_t final_patch_input_size_prediction_;
- std::vector<TransformationPatcher*> patchers_;
+ std::vector<std::unique_ptr<TransformationPatcher>> patchers_;
SinkStream corrected_parameters_storage_;
SinkStream corrected_elements_storage_;
@@ -81,12 +82,6 @@ EnsemblePatchApplication::EnsemblePatchApplication()
final_patch_input_size_prediction_(0) {
}
-EnsemblePatchApplication::~EnsemblePatchApplication() {
- for (size_t i = 0; i < patchers_.size(); ++i) {
- delete patchers_[i];
- }
-}
-
Status EnsemblePatchApplication::ReadHeader(SourceStream* header_stream) {
uint32_t magic;
if (!header_stream->ReadVarint32(&magic))
@@ -157,7 +152,7 @@ Status EnsemblePatchApplication::ReadInitialParameters(
}
huangs 2016/05/11 04:49:23 default: return C_BAD_ENSEMBLE_HEADER;
etiennep 2016/05/11 18:19:13 Done.
if (patcher)
huangs 2016/05/11 04:49:23 Can do: DCHECK(patcher); patchers_.push_back(
etiennep 2016/05/11 18:19:14 Done.
- patchers_.push_back(patcher);
+ patchers_.emplace_back(patcher);
else
return C_BAD_ENSEMBLE_HEADER;
}
« courgette/disassembler_elf_32_x86.cc ('K') | « courgette/disassembler_elf_32_x86_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698