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

Unified Diff: courgette/win32_x86_patcher.h

Issue 8417045: Last small bit of refactoring. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « courgette/win32_x86_generator.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: courgette/win32_x86_patcher.h
diff --git a/courgette/win32_x86_patcher.h b/courgette/win32_x86_patcher.h
deleted file mode 100644
index f1aad9dadab8089426fef5fdc868e04f11a37e51..0000000000000000000000000000000000000000
--- a/courgette/win32_x86_patcher.h
+++ /dev/null
@@ -1,93 +0,0 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-// This is the transformation for Windows X86 executables.
-
-#ifndef COURGETTE_WIN32_X86_PATCHER_H_
-#define COURGETTE_WIN32_X86_PATCHER_H_
-
-#include "courgette/ensemble.h"
-
-namespace courgette {
-
-// CourgetteWin32X86Patcher is a TransformationPatcher for Windows 32-bit
-// executables.
-//
-class CourgetteWin32X86Patcher : public TransformationPatcher {
- public:
- explicit CourgetteWin32X86Patcher(const Region& region)
- : ensemble_region_(region) {
- }
-
- Status Init(SourceStream* parameter_stream) {
- if (!parameter_stream->ReadVarint32(&base_offset_))
- return C_BAD_TRANSFORM;
- if (!parameter_stream->ReadVarint32(&base_length_))
- return C_BAD_TRANSFORM;
-
- if (base_offset_ > ensemble_region_.length())
- return C_BAD_TRANSFORM;
- if (base_length_ > ensemble_region_.length() - base_offset_)
- return C_BAD_TRANSFORM;
-
- return C_OK;
- }
-
- Status PredictTransformParameters(SinkStreamSet* predicted_parameters) {
- // No code needed to write an 'empty' predicted parameter set.
- return C_OK;
- }
-
- Status Transform(SourceStreamSet* corrected_parameters,
- SinkStreamSet* transformed_element) {
- Status status;
- if (!corrected_parameters->Empty())
- return C_GENERAL_ERROR; // Don't expect any corrected parameters.
-
- AssemblyProgram* program = NULL;
- status = ParseDetectedExecutable(ensemble_region_.start() + base_offset_,
- base_length_,
- &program);
- if (status != C_OK)
- return status;
-
- EncodedProgram* encoded = NULL;
- status = Encode(program, &encoded);
- DeleteAssemblyProgram(program);
- if (status != C_OK)
- return status;
-
- status = WriteEncodedProgram(encoded, transformed_element);
- DeleteEncodedProgram(encoded);
-
- return status;
- }
-
- Status Reform(SourceStreamSet* transformed_element,
- SinkStream* reformed_element) {
- Status status;
- EncodedProgram* encoded_program = NULL;
- status = ReadEncodedProgram(transformed_element, &encoded_program);
- if (status != C_OK)
- return status;
-
- status = Assemble(encoded_program, reformed_element);
- DeleteEncodedProgram(encoded_program);
- if (status != C_OK)
- return status;
-
- return C_OK;
- }
-
- private:
- Region ensemble_region_;
-
- uint32 base_offset_;
- uint32 base_length_;
-
- DISALLOW_COPY_AND_ASSIGN(CourgetteWin32X86Patcher);
-};
-
-} // namespace
-#endif // COURGETTE_WIN32_X86_PATCHER_H_
« no previous file with comments | « courgette/win32_x86_generator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698