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

Unified Diff: courgette/patcher_x86_32.h

Issue 1650013002: Revert of [Courgette] Refactor: Manage AssemblyProgram and EncodedProgram with scoped_ptr. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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 | « courgette/patch_generator_x86_32.h ('k') | courgette/program_detector.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/patcher_x86_32.h
diff --git a/courgette/patcher_x86_32.h b/courgette/patcher_x86_32.h
index a80ccc3daa95cd8e71fa11757d4f86e22d43a949..28db0596159b886be2e4d82deba9947a667320cc 100644
--- a/courgette/patcher_x86_32.h
+++ b/courgette/patcher_x86_32.h
@@ -8,11 +8,7 @@
#include <stdint.h>
#include "base/macros.h"
-#include "base/memory/scoped_ptr.h"
-#include "courgette/assembly_program.h"
-#include "courgette/encoded_program.h"
#include "courgette/ensemble.h"
-#include "courgette/program_detector.h"
namespace courgette {
@@ -52,32 +48,39 @@
if (!corrected_parameters->Empty())
return C_GENERAL_ERROR; // Don't expect any corrected parameters.
- scoped_ptr<AssemblyProgram> program;
+ AssemblyProgram* program = NULL;
status = ParseDetectedExecutable(ensemble_region_.start() + base_offset_,
base_length_,
&program);
if (status != C_OK)
return status;
- scoped_ptr<EncodedProgram> encoded;
- status = Encode(*program, &encoded);
+ EncodedProgram* encoded = NULL;
+ status = Encode(program, &encoded);
+ DeleteAssemblyProgram(program);
if (status != C_OK)
return status;
- program.reset();
+ status = WriteEncodedProgram(encoded, transformed_element);
+ DeleteEncodedProgram(encoded);
- return WriteEncodedProgram(encoded.get(), transformed_element);
+ return status;
}
Status Reform(SourceStreamSet* transformed_element,
SinkStream* reformed_element) {
Status status;
- scoped_ptr<EncodedProgram> encoded_program;
+ EncodedProgram* encoded_program = NULL;
status = ReadEncodedProgram(transformed_element, &encoded_program);
if (status != C_OK)
return status;
- return Assemble(encoded_program.get(), reformed_element);
+ status = Assemble(encoded_program, reformed_element);
+ DeleteEncodedProgram(encoded_program);
+ if (status != C_OK)
+ return status;
+
+ return C_OK;
}
private:
@@ -90,5 +93,4 @@
};
} // namespace
-
#endif // COURGETTE_WIN32_X86_PATCHER_H_
« no previous file with comments | « courgette/patch_generator_x86_32.h ('k') | courgette/program_detector.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698