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

Side by Side Diff: omaha_response_handler_action.cc

Issue 3541016: AU: Optimize checkpointing a bit and decide on new update vs. resume. (Closed) Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git
Patch Set: fix copyrights Created 10 years, 2 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 | « install_plan.h ('k') | no next file » | 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) 2010 The Chromium OS Authors. All rights reserved. 1 // Copyright (c) 2010 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/omaha_response_handler_action.h" 5 #include "update_engine/omaha_response_handler_action.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include <base/logging.h> 9 #include <base/logging.h>
10 10
11 #include "update_engine/delta_performer.h"
11 #include "update_engine/prefs_interface.h" 12 #include "update_engine/prefs_interface.h"
12 #include "update_engine/utils.h" 13 #include "update_engine/utils.h"
13 14
14 using std::string; 15 using std::string;
15 16
16 namespace chromeos_update_engine { 17 namespace chromeos_update_engine {
17 18
18 void OmahaResponseHandlerAction::PerformAction() { 19 void OmahaResponseHandlerAction::PerformAction() {
19 CHECK(HasInputObject()); 20 CHECK(HasInputObject());
20 ScopedActionCompleter completer(processor_, this); 21 ScopedActionCompleter completer(processor_, this);
21 const OmahaResponse& response = GetInputObject(); 22 const OmahaResponse& response = GetInputObject();
22 if (!response.update_exists) { 23 if (!response.update_exists) {
23 got_no_update_response_ = true; 24 got_no_update_response_ = true;
24 LOG(INFO) << "There are no updates. Aborting."; 25 LOG(INFO) << "There are no updates. Aborting.";
25 return; 26 return;
26 } 27 }
27 install_plan_.download_url = response.codebase; 28 install_plan_.download_url = response.codebase;
28 install_plan_.size = response.size; 29 install_plan_.size = response.size;
29 install_plan_.download_hash = response.hash; 30 install_plan_.download_hash = response.hash;
30 // TODO(petkov): Decide here if this is going to be a regular update or 31
31 // resume-after-boot. This should also set the number of ops performed so far 32 install_plan_.is_resume =
32 // to invalid if no need to resume. 33 DeltaPerformer::CanResumeUpdate(prefs_, response.hash);
33 LOG_IF(WARNING, !prefs_->SetString(kPrefsUpdateCheckResponseHash, 34 if (!install_plan_.is_resume) {
34 response.hash)) 35 LOG_IF(WARNING, !DeltaPerformer::ResetUpdateProgress(prefs_))
35 << "Unable to save the update check response hash."; 36 << "Unable to reset the update progress.";
37 LOG_IF(WARNING, !prefs_->SetString(kPrefsUpdateCheckResponseHash,
38 response.hash))
39 << "Unable to save the update check response hash.";
40 }
41
36 TEST_AND_RETURN(GetInstallDev( 42 TEST_AND_RETURN(GetInstallDev(
37 (!boot_device_.empty() ? boot_device_ : utils::BootDevice()), 43 (!boot_device_.empty() ? boot_device_ : utils::BootDevice()),
38 &install_plan_.install_path)); 44 &install_plan_.install_path));
39 install_plan_.kernel_install_path = 45 install_plan_.kernel_install_path =
40 utils::BootKernelDevice(install_plan_.install_path); 46 utils::BootKernelDevice(install_plan_.install_path);
41 47
42 install_plan_.is_full_update = !response.is_delta; 48 install_plan_.is_full_update = !response.is_delta;
43 49
44 TEST_AND_RETURN(HasOutputPipe()); 50 TEST_AND_RETURN(HasOutputPipe());
45 if (HasOutputPipe()) 51 if (HasOutputPipe())
(...skipping 10 matching lines...) Expand all
56 string ret(boot_dev); 62 string ret(boot_dev);
57 string::reverse_iterator it = ret.rbegin(); // last character in string 63 string::reverse_iterator it = ret.rbegin(); // last character in string
58 // Right now, we just switch '3' and '5' partition numbers. 64 // Right now, we just switch '3' and '5' partition numbers.
59 TEST_AND_RETURN_FALSE((*it == '3') || (*it == '5')); 65 TEST_AND_RETURN_FALSE((*it == '3') || (*it == '5'));
60 *it = (*it == '3') ? '5' : '3'; 66 *it = (*it == '3') ? '5' : '3';
61 *install_dev = ret; 67 *install_dev = ret;
62 return true; 68 return true;
63 } 69 }
64 70
65 } // namespace chromeos_update_engine 71 } // namespace chromeos_update_engine
OLDNEW
« no previous file with comments | « install_plan.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698