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

Side by Side Diff: courgette/patch_generator_x86_32.h

Issue 8417045: Last small bit of refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Created 9 years, 1 month 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/ensemble_create.cc ('k') | courgette/patcher_x86_32.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"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 12
13 #include "courgette/ensemble.h" 13 #include "courgette/ensemble.h"
14 14
15 namespace courgette { 15 namespace courgette {
16 16
17 class CourgetteWin32X86PatchGenerator : public TransformationPatchGenerator { 17 class PatchGeneratorX86_32 : public TransformationPatchGenerator {
18 public: 18 public:
19 CourgetteWin32X86PatchGenerator(Element* old_element, 19 PatchGeneratorX86_32(Element* old_element,
20 Element* new_element, 20 Element* new_element,
21 CourgetteWin32X86Patcher* patcher) 21 PatcherX86_32* patcher,
22 : TransformationPatchGenerator(old_element, new_element, patcher) { 22 ExecutableType kind)
23 : TransformationPatchGenerator(old_element, new_element, patcher),
24 kind_(kind) {
23 } 25 }
24 26
25 CourgettePatchFile::TransformationMethodId Kind() { 27 virtual ExecutableType Kind() { return kind_; }
26 return CourgettePatchFile::T_COURGETTE_WIN32_X86;
27 }
28 28
29 Status WriteInitialParameters(SinkStream* parameter_stream) { 29 Status WriteInitialParameters(SinkStream* parameter_stream) {
30 if (!parameter_stream->WriteSizeVarint32( 30 if (!parameter_stream->WriteSizeVarint32(
31 old_element_->offset_in_ensemble()) || 31 old_element_->offset_in_ensemble()) ||
32 !parameter_stream->WriteSizeVarint32(old_element_->region().length())) { 32 !parameter_stream->WriteSizeVarint32(old_element_->region().length())) {
33 return C_STREAM_ERROR; 33 return C_STREAM_ERROR;
34 } 34 }
35 return C_OK; 35 return C_OK;
36 // TODO(sra): Initialize |patcher_| with these parameters. 36 // TODO(sra): Initialize |patcher_| with these parameters.
37 } 37 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 return C_OK; 117 return C_OK;
118 } 118 }
119 119
120 Status Reform(SourceStreamSet* transformed_element, 120 Status Reform(SourceStreamSet* transformed_element,
121 SinkStream* reformed_element) { 121 SinkStream* reformed_element) {
122 return TransformationPatchGenerator::Reform(transformed_element, 122 return TransformationPatchGenerator::Reform(transformed_element,
123 reformed_element); 123 reformed_element);
124 } 124 }
125 125
126 private: 126 private:
127 ~CourgetteWin32X86PatchGenerator() { } 127 virtual ~PatchGeneratorX86_32() { }
128 128
129 DISALLOW_COPY_AND_ASSIGN(CourgetteWin32X86PatchGenerator); 129 ExecutableType kind_;
130
131 DISALLOW_COPY_AND_ASSIGN(PatchGeneratorX86_32);
130 }; 132 };
131 133
132 } // namespace courgette 134 } // namespace courgette
133 #endif // COURGETTE_WIN32_X86_GENERATOR_H_ 135 #endif // COURGETTE_WIN32_X86_GENERATOR_H_
OLDNEW
« no previous file with comments | « courgette/ensemble_create.cc ('k') | courgette/patcher_x86_32.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698