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

Side by Side Diff: courgette/courgette.h

Issue 2534873005: Sandbox the component updater's patcher utility process. (Closed)
Patch Set: Through #29 Created 4 years 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
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 #ifndef COURGETTE_COURGETTE_H_ 5 #ifndef COURGETTE_COURGETTE_H_
6 #define COURGETTE_COURGETTE_H_ 6 #define COURGETTE_COURGETTE_H_
7 7
8 #include <stddef.h> // Required to define size_t on GCC 8 #include <stddef.h> // Required to define size_t on GCC
9 9
10 #include "base/files/file.h"
10 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
11 12
12 namespace courgette { 13 namespace courgette {
13 14
14 // Status codes for Courgette APIs. 15 // Status codes for Courgette APIs.
15 // 16 //
16 // Client code should only rely on the distintion between C_OK and the other 17 // Client code should only rely on the distintion between C_OK and the other
17 // status codes. 18 // status codes.
18 // 19 //
19 enum Status { 20 enum Status {
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 68
68 class AssemblyProgram; 69 class AssemblyProgram;
69 class EncodedProgram; 70 class EncodedProgram;
70 71
71 // Applies the patch to the bytes in |old| and writes the transformed ensemble 72 // Applies the patch to the bytes in |old| and writes the transformed ensemble
72 // to |output|. 73 // to |output|.
73 // Returns C_OK unless something went wrong. 74 // Returns C_OK unless something went wrong.
74 Status ApplyEnsemblePatch(SourceStream* old, SourceStream* patch, 75 Status ApplyEnsemblePatch(SourceStream* old, SourceStream* patch,
75 SinkStream* output); 76 SinkStream* output);
76 77
78 // Applies the patch in |patch_file| to the bytes in |old_file| and writes the
79 // transformed ensemble to |new_file|.
80 // Returns C_OK unless something went wrong.
81 // This function first validates that the patch file has a proper header, so the
82 // function can be used to 'try' a patch.
83 Status ApplyEnsemblePatch(base::File old_file,
84 base::File patch_file,
85 base::File new_file);
86
77 // Applies the patch in |patch_file_name| to the bytes in |old_file_name| and 87 // Applies the patch in |patch_file_name| to the bytes in |old_file_name| and
78 // writes the transformed ensemble to |new_file_name|. 88 // writes the transformed ensemble to |new_file_name|.
79 // Returns C_OK unless something went wrong. 89 // Returns C_OK unless something went wrong.
80 // This function first validates that the patch file has a proper header, so the 90 // This function first validates that the patch file has a proper header, so the
81 // function can be used to 'try' a patch. 91 // function can be used to 'try' a patch.
82 Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, 92 Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name,
83 const base::FilePath::CharType* patch_file_name, 93 const base::FilePath::CharType* patch_file_name,
84 const base::FilePath::CharType* new_file_name); 94 const base::FilePath::CharType* new_file_name);
85 95
86 // Generates a patch that will transform the bytes in |old| into the bytes in 96 // Generates a patch that will transform the bytes in |old| into the bytes in
(...skipping 11 matching lines...) Expand all
98 // |buffer| in an undefined state. 108 // |buffer| in an undefined state.
99 Status Assemble(EncodedProgram* encoded, SinkStream* buffer); 109 Status Assemble(EncodedProgram* encoded, SinkStream* buffer);
100 110
101 // Adjusts |program| to look more like |model|. 111 // Adjusts |program| to look more like |model|.
102 // 112 //
103 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); 113 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program);
104 114
105 } // namespace courgette 115 } // namespace courgette
106 116
107 #endif // COURGETTE_COURGETTE_H_ 117 #endif // COURGETTE_COURGETTE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698