| 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 |
| (...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 337 // cases when the server and the client are unable to initiate the download. | 337 // cases when the server and the client are unable to initiate the download. |
| 338 CHECK(action == response_handler_action_.get()); | 338 CHECK(action == response_handler_action_.get()); |
| 339 const InstallPlan& plan = response_handler_action_->install_plan(); | 339 const InstallPlan& plan = response_handler_action_->install_plan(); |
| 340 last_checked_time_ = time(NULL); | 340 last_checked_time_ = time(NULL); |
| 341 // TODO(adlr): put version in InstallPlan | 341 // TODO(adlr): put version in InstallPlan |
| 342 new_version_ = "0.0.0.0"; | 342 new_version_ = "0.0.0.0"; |
| 343 new_size_ = plan.size; | 343 new_size_ = plan.size; |
| 344 is_full_update_ = plan.is_full_update; | 344 is_full_update_ = plan.is_full_update; |
| 345 SetupDownload(); | 345 SetupDownload(); |
| 346 SetupPriorityManagement(); | 346 SetupPriorityManagement(); |
| 347 SetStatusAndNotify(UPDATE_STATUS_UPDATE_AVAILABLE); |
| 347 } else if (type == DownloadAction::StaticType()) { | 348 } else if (type == DownloadAction::StaticType()) { |
| 348 SetStatusAndNotify(UPDATE_STATUS_FINALIZING); | 349 SetStatusAndNotify(UPDATE_STATUS_FINALIZING); |
| 349 } | 350 } |
| 350 } | 351 } |
| 351 | 352 |
| 352 // Stop updating. An attempt will be made to record status to the disk | 353 // Stop updating. An attempt will be made to record status to the disk |
| 353 // so that updates can be resumed later. | 354 // so that updates can be resumed later. |
| 354 void UpdateAttempter::Terminate() { | 355 void UpdateAttempter::Terminate() { |
| 355 // TODO(adlr): implement this method. | 356 // TODO(adlr): implement this method. |
| 356 NOTIMPLEMENTED(); | 357 NOTIMPLEMENTED(); |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 if (resume_offset < response_handler_action_->install_plan().size) { | 542 if (resume_offset < response_handler_action_->install_plan().size) { |
| 542 ranges.push_back(make_pair(resume_offset, -1)); | 543 ranges.push_back(make_pair(resume_offset, -1)); |
| 543 } | 544 } |
| 544 } else { | 545 } else { |
| 545 ranges.push_back(make_pair(0, -1)); | 546 ranges.push_back(make_pair(0, -1)); |
| 546 } | 547 } |
| 547 fetcher->set_ranges(ranges); | 548 fetcher->set_ranges(ranges); |
| 548 } | 549 } |
| 549 | 550 |
| 550 } // namespace chromeos_update_engine | 551 } // namespace chromeos_update_engine |
| OLD | NEW |