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

Side by Side Diff: courgette/win32_x86_generator.h

Issue 8344037: Start refactoring to reduce executable type knowledge. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Fix comment. Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « courgette/versioning_unittest.cc ('k') | courgette/win32_x86_patcher.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // This is the transformation and adjustment for Windows X86 executables. 5 // This is the transformation and adjustment for Windows X86 executables.
6 6
7 #ifndef COURGETTE_WIN32_X86_GENERATOR_H_ 7 #ifndef COURGETTE_WIN32_X86_GENERATOR_H_
8 #define COURGETTE_WIN32_X86_GENERATOR_H_ 8 #define COURGETTE_WIN32_X86_GENERATOR_H_
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 SinkStreamSet* old_transformed_element, 54 SinkStreamSet* old_transformed_element,
55 SinkStreamSet* new_transformed_element) { 55 SinkStreamSet* new_transformed_element) {
56 // Don't expect any corrected parameters. 56 // Don't expect any corrected parameters.
57 if (!corrected_parameters->Empty()) 57 if (!corrected_parameters->Empty())
58 return C_GENERAL_ERROR; 58 return C_GENERAL_ERROR;
59 59
60 // Generate old version of program using |corrected_parameters|. 60 // Generate old version of program using |corrected_parameters|.
61 // TODO(sra): refactor to use same code from patcher_. 61 // TODO(sra): refactor to use same code from patcher_.
62 AssemblyProgram* old_program = NULL; 62 AssemblyProgram* old_program = NULL;
63 Status old_parse_status = 63 Status old_parse_status =
64 ParseWin32X86PE(old_element_->region().start(), 64 ParseDetectedExecutable(old_element_->region().start(),
65 old_element_->region().length(), 65 old_element_->region().length(),
66 &old_program); 66 &old_program);
67 if (old_parse_status != C_OK) { 67 if (old_parse_status != C_OK) {
68 LOG(ERROR) << "Cannot parse as Win32X86PE " << old_element_->Name(); 68 LOG(ERROR) << "Cannot parse as Win32X86PE " << old_element_->Name();
69 return old_parse_status; 69 return old_parse_status;
70 } 70 }
71 71
72 AssemblyProgram* new_program = NULL; 72 AssemblyProgram* new_program = NULL;
73 Status new_parse_status = 73 Status new_parse_status =
74 ParseWin32X86PE(new_element_->region().start(), 74 ParseDetectedExecutable(new_element_->region().start(),
75 new_element_->region().length(), 75 new_element_->region().length(),
76 &new_program); 76 &new_program);
77 if (new_parse_status != C_OK) { 77 if (new_parse_status != C_OK) {
78 DeleteAssemblyProgram(old_program); 78 DeleteAssemblyProgram(old_program);
79 LOG(ERROR) << "Cannot parse as Win32X86PE " << new_element_->Name(); 79 LOG(ERROR) << "Cannot parse as Win32X86PE " << new_element_->Name();
80 return new_parse_status; 80 return new_parse_status;
81 } 81 }
82 82
83 EncodedProgram* old_encoded = NULL; 83 EncodedProgram* old_encoded = NULL;
84 Status old_encode_status = Encode(old_program, &old_encoded); 84 Status old_encode_status = Encode(old_program, &old_encoded);
85 if (old_encode_status != C_OK) { 85 if (old_encode_status != C_OK) {
86 DeleteAssemblyProgram(old_program); 86 DeleteAssemblyProgram(old_program);
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 } 124 }
125 125
126 private: 126 private:
127 ~CourgetteWin32X86PatchGenerator() { } 127 ~CourgetteWin32X86PatchGenerator() { }
128 128
129 DISALLOW_COPY_AND_ASSIGN(CourgetteWin32X86PatchGenerator); 129 DISALLOW_COPY_AND_ASSIGN(CourgetteWin32X86PatchGenerator);
130 }; 130 };
131 131
132 } // namespace courgette 132 } // namespace courgette
133 #endif // COURGETTE_WIN32_X86_GENERATOR_H_ 133 #endif // COURGETTE_WIN32_X86_GENERATOR_H_
OLDNEW
« no previous file with comments | « courgette/versioning_unittest.cc ('k') | courgette/win32_x86_patcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698