| 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_check_scheduler.h" | 5 #include "update_engine/update_check_scheduler.h" |
| 6 | 6 |
| 7 #include "update_engine/utils.h" | 7 #include "update_engine/utils.h" |
| 8 | 8 |
| 9 namespace chromeos_update_engine { | 9 namespace chromeos_update_engine { |
| 10 | 10 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 GTimeoutAddSeconds(interval, StaticCheck); | 75 GTimeoutAddSeconds(interval, StaticCheck); |
| 76 scheduled_ = true; | 76 scheduled_ = true; |
| 77 LOG(INFO) << "Next update check in " << interval << " seconds."; | 77 LOG(INFO) << "Next update check in " << interval << " seconds."; |
| 78 } | 78 } |
| 79 | 79 |
| 80 gboolean UpdateCheckScheduler::StaticCheck(void* scheduler) { | 80 gboolean UpdateCheckScheduler::StaticCheck(void* scheduler) { |
| 81 UpdateCheckScheduler* me = reinterpret_cast<UpdateCheckScheduler*>(scheduler); | 81 UpdateCheckScheduler* me = reinterpret_cast<UpdateCheckScheduler*>(scheduler); |
| 82 CHECK(me->scheduled_); | 82 CHECK(me->scheduled_); |
| 83 me->scheduled_ = false; | 83 me->scheduled_ = false; |
| 84 if (me->IsOOBEComplete()) { | 84 if (me->IsOOBEComplete()) { |
| 85 me->update_attempter_->Update("", ""); | 85 me->update_attempter_->Update("", "", false); |
| 86 } else { | 86 } else { |
| 87 // Skips all automatic update checks if the OOBE process is not complete and | 87 // Skips all automatic update checks if the OOBE process is not complete and |
| 88 // schedules a new check as if it is the first one. | 88 // schedules a new check as if it is the first one. |
| 89 LOG(WARNING) << "Skipping update check because OOBE is not complete."; | 89 LOG(WARNING) << "Skipping update check because OOBE is not complete."; |
| 90 me->ScheduleCheck(kTimeoutOnce, kTimeoutRegularFuzz); | 90 me->ScheduleCheck(kTimeoutOnce, kTimeoutRegularFuzz); |
| 91 } | 91 } |
| 92 // This check ensures that future update checks will be or are already | 92 // This check ensures that future update checks will be or are already |
| 93 // scheduled. The check should never fail. A check failure means that there's | 93 // scheduled. The check should never fail. A check failure means that there's |
| 94 // a bug that will most likely prevent further automatic update checks. It | 94 // a bug that will most likely prevent further automatic update checks. It |
| 95 // seems better to crash in such cases and restart the update_engine daemon | 95 // seems better to crash in such cases and restart the update_engine daemon |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 ScheduleCheck(interval, fuzz); | 136 ScheduleCheck(interval, fuzz); |
| 137 } | 137 } |
| 138 | 138 |
| 139 void UpdateCheckScheduler::SetUpdateStatus(UpdateStatus status) { | 139 void UpdateCheckScheduler::SetUpdateStatus(UpdateStatus status) { |
| 140 if (status == UPDATE_STATUS_IDLE) { | 140 if (status == UPDATE_STATUS_IDLE) { |
| 141 ScheduleNextCheck(); | 141 ScheduleNextCheck(); |
| 142 } | 142 } |
| 143 } | 143 } |
| 144 | 144 |
| 145 } // namespace chromeos_update_engine | 145 } // namespace chromeos_update_engine |
| OLD | NEW |