 Chromium Code Reviews
 Chromium Code Reviews Issue 4719002:
  AU: Remove obsolete SetBootableFlagAction.  (Closed) 
  Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master
    
  
    Issue 4719002:
  AU: Remove obsolete SetBootableFlagAction.  (Closed) 
  Base URL: ssh://git@gitrw.chromium.org:9222/update_engine.git@master| OLD | NEW | 
|---|---|
| 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/update_attempter.h" | 5 #include "update_engine/update_attempter.h" | 
| 6 | 6 | 
| 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L | 7 // From 'man clock_gettime': feature test macro: _POSIX_C_SOURCE >= 199309L | 
| 8 #ifndef _POSIX_C_SOURCE | 8 #ifndef _POSIX_C_SOURCE | 
| 9 #define _POSIX_C_SOURCE 199309L | 9 #define _POSIX_C_SOURCE 199309L | 
| 10 #endif // _POSIX_C_SOURCE | 10 #endif // _POSIX_C_SOURCE | 
| 11 #include <time.h> | 11 #include <time.h> | 
| 12 | 12 | 
| 13 #include <string> | 13 #include <string> | 
| 14 #include <tr1/memory> | 14 #include <tr1/memory> | 
| 15 #include <vector> | 15 #include <vector> | 
| 16 | 16 | 
| 17 #include <glib.h> | 17 #include <glib.h> | 
| 18 #include <metrics/metrics_library.h> | 18 #include <metrics/metrics_library.h> | 
| 19 | 19 | 
| 20 #include "update_engine/dbus_service.h" | 20 #include "update_engine/dbus_service.h" | 
| 21 #include "update_engine/download_action.h" | 21 #include "update_engine/download_action.h" | 
| 22 #include "update_engine/filesystem_copier_action.h" | 22 #include "update_engine/filesystem_copier_action.h" | 
| 23 #include "update_engine/libcurl_http_fetcher.h" | 23 #include "update_engine/libcurl_http_fetcher.h" | 
| 24 #include "update_engine/multi_http_fetcher.h" | 24 #include "update_engine/multi_http_fetcher.h" | 
| 25 #include "update_engine/omaha_request_action.h" | 25 #include "update_engine/omaha_request_action.h" | 
| 26 #include "update_engine/omaha_request_params.h" | 26 #include "update_engine/omaha_request_params.h" | 
| 27 #include "update_engine/omaha_response_handler_action.h" | 27 #include "update_engine/omaha_response_handler_action.h" | 
| 28 #include "update_engine/postinstall_runner_action.h" | 28 #include "update_engine/postinstall_runner_action.h" | 
| 29 #include "update_engine/prefs_interface.h" | 29 #include "update_engine/prefs_interface.h" | 
| 30 #include "update_engine/set_bootable_flag_action.h" | |
| 31 #include "update_engine/update_check_scheduler.h" | 30 #include "update_engine/update_check_scheduler.h" | 
| 32 | 31 | 
| 33 using base::TimeDelta; | 32 using base::TimeDelta; | 
| 34 using base::TimeTicks; | 33 using base::TimeTicks; | 
| 35 using std::make_pair; | 34 using std::make_pair; | 
| 36 using std::tr1::shared_ptr; | 35 using std::tr1::shared_ptr; | 
| 37 using std::string; | 36 using std::string; | 
| 38 using std::vector; | 37 using std::vector; | 
| 39 | 38 | 
| 40 namespace chromeos_update_engine { | 39 namespace chromeos_update_engine { | 
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 78 | 77 | 
| 79 const string type = action->Type(); | 78 const string type = action->Type(); | 
| 80 if (type == OmahaRequestAction::StaticType()) | 79 if (type == OmahaRequestAction::StaticType()) | 
| 81 return kActionCodeOmahaRequestError; | 80 return kActionCodeOmahaRequestError; | 
| 82 if (type == OmahaResponseHandlerAction::StaticType()) | 81 if (type == OmahaResponseHandlerAction::StaticType()) | 
| 83 return kActionCodeOmahaResponseHandlerError; | 82 return kActionCodeOmahaResponseHandlerError; | 
| 84 if (type == FilesystemCopierAction::StaticType()) | 83 if (type == FilesystemCopierAction::StaticType()) | 
| 85 return kActionCodeFilesystemCopierError; | 84 return kActionCodeFilesystemCopierError; | 
| 86 if (type == PostinstallRunnerAction::StaticType()) | 85 if (type == PostinstallRunnerAction::StaticType()) | 
| 87 return kActionCodePostinstallRunnerError; | 86 return kActionCodePostinstallRunnerError; | 
| 88 if (type == SetBootableFlagAction::StaticType()) | |
| 89 return kActionCodeSetBootableFlagError; | |
| 90 | 87 | 
| 91 return code; | 88 return code; | 
| 92 } | 89 } | 
| 93 | 90 | 
| 94 UpdateAttempter::UpdateAttempter(PrefsInterface* prefs, | 91 UpdateAttempter::UpdateAttempter(PrefsInterface* prefs, | 
| 95 MetricsLibraryInterface* metrics_lib) | 92 MetricsLibraryInterface* metrics_lib) | 
| 96 : processor_(new ActionProcessor()), | 93 : processor_(new ActionProcessor()), | 
| 97 dbus_service_(NULL), | 94 dbus_service_(NULL), | 
| 98 prefs_(prefs), | 95 prefs_(prefs), | 
| 99 metrics_lib_(metrics_lib), | 96 metrics_lib_(metrics_lib), | 
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 157 shared_ptr<DownloadAction> download_action( | 154 shared_ptr<DownloadAction> download_action( | 
| 158 new DownloadAction(prefs_, new MultiHttpFetcher<LibcurlHttpFetcher>)); | 155 new DownloadAction(prefs_, new MultiHttpFetcher<LibcurlHttpFetcher>)); | 
| 159 shared_ptr<OmahaRequestAction> download_finished_action( | 156 shared_ptr<OmahaRequestAction> download_finished_action( | 
| 160 new OmahaRequestAction(prefs_, | 157 new OmahaRequestAction(prefs_, | 
| 161 omaha_request_params_, | 158 omaha_request_params_, | 
| 162 new OmahaEvent( | 159 new OmahaEvent( | 
| 163 OmahaEvent::kTypeUpdateDownloadFinished), | 160 OmahaEvent::kTypeUpdateDownloadFinished), | 
| 164 new LibcurlHttpFetcher)); | 161 new LibcurlHttpFetcher)); | 
| 165 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_precommit( | 162 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_precommit( | 
| 166 new PostinstallRunnerAction(true)); | 163 new PostinstallRunnerAction(true)); | 
| 167 shared_ptr<SetBootableFlagAction> set_bootable_flag_action( | |
| 168 new SetBootableFlagAction); | |
| 169 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_postcommit( | 164 shared_ptr<PostinstallRunnerAction> postinstall_runner_action_postcommit( | 
| 
adlr
2010/11/08 22:54:07
you may want to delete this now? or is this in a s
 
petkov
2010/11/08 22:56:53
I thought it's going to be cleaner in a separate C
 | |
| 170 new PostinstallRunnerAction(false)); | 165 new PostinstallRunnerAction(false)); | 
| 171 shared_ptr<OmahaRequestAction> update_complete_action( | 166 shared_ptr<OmahaRequestAction> update_complete_action( | 
| 172 new OmahaRequestAction(prefs_, | 167 new OmahaRequestAction(prefs_, | 
| 173 omaha_request_params_, | 168 omaha_request_params_, | 
| 174 new OmahaEvent(OmahaEvent::kTypeUpdateComplete), | 169 new OmahaEvent(OmahaEvent::kTypeUpdateComplete), | 
| 175 new LibcurlHttpFetcher)); | 170 new LibcurlHttpFetcher)); | 
| 176 | 171 | 
| 177 download_action->set_delegate(this); | 172 download_action->set_delegate(this); | 
| 178 response_handler_action_ = response_handler_action; | 173 response_handler_action_ = response_handler_action; | 
| 179 download_action_ = download_action; | 174 download_action_ = download_action; | 
| 180 | 175 | 
| 181 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); | 176 actions_.push_back(shared_ptr<AbstractAction>(update_check_action)); | 
| 182 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); | 177 actions_.push_back(shared_ptr<AbstractAction>(response_handler_action)); | 
| 183 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); | 178 actions_.push_back(shared_ptr<AbstractAction>(filesystem_copier_action)); | 
| 184 actions_.push_back(shared_ptr<AbstractAction>( | 179 actions_.push_back(shared_ptr<AbstractAction>( | 
| 185 kernel_filesystem_copier_action)); | 180 kernel_filesystem_copier_action)); | 
| 186 actions_.push_back(shared_ptr<AbstractAction>(download_started_action)); | 181 actions_.push_back(shared_ptr<AbstractAction>(download_started_action)); | 
| 187 actions_.push_back(shared_ptr<AbstractAction>(download_action)); | 182 actions_.push_back(shared_ptr<AbstractAction>(download_action)); | 
| 188 actions_.push_back(shared_ptr<AbstractAction>(download_finished_action)); | 183 actions_.push_back(shared_ptr<AbstractAction>(download_finished_action)); | 
| 189 actions_.push_back(shared_ptr<AbstractAction>( | 184 actions_.push_back(shared_ptr<AbstractAction>( | 
| 190 postinstall_runner_action_precommit)); | 185 postinstall_runner_action_precommit)); | 
| 191 actions_.push_back(shared_ptr<AbstractAction>(set_bootable_flag_action)); | |
| 192 actions_.push_back(shared_ptr<AbstractAction>( | 186 actions_.push_back(shared_ptr<AbstractAction>( | 
| 193 postinstall_runner_action_postcommit)); | 187 postinstall_runner_action_postcommit)); | 
| 194 actions_.push_back(shared_ptr<AbstractAction>(update_complete_action)); | 188 actions_.push_back(shared_ptr<AbstractAction>(update_complete_action)); | 
| 195 | 189 | 
| 196 // Enqueue the actions | 190 // Enqueue the actions | 
| 197 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); | 191 for (vector<shared_ptr<AbstractAction> >::iterator it = actions_.begin(); | 
| 198 it != actions_.end(); ++it) { | 192 it != actions_.end(); ++it) { | 
| 199 processor_->EnqueueAction(it->get()); | 193 processor_->EnqueueAction(it->get()); | 
| 200 } | 194 } | 
| 201 | 195 | 
| 202 // Bond them together. We have to use the leaf-types when calling | 196 // Bond them together. We have to use the leaf-types when calling | 
| 203 // BondActions(). | 197 // BondActions(). | 
| 204 BondActions(update_check_action.get(), | 198 BondActions(update_check_action.get(), | 
| 205 response_handler_action.get()); | 199 response_handler_action.get()); | 
| 206 BondActions(response_handler_action.get(), | 200 BondActions(response_handler_action.get(), | 
| 207 filesystem_copier_action.get()); | 201 filesystem_copier_action.get()); | 
| 208 BondActions(filesystem_copier_action.get(), | 202 BondActions(filesystem_copier_action.get(), | 
| 209 kernel_filesystem_copier_action.get()); | 203 kernel_filesystem_copier_action.get()); | 
| 210 BondActions(kernel_filesystem_copier_action.get(), | 204 BondActions(kernel_filesystem_copier_action.get(), | 
| 211 download_action.get()); | 205 download_action.get()); | 
| 212 BondActions(download_action.get(), | 206 BondActions(download_action.get(), | 
| 213 postinstall_runner_action_precommit.get()); | 207 postinstall_runner_action_precommit.get()); | 
| 214 BondActions(postinstall_runner_action_precommit.get(), | 208 BondActions(postinstall_runner_action_precommit.get(), | 
| 215 set_bootable_flag_action.get()); | |
| 216 BondActions(set_bootable_flag_action.get(), | |
| 217 postinstall_runner_action_postcommit.get()); | 209 postinstall_runner_action_postcommit.get()); | 
| 218 | 210 | 
| 219 SetStatusAndNotify(UPDATE_STATUS_CHECKING_FOR_UPDATE); | 211 SetStatusAndNotify(UPDATE_STATUS_CHECKING_FOR_UPDATE); | 
| 220 processor_->StartProcessing(); | 212 processor_->StartProcessing(); | 
| 221 } | 213 } | 
| 222 | 214 | 
| 223 void UpdateAttempter::CheckForUpdate(const std::string& app_version, | 215 void UpdateAttempter::CheckForUpdate(const std::string& app_version, | 
| 224 const std::string& omaha_url) { | 216 const std::string& omaha_url) { | 
| 225 if (status_ != UPDATE_STATUS_IDLE) { | 217 if (status_ != UPDATE_STATUS_IDLE) { | 
| 226 LOG(INFO) << "Check for update requested, but status is " | 218 LOG(INFO) << "Check for update requested, but status is " | 
| (...skipping 315 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 542 if (resume_offset < response_handler_action_->install_plan().size) { | 534 if (resume_offset < response_handler_action_->install_plan().size) { | 
| 543 ranges.push_back(make_pair(resume_offset, -1)); | 535 ranges.push_back(make_pair(resume_offset, -1)); | 
| 544 } | 536 } | 
| 545 } else { | 537 } else { | 
| 546 ranges.push_back(make_pair(0, -1)); | 538 ranges.push_back(make_pair(0, -1)); | 
| 547 } | 539 } | 
| 548 fetcher->set_ranges(ranges); | 540 fetcher->set_ranges(ranges); | 
| 549 } | 541 } | 
| 550 | 542 | 
| 551 } // namespace chromeos_update_engine | 543 } // namespace chromeos_update_engine | 
| OLD | NEW |