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

Side by Side Diff: src/platform/update_engine/download_action.cc

Issue 545072: AU: Gut code for old updater. New protobuf for v2 updater. (Closed)
Patch Set: better comments Created 10 years, 11 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
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 #include "update_engine/download_action.h" 5 #include "update_engine/download_action.h"
6 #include <errno.h> 6 #include <errno.h>
7 #include <algorithm> 7 #include <algorithm>
8 #include <glib.h> 8 #include <glib.h>
9 #include "update_engine/action_pipe.h" 9 #include "update_engine/action_pipe.h"
10 10
(...skipping 13 matching lines...) Expand all
24 http_fetcher_->set_delegate(this); 24 http_fetcher_->set_delegate(this);
25 CHECK(!writer_); 25 CHECK(!writer_);
26 direct_file_writer_.reset(new DirectFileWriter); 26 direct_file_writer_.reset(new DirectFileWriter);
27 27
28 // Get the InstallPlan and read it 28 // Get the InstallPlan and read it
29 CHECK(HasInputObject()); 29 CHECK(HasInputObject());
30 InstallPlan install_plan(GetInputObject()); 30 InstallPlan install_plan(GetInputObject());
31 31
32 should_decompress_ = install_plan.is_full_update; 32 should_decompress_ = install_plan.is_full_update;
33 url_ = install_plan.download_url; 33 url_ = install_plan.download_url;
34 output_path_ = install_plan.download_path; 34 output_path_ = install_plan.install_path;
35 hash_ = install_plan.download_hash; 35 hash_ = install_plan.download_hash;
36 install_plan.Dump(); 36 install_plan.Dump();
37 37
38 if (should_decompress_) { 38 if (should_decompress_) {
39 decompressing_file_writer_.reset( 39 decompressing_file_writer_.reset(
40 new GzipDecompressingFileWriter(direct_file_writer_.get())); 40 new GzipDecompressingFileWriter(direct_file_writer_.get()));
41 writer_ = decompressing_file_writer_.get(); 41 writer_ = decompressing_file_writer_.get();
42 output_path_ = install_plan.install_path;
43 } else { 42 } else {
44 writer_ = direct_file_writer_.get(); 43 writer_ = direct_file_writer_.get();
45 } 44 }
46 int rc = writer_->Open(output_path_.c_str(), 45 int rc = writer_->Open(output_path_.c_str(),
47 O_TRUNC | O_WRONLY | O_CREAT | O_LARGEFILE, 0644); 46 O_TRUNC | O_WRONLY | O_CREAT | O_LARGEFILE, 0644);
48 if (rc < 0) { 47 if (rc < 0) {
49 LOG(ERROR) << "Unable to open output file " << output_path_; 48 LOG(ERROR) << "Unable to open output file " << output_path_;
50 // report error to processor 49 // report error to processor
51 processor_->ActionComplete(this, false); 50 processor_->ActionComplete(this, false);
52 return; 51 return;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 83 }
85 } 84 }
86 85
87 // Write the path to the output pipe if we're successful 86 // Write the path to the output pipe if we're successful
88 if (successful && HasOutputPipe()) 87 if (successful && HasOutputPipe())
89 SetOutputObject(GetInputObject()); 88 SetOutputObject(GetInputObject());
90 processor_->ActionComplete(this, successful); 89 processor_->ActionComplete(this, successful);
91 } 90 }
92 91
93 }; // namespace {} 92 }; // namespace {}
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698