| OLD | NEW |
| 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 CourgetteWin32X86PatchGenerator : public TransformationPatchGenerator { |
| 18 public: | 18 public: |
| 19 CourgetteWin32X86PatchGenerator(Element* old_element, | 19 CourgetteWin32X86PatchGenerator(Element* old_element, |
| 20 Element* new_element, | 20 Element* new_element, |
| 21 CourgetteWin32X86Patcher* patcher) | 21 CourgetteWin32X86Patcher* patcher) |
| 22 : TransformationPatchGenerator(old_element, new_element, patcher) { | 22 : TransformationPatchGenerator(old_element, new_element, patcher) { |
| 23 } | 23 } |
| 24 | 24 |
| 25 CourgettePatchFile::TransformationMethodId Kind() { | 25 CourgettePatchFile::TransformationMethodId Kind() { |
| 26 return CourgettePatchFile::T_COURGETTE_WIN32_X86; | 26 return CourgettePatchFile::T_COURGETTE_WIN32_X86; |
| 27 } | 27 } |
| 28 | 28 |
| 29 Status WriteInitialParameters(SinkStream* parameter_stream) { | 29 Status WriteInitialParameters(SinkStream* parameter_stream) { |
| 30 parameter_stream->WriteSizeVarint32(old_element_->offset_in_ensemble()); | 30 if (!parameter_stream->WriteSizeVarint32( |
| 31 parameter_stream->WriteSizeVarint32(old_element_->region().length()); | 31 old_element_->offset_in_ensemble()) || |
| 32 !parameter_stream->WriteSizeVarint32(old_element_->region().length())) { |
| 33 return C_STREAM_ERROR; |
| 34 } |
| 32 return C_OK; | 35 return C_OK; |
| 33 // TODO(sra): Initialize |patcher_| with these parameters. | 36 // TODO(sra): Initialize |patcher_| with these parameters. |
| 34 } | 37 } |
| 35 | 38 |
| 36 Status PredictTransformParameters(SinkStreamSet* prediction) { | 39 Status PredictTransformParameters(SinkStreamSet* prediction) { |
| 37 return TransformationPatchGenerator::PredictTransformParameters(prediction); | 40 return TransformationPatchGenerator::PredictTransformParameters(prediction); |
| 38 } | 41 } |
| 39 | 42 |
| 40 Status CorrectedTransformParameters(SinkStreamSet* parameters) { | 43 Status CorrectedTransformParameters(SinkStreamSet* parameters) { |
| 41 // No code needed to write an 'empty' parameter set. | 44 // No code needed to write an 'empty' parameter set. |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 } | 124 } |
| 122 | 125 |
| 123 private: | 126 private: |
| 124 ~CourgetteWin32X86PatchGenerator() { } | 127 ~CourgetteWin32X86PatchGenerator() { } |
| 125 | 128 |
| 126 DISALLOW_COPY_AND_ASSIGN(CourgetteWin32X86PatchGenerator); | 129 DISALLOW_COPY_AND_ASSIGN(CourgetteWin32X86PatchGenerator); |
| 127 }; | 130 }; |
| 128 | 131 |
| 129 } // namespace courgette | 132 } // namespace courgette |
| 130 #endif // COURGETTE_WIN32_X86_GENERATOR_H_ | 133 #endif // COURGETTE_WIN32_X86_GENERATOR_H_ |
| OLD | NEW |