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

Side by Side Diff: download_action.h

Issue 3471006: AU: Speed up updates by using buffered writes. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: update comment Created 10 years, 3 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
« no previous file with comments | « buffered_file_writer_unittest.cc ('k') | download_action.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium OS 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 CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
7 7
8 #include <sys/types.h> 8 #include <sys/types.h>
9 #include <sys/stat.h> 9 #include <sys/stat.h>
10 #include <fcntl.h> 10 #include <fcntl.h>
11 11
12 #include <string> 12 #include <string>
13 13
14 #include <base/scoped_ptr.h>
14 #include <curl/curl.h> 15 #include <curl/curl.h>
15 16
16 #include "base/scoped_ptr.h"
17 #include "update_engine/action.h" 17 #include "update_engine/action.h"
18 #include "update_engine/decompressing_file_writer.h" 18 #include "update_engine/decompressing_file_writer.h"
19 #include "update_engine/delta_performer.h" 19 #include "update_engine/delta_performer.h"
20 #include "update_engine/file_writer.h" 20 #include "update_engine/buffered_file_writer.h"
21 #include "update_engine/http_fetcher.h" 21 #include "update_engine/http_fetcher.h"
22 #include "update_engine/install_plan.h" 22 #include "update_engine/install_plan.h"
23 #include "update_engine/omaha_hash_calculator.h" 23 #include "update_engine/omaha_hash_calculator.h"
24 #include "update_engine/split_file_writer.h" 24 #include "update_engine/split_file_writer.h"
25 25
26 // The Download Action downloads a specified url to disk. The url should 26 // The Download Action downloads a specified url to disk. The url should
27 // point to either a full or delta update. If a full update, the file will 27 // point to either a full or delta update. If a full update, the file will
28 // be piped into a SplitFileWriter, which will direct it to the kernel 28 // be piped into a SplitFileWriter, which will direct it to the kernel
29 // and rootfs partitions. If it's a delta update, the destination kernel 29 // and rootfs partitions. If it's a delta update, the destination kernel
30 // and rootfs should already contain the source-version that this delta 30 // and rootfs should already contain the source-version that this delta
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 98
99 // The FileWriter that downloaded data should be written to. It will 99 // The FileWriter that downloaded data should be written to. It will
100 // either point to *decompressing_file_writer_ or *delta_performer_. 100 // either point to *decompressing_file_writer_ or *delta_performer_.
101 FileWriter* writer_; 101 FileWriter* writer_;
102 102
103 // These are used for full updates: 103 // These are used for full updates:
104 scoped_ptr<GzipDecompressingFileWriter> decompressing_file_writer_; 104 scoped_ptr<GzipDecompressingFileWriter> decompressing_file_writer_;
105 scoped_ptr<SplitFileWriter> split_file_writer_; 105 scoped_ptr<SplitFileWriter> split_file_writer_;
106 scoped_ptr<DirectFileWriter> kernel_file_writer_; 106 scoped_ptr<DirectFileWriter> kernel_file_writer_;
107 scoped_ptr<DirectFileWriter> rootfs_file_writer_; 107 scoped_ptr<DirectFileWriter> rootfs_file_writer_;
108 scoped_ptr<BufferedFileWriter> kernel_buffered_file_writer_;
109 scoped_ptr<BufferedFileWriter> rootfs_buffered_file_writer_;
108 110
109 // Used to apply a delta update: 111 // Used to apply a delta update:
110 scoped_ptr<DeltaPerformer> delta_performer_; 112 scoped_ptr<DeltaPerformer> delta_performer_;
111 113
112 // Pointer to the HttpFetcher that does the http work. 114 // Pointer to the HttpFetcher that does the http work.
113 scoped_ptr<HttpFetcher> http_fetcher_; 115 scoped_ptr<HttpFetcher> http_fetcher_;
114 116
115 // Used to find the hash of the bytes downloaded 117 // Used to find the hash of the bytes downloaded
116 OmahaHashCalculator omaha_hash_calculator_; 118 OmahaHashCalculator omaha_hash_calculator_;
117 119
118 // For reporting status to outsiders 120 // For reporting status to outsiders
119 DownloadActionDelegate* delegate_; 121 DownloadActionDelegate* delegate_;
120 uint64_t bytes_received_; 122 uint64_t bytes_received_;
121 123
122 DISALLOW_COPY_AND_ASSIGN(DownloadAction); 124 DISALLOW_COPY_AND_ASSIGN(DownloadAction);
123 }; 125 };
124 126
125 // We want to be sure that we're compiled with large file support on linux, 127 // We want to be sure that we're compiled with large file support on linux,
126 // just in case we find ourselves downloading large images. 128 // just in case we find ourselves downloading large images.
127 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit); 129 COMPILE_ASSERT(8 == sizeof(off_t), off_t_not_64_bit);
128 130
129 } // namespace chromeos_update_engine 131 } // namespace chromeos_update_engine
130 132
131 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__ 133 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_DOWNLOAD_ACTION_H__
OLDNEW
« no previous file with comments | « buffered_file_writer_unittest.cc ('k') | download_action.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698