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

Side by Side Diff: chrome/browser/component_updater/component_patcher_internal.h

Issue 15908002: Differential updates for components. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: really removing the lzma files this time. Created 7 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_INTERNAL_H_
6 #define CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_INTERNAL_H_
7
8 #include <string>
9 #include "base/basictypes.h"
10 #include "base/compiler_specific.h"
11 #include "chrome/browser/component_updater/component_patcher.h"
12
13 namespace base {
14 class FilePath;
15 class DictionaryValue;
16 }
17
18 class ComponentInstaller;
19
20 class DeltaUpdateOp {
21 public:
22 DeltaUpdateOp();
23 virtual ~DeltaUpdateOp();
24
25 // Parses, runs, and verifies the operation, returning an error code if an
26 // error is encountered, and DELTA_OK otherwise. In case of errors,
27 // extended error information can be returned in the |error| parameter.
28 ComponentUnpacker::Error Run(
29 base::DictionaryValue* command_args,
30 const base::FilePath& input_dir,
31 const base::FilePath& unpack_dir,
32 ComponentPatcher* patcher,
33 ComponentInstaller* installer,
34 int* error);
35
36 protected:
37 std::string output_sha256_;
38 base::FilePath output_abs_path_;
39
40 private:
41 ComponentUnpacker::Error CheckHash();
42
43 // Subclasses must override DoParseArguments to parse operation-specific
44 // arguments. DoParseArguments returns DELTA_OK on success; any other code
45 // represents failure.
46 virtual ComponentUnpacker::Error DoParseArguments(
47 base::DictionaryValue* command_args,
48 const base::FilePath& input_dir,
49 ComponentInstaller* installer) = 0;
50
51 // Subclasses must override DoRun to actually perform the patching operation.
52 // DoRun returns DELTA_OK on success; any other code represents failure.
53 // Additional error information can be returned in the |error| parameter.
54 virtual ComponentUnpacker::Error DoRun(ComponentPatcher* patcher,
55 int* error) = 0;
56
57 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOp);
58 };
59
60 // A 'copy' operation takes a file currently residing on the disk and moves it
61 // into the unpacking directory: this represents "no change" in the file being
62 // installed.
63 class DeltaUpdateOpCopy : public DeltaUpdateOp {
64 public:
65 DeltaUpdateOpCopy();
66
67 private:
68 // Overrides of DeltaUpdateOp.
69 virtual ComponentUnpacker::Error DoParseArguments(
70 base::DictionaryValue* command_args,
71 const base::FilePath& input_dir,
72 ComponentInstaller* installer) OVERRIDE;
73
74 virtual ComponentUnpacker::Error DoRun(ComponentPatcher* patcher,
75 int* error) OVERRIDE;
76
77 base::FilePath input_abs_path_;
78
79 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpCopy);
80 };
81
82 // A 'create' operation takes a full file that was sent in the delta update
83 // archive and moves it into the unpacking directory: this represents the
84 // addition of a new file, or a file so different that no bandwidth could be
85 // saved by transmitting a differential update.
86 class DeltaUpdateOpCreate : public DeltaUpdateOp {
87 public:
88 DeltaUpdateOpCreate();
89
90 private:
91 // Overrides of DeltaUpdateOp.
92 virtual ComponentUnpacker::Error DoParseArguments(
93 base::DictionaryValue* command_args,
94 const base::FilePath& input_dir,
95 ComponentInstaller* installer) OVERRIDE;
96
97 virtual ComponentUnpacker::Error DoRun(ComponentPatcher* patcher,
98 int* error) OVERRIDE;
99
100 base::FilePath patch_abs_path_;
101
102 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpCreate);
103 };
104
105 // A 'bsdiff' operation takes an existing file on disk, and a bsdiff-
106 // format patch file provided in the delta update package, and runs bsdiff
107 // to construct an output file in the unpacking directory.
108 class DeltaUpdateOpPatchBsdiff : public DeltaUpdateOp {
109 public:
110 DeltaUpdateOpPatchBsdiff();
111
112 private:
113 // Overrides of DeltaUpdateOp.
114 virtual ComponentUnpacker::Error DoParseArguments(
115 base::DictionaryValue* command_args,
116 const base::FilePath& input_dir,
117 ComponentInstaller* installer) OVERRIDE;
118
119 virtual ComponentUnpacker::Error DoRun(ComponentPatcher* patcher,
120 int* error) OVERRIDE;
121
122 base::FilePath patch_abs_path_;
123 base::FilePath input_abs_path_;
124
125 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpPatchBsdiff);
126 };
127
128 // A 'courgette' operation takes an existing file on disk, and a Courgette-
129 // format patch file provided in the delta update package, and runs Courgette
130 // to construct an output file in the unpacking directory.
131 class DeltaUpdateOpPatchCourgette : public DeltaUpdateOp {
132 public:
133 DeltaUpdateOpPatchCourgette();
134
135 private:
136 // Overrides of DeltaUpdateOp.
137 virtual ComponentUnpacker::Error DoParseArguments(
138 base::DictionaryValue* command_args,
139 const base::FilePath& input_dir,
140 ComponentInstaller* installer) OVERRIDE;
141
142 virtual ComponentUnpacker::Error DoRun(ComponentPatcher* patcher,
143 int* error) OVERRIDE;
144
145 base::FilePath patch_abs_path_;
146 base::FilePath input_abs_path_;
147
148 DISALLOW_COPY_AND_ASSIGN(DeltaUpdateOpPatchCourgette);
149 };
150
151 #endif // CHROME_BROWSER_COMPONENT_UPDATER_COMPONENT_PATCHER_INTERNAL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698