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

Unified Diff: courgette/courgette.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/assembly_program.cc ('k') | courgette/courgette.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/courgette.h
diff --git a/courgette/courgette.h b/courgette/courgette.h
index 84ab7cddd3d9d25708ec7048bf161aace3ad813a..5a98a469a34f96b8de89683bd06075d9d2ee38fa 100644
--- a/courgette/courgette.h
+++ b/courgette/courgette.h
@@ -90,6 +90,30 @@
Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target,
SinkStream* patch);
+// Detects the type of an executable file, and it's length. The length
+// may be slightly smaller than some executables (like ELF), but will include
+// all bytes the courgette algorithm has special benefit for.
+// On success:
+// Fill in type and detected_length, and return C_OK.
+// On failure:
+// Fill in type with UNKNOWN, detected_length with 0, and
+// return C_INPUT_NOT_RECOGNIZED
+Status DetectExecutableType(const void* buffer, size_t length,
+ ExecutableType* type,
+ size_t* detected_length);
+
+// Attempts to detect the type of executable, and parse it with the
+// appropriate tools, storing the pointer to the AssemblyProgram in |*output|.
+// Returns C_OK if successful, otherwise returns an error status and sets
+// |*output| to NULL.
+Status ParseDetectedExecutable(const void* buffer, size_t length,
+ AssemblyProgram** output);
+
+// Converts |program| into encoded form, returning it as |*output|.
+// Returns C_OK if succeeded, otherwise returns an error status and
+// sets |*output| to NULL
+Status Encode(AssemblyProgram* program, EncodedProgram** output);
+
// Serializes |encoded| into the stream set.
// Returns C_OK if succeeded, otherwise returns an error status.
Status WriteEncodedProgram(EncodedProgram* encoded, SinkStreamSet* sink);
@@ -99,10 +123,20 @@
// |buffer| in an undefined state.
Status Assemble(EncodedProgram* encoded, SinkStream* buffer);
+// Deserializes program from the stream set.
+// Returns C_OK if succeeded, otherwise returns an error status and
+// sets |*output| to NULL
+Status ReadEncodedProgram(SourceStreamSet* source, EncodedProgram** output);
+
+// Used to free an AssemblyProgram returned by other APIs.
+void DeleteAssemblyProgram(AssemblyProgram* program);
+
+// Used to free an EncodedProgram returned by other APIs.
+void DeleteEncodedProgram(EncodedProgram* encoded);
+
// Adjusts |program| to look more like |model|.
//
Status Adjust(const AssemblyProgram& model, AssemblyProgram *program);
} // namespace courgette
-
#endif // COURGETTE_COURGETTE_H_
« no previous file with comments | « courgette/assembly_program.cc ('k') | courgette/courgette.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698