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

Unified Diff: courgette/encoded_program.cc

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/encoded_program.h ('k') | courgette/encoded_program_fuzz_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/encoded_program.cc
diff --git a/courgette/encoded_program.cc b/courgette/encoded_program.cc
index 76fb33e66815056e591129a74461b095e0cd0f6e..59800c50c99d9ec75d7cf2f70994bf9b0b1486c1 100644
--- a/courgette/encoded_program.cc
+++ b/courgette/encoded_program.cc
@@ -10,11 +10,11 @@
#include <algorithm>
#include <map>
#include <string>
-#include <utility>
#include <vector>
#include "base/environment.h"
#include "base/logging.h"
+#include "base/memory/scoped_ptr.h"
#include "base/numerics/safe_conversions.h"
#include "base/numerics/safe_math.h"
#include "base/strings/string_number_conversions.h"
@@ -22,6 +22,7 @@
#include "courgette/courgette.h"
#include "courgette/disassembler_elf_32_arm.h"
#include "courgette/streams.h"
+#include "courgette/types_elf.h"
namespace courgette {
@@ -780,15 +781,14 @@
return C_OK;
}
-Status ReadEncodedProgram(SourceStreamSet* streams,
- scoped_ptr<EncodedProgram>* output) {
- output->reset();
- scoped_ptr<EncodedProgram> encoded(new EncodedProgram());
- if (!encoded->ReadFrom(streams))
- return C_DESERIALIZATION_FAILED;
-
- *output = std::move(encoded);
- return C_OK;
+Status ReadEncodedProgram(SourceStreamSet* streams, EncodedProgram** output) {
+ EncodedProgram* encoded = new EncodedProgram();
+ if (encoded->ReadFrom(streams)) {
+ *output = encoded;
+ return C_OK;
+ }
+ delete encoded;
+ return C_DESERIALIZATION_FAILED;
}
Status Assemble(EncodedProgram* encoded, SinkStream* buffer) {
@@ -798,4 +798,8 @@
return C_ASSEMBLY_FAILED;
}
+void DeleteEncodedProgram(EncodedProgram* encoded) {
+ delete encoded;
+}
+
} // namespace courgette
« no previous file with comments | « courgette/encoded_program.h ('k') | courgette/encoded_program_fuzz_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698