OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 The Chromium 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 "chrome/browser/chromeos/system/automatic_reboot_manager.h" | 5 #include "chrome/browser/chromeos/system/automatic_reboot_manager.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 void AutomaticRebootManager::UpdateStatusChanged( | 229 void AutomaticRebootManager::UpdateStatusChanged( |
230 const UpdateEngineClient::Status& status) { | 230 const UpdateEngineClient::Status& status) { |
231 // Ignore repeated notifications that a reboot is necessary. This is important | 231 // Ignore repeated notifications that a reboot is necessary. This is important |
232 // so that only the time of the first notification is taken into account and | 232 // so that only the time of the first notification is taken into account and |
233 // repeated notifications do not postpone the reboot request and grace period. | 233 // repeated notifications do not postpone the reboot request and grace period. |
234 if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT || | 234 if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT || |
235 !have_boot_time_ || have_update_reboot_needed_time_) { | 235 !have_boot_time_ || have_update_reboot_needed_time_) { |
236 return; | 236 return; |
237 } | 237 } |
238 | 238 |
239 base::PostTaskWithTraits( | 239 base::PostTaskWithTraits(FROM_HERE, |
240 FROM_HERE, | 240 {base::MayBlock(), base::TaskPriority::BACKGROUND, |
241 base::TaskTraits() | 241 base::TaskShutdownBehavior::BLOCK_SHUTDOWN}, |
242 .WithPriority(base::TaskPriority::BACKGROUND) | 242 base::Bind(&SaveUpdateRebootNeededUptime)); |
243 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN) | |
244 .MayBlock(), | |
245 base::Bind(&SaveUpdateRebootNeededUptime)); | |
246 | 243 |
247 update_reboot_needed_time_ = clock_->NowTicks(); | 244 update_reboot_needed_time_ = clock_->NowTicks(); |
248 have_update_reboot_needed_time_ = true; | 245 have_update_reboot_needed_time_ = true; |
249 | 246 |
250 Reschedule(); | 247 Reschedule(); |
251 } | 248 } |
252 | 249 |
253 void AutomaticRebootManager::OnUserActivity(const ui::Event* event) { | 250 void AutomaticRebootManager::OnUserActivity(const ui::Event* event) { |
254 if (!login_screen_idle_timer_) | 251 if (!login_screen_idle_timer_) |
255 return; | 252 return; |
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 } | 414 } |
418 | 415 |
419 login_screen_idle_timer_.reset(); | 416 login_screen_idle_timer_.reset(); |
420 grace_start_timer_.reset(); | 417 grace_start_timer_.reset(); |
421 grace_end_timer_.reset(); | 418 grace_end_timer_.reset(); |
422 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); | 419 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); |
423 } | 420 } |
424 | 421 |
425 } // namespace system | 422 } // namespace system |
426 } // namespace chromeos | 423 } // namespace chromeos |
OLD | NEW |