summaryrefslogtreecommitdiffstats
path: root/courgette/ensemble_create.cc
diff options
context:
space:
mode:
authorlaforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 18:35:37 +0000
committerlaforge@chromium.org <laforge@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-10-11 18:35:37 +0000
commitd244fdff5fbbda333ea904b7833b81dddc14ba3b (patch)
tree761ff3d72f842d729fb135aef08b7d686488c107 /courgette/ensemble_create.cc
parent3bbf1ca56cbc84e9dbe08c20ad62521655e12cd1 (diff)
downloadchromium_src-d244fdff5fbbda333ea904b7833b81dddc14ba3b.zip
chromium_src-d244fdff5fbbda333ea904b7833b81dddc14ba3b.tar.gz
chromium_src-d244fdff5fbbda333ea904b7833b81dddc14ba3b.tar.bz2
Revert 103879 - Start refactoring to reduce executable type knowledge.
This creates executable detection functions, a globally shared enum for describing an executable type, and reduces the number of classes and locations with executable specific knowledge. These changes, along with moving architecture specific classes into their own files should make it easier to produce special purpose clients that only contain the code required to apply their own form of patch. DisassemblerWin32EXE, ImagePE, CourgetteWin32X86PatchGenerator, and CourgetteWin32X86Patcher, and ensemble handling are all heavily affected here. This should have no effect on the behavior of the system yet, and is instead all prep-work. BUG=None TEST=Unittests Review URL: http://codereview.chromium.org/7920004 TBR=dgarrett@chromium.org Review URL: http://codereview.chromium.org/8234012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@104926 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'courgette/ensemble_create.cc')
-rw-r--r--courgette/ensemble_create.cc24
1 files changed, 10 insertions, 14 deletions
diff --git a/courgette/ensemble_create.cc b/courgette/ensemble_create.cc
index 62105b9..ec33689 100644
--- a/courgette/ensemble_create.cc
+++ b/courgette/ensemble_create.cc
@@ -65,21 +65,17 @@ Status TransformationPatchGenerator::Reform(
// Element kind.
TransformationPatchGenerator* MakeGenerator(Element* old_element,
Element* new_element) {
- switch (new_element->kind()) {
- case UNKNOWN:
- break;
- case WIN32_X86: {
- TransformationPatchGenerator* generator =
- new CourgetteWin32X86PatchGenerator(
- old_element,
- new_element,
- new CourgetteWin32X86Patcher(old_element->region()));
- return generator;
- }
+ if (new_element->kind() == Element::WIN32_X86_WITH_CODE) {
+ CourgetteWin32X86PatchGenerator* generator =
+ new CourgetteWin32X86PatchGenerator(
+ old_element,
+ new_element,
+ new CourgetteWin32X86Patcher(old_element->region()));
+ return generator;
+ } else {
+ LOG(WARNING) << "Unexpected Element::Kind " << old_element->kind();
+ return NULL;
}
-
- LOG(WARNING) << "Unexpected Element::Kind " << old_element->kind();
- return NULL;
}
// Checks to see if the proposed comparison is 'unsafe'. Sometimes one element