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

Side by Side Diff: courgette/courgette.h

Issue 2534873005: Sandbox the component updater's patcher utility process. (Closed)
Patch Set: 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_path.h" 10 #include "base/files/file_path.h"
11 11
12 namespace base {
13 class File;
huangs 2016/12/06 18:23:22 Same comment as in bsdiff.h: Please - Remove the f
waffles 2016/12/06 19:18:45 Done, thanks; this was leftover from an intermedia
14 } // namespace base
15
12 namespace courgette { 16 namespace courgette {
13 17
14 // Status codes for Courgette APIs. 18 // Status codes for Courgette APIs.
15 // 19 //
16 // Client code should only rely on the distintion between C_OK and the other 20 // Client code should only rely on the distintion between C_OK and the other
17 // status codes. 21 // status codes.
18 // 22 //
19 enum Status { 23 enum Status {
20 C_OK = 1, // Successful operation. 24 C_OK = 1, // Successful operation.
21 25
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
76 80
77 // Applies the patch in |patch_file_name| to the bytes in |old_file_name| and 81 // Applies the patch in |patch_file_name| to the bytes in |old_file_name| and
78 // writes the transformed ensemble to |new_file_name|. 82 // writes the transformed ensemble to |new_file_name|.
79 // Returns C_OK unless something went wrong. 83 // Returns C_OK unless something went wrong.
80 // This function first validates that the patch file has a proper header, so the 84 // This function first validates that the patch file has a proper header, so the
81 // function can be used to 'try' a patch. 85 // function can be used to 'try' a patch.
82 Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name, 86 Status ApplyEnsemblePatch(const base::FilePath::CharType* old_file_name,
83 const base::FilePath::CharType* patch_file_name, 87 const base::FilePath::CharType* patch_file_name,
84 const base::FilePath::CharType* new_file_name); 88 const base::FilePath::CharType* new_file_name);
85 89
90 // Applies the patch in |patch_file| to the bytes in |old_file| and writes the
huangs 2016/12/06 18:30:32 Please move this between the SourceStream* version
waffles 2016/12/06 19:18:45 Done. Curious: What's the rationale here?
huangs 2016/12/06 19:40:07 Ah, symmetry: We have A() calling B() alling C(),
91 // transformed ensemble to |new_file|.
92 // Returns C_OK unless something went wrong.
93 // This function first validates that the patch file has a proper header, so the
94 // function can be used to 'try' a patch.
95 Status ApplyEnsemblePatch(base::File old_file,
96 base::File patch_file,
97 base::File new_file);
98
86 // Generates a patch that will transform the bytes in |old| into the bytes in 99 // Generates a patch that will transform the bytes in |old| into the bytes in
87 // |target|. 100 // |target|.
88 // Returns C_OK unless something when wrong (unexpected). 101 // Returns C_OK unless something when wrong (unexpected).
89 Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target, 102 Status GenerateEnsemblePatch(SourceStream* old, SourceStream* target,
90 SinkStream* patch); 103 SinkStream* patch);
91 104
92 // Serializes |encoded| into the stream set. 105 // Serializes |encoded| into the stream set.
93 // Returns C_OK if succeeded, otherwise returns an error status. 106 // Returns C_OK if succeeded, otherwise returns an error status.
94 Status WriteEncodedProgram(EncodedProgram* encoded, SinkStreamSet* sink); 107 Status WriteEncodedProgram(EncodedProgram* encoded, SinkStreamSet* sink);
95 108
96 // Assembles |encoded|, emitting the bytes into |buffer|. 109 // Assembles |encoded|, emitting the bytes into |buffer|.
97 // Returns C_OK if succeeded, otherwise returns an error status and leaves 110 // Returns C_OK if succeeded, otherwise returns an error status and leaves
98 // |buffer| in an undefined state. 111 // |buffer| in an undefined state.
99 Status Assemble(EncodedProgram* encoded, SinkStream* buffer); 112 Status Assemble(EncodedProgram* encoded, SinkStream* buffer);
100 113
101 // Adjusts |program| to look more like |model|. 114 // Adjusts |program| to look more like |model|.
102 // 115 //
103 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program); 116 Status Adjust(const AssemblyProgram& model, AssemblyProgram *program);
104 117
105 } // namespace courgette 118 } // namespace courgette
106 119
107 #endif // COURGETTE_COURGETTE_H_ 120 #endif // COURGETTE_COURGETTE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698