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

Side by Side Diff: chrome/browser/chromeos/system/automatic_reboot_manager.cc

Issue 2842563002: Revert of Use TaskScheduler instead of blocking pool in automatic_reboot_manager.cc. (Closed)
Patch Set: Created 3 years, 7 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
« no previous file with comments | « no previous file | 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) 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>
11 #include <algorithm> 11 #include <algorithm>
12 #include <string> 12 #include <string>
13 #include <utility> 13 #include <utility>
14 14
15 #include "base/bind.h" 15 #include "base/bind.h"
16 #include "base/bind_helpers.h" 16 #include "base/bind_helpers.h"
17 #include "base/callback.h" 17 #include "base/callback.h"
18 #include "base/files/file_path.h" 18 #include "base/files/file_path.h"
19 #include "base/files/file_util.h" 19 #include "base/files/file_util.h"
20 #include "base/files/scoped_file.h" 20 #include "base/files/scoped_file.h"
21 #include "base/location.h" 21 #include "base/location.h"
22 #include "base/logging.h" 22 #include "base/logging.h"
23 #include "base/memory/ref_counted.h" 23 #include "base/memory/ref_counted.h"
24 #include "base/message_loop/message_loop.h" 24 #include "base/message_loop/message_loop.h"
25 #include "base/path_service.h" 25 #include "base/path_service.h"
26 #include "base/posix/eintr_wrapper.h" 26 #include "base/posix/eintr_wrapper.h"
27 #include "base/single_thread_task_runner.h" 27 #include "base/single_thread_task_runner.h"
28 #include "base/strings/string_number_conversions.h" 28 #include "base/strings/string_number_conversions.h"
29 #include "base/task_scheduler/post_task.h"
30 #include "base/threading/sequenced_worker_pool.h" 29 #include "base/threading/sequenced_worker_pool.h"
31 #include "base/threading/thread_restrictions.h" 30 #include "base/threading/thread_restrictions.h"
32 #include "base/threading/thread_task_runner_handle.h" 31 #include "base/threading/thread_task_runner_handle.h"
33 #include "base/time/tick_clock.h" 32 #include "base/time/tick_clock.h"
34 #include "chrome/browser/browser_process.h" 33 #include "chrome/browser/browser_process.h"
35 #include "chrome/browser/chrome_notification_types.h" 34 #include "chrome/browser/chrome_notification_types.h"
36 #include "chrome/common/pref_names.h" 35 #include "chrome/common/pref_names.h"
37 #include "chromeos/chromeos_paths.h" 36 #include "chromeos/chromeos_paths.h"
38 #include "chromeos/chromeos_switches.h" 37 #include "chromeos/chromeos_switches.h"
39 #include "chromeos/dbus/dbus_thread_manager.h" 38 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
229 void AutomaticRebootManager::UpdateStatusChanged( 228 void AutomaticRebootManager::UpdateStatusChanged(
230 const UpdateEngineClient::Status& status) { 229 const UpdateEngineClient::Status& status) {
231 // Ignore repeated notifications that a reboot is necessary. This is important 230 // 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 231 // 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. 232 // repeated notifications do not postpone the reboot request and grace period.
234 if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT || 233 if (status.status != UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT ||
235 !have_boot_time_ || have_update_reboot_needed_time_) { 234 !have_boot_time_ || have_update_reboot_needed_time_) {
236 return; 235 return;
237 } 236 }
238 237
239 base::PostTaskWithTraits( 238 content::BrowserThread::PostBlockingPoolTask(
240 FROM_HERE, 239 FROM_HERE, base::Bind(&SaveUpdateRebootNeededUptime));
241 base::TaskTraits()
242 .WithPriority(base::TaskPriority::BACKGROUND)
243 .WithShutdownBehavior(base::TaskShutdownBehavior::BLOCK_SHUTDOWN)
244 .MayBlock(),
245 base::Bind(&SaveUpdateRebootNeededUptime));
246 240
247 update_reboot_needed_time_ = clock_->NowTicks(); 241 update_reboot_needed_time_ = clock_->NowTicks();
248 have_update_reboot_needed_time_ = true; 242 have_update_reboot_needed_time_ = true;
249 243
250 Reschedule(); 244 Reschedule();
251 } 245 }
252 246
253 void AutomaticRebootManager::OnUserActivity(const ui::Event* event) { 247 void AutomaticRebootManager::OnUserActivity(const ui::Event* event) {
254 if (!login_screen_idle_timer_) 248 if (!login_screen_idle_timer_)
255 return; 249 return;
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 411 }
418 412
419 login_screen_idle_timer_.reset(); 413 login_screen_idle_timer_.reset();
420 grace_start_timer_.reset(); 414 grace_start_timer_.reset();
421 grace_end_timer_.reset(); 415 grace_end_timer_.reset();
422 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart(); 416 DBusThreadManager::Get()->GetPowerManagerClient()->RequestRestart();
423 } 417 }
424 418
425 } // namespace system 419 } // namespace system
426 } // namespace chromeos 420 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698