| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/browser_process_impl.h" | 5 #include "chrome/browser/browser_process_impl.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 394 | 394 |
| 395 // The count starts at one to defer the possibility of one->zero transitions | 395 // The count starts at one to defer the possibility of one->zero transitions |
| 396 // until TimedWait is called. | 396 // until TimedWait is called. |
| 397 base::AtomicRefCount count_; | 397 base::AtomicRefCount count_; |
| 398 base::WaitableEvent waitable_event_; | 398 base::WaitableEvent waitable_event_; |
| 399 | 399 |
| 400 DISALLOW_COPY_AND_ASSIGN(RundownTaskCounter); | 400 DISALLOW_COPY_AND_ASSIGN(RundownTaskCounter); |
| 401 }; | 401 }; |
| 402 | 402 |
| 403 RundownTaskCounter::RundownTaskCounter() | 403 RundownTaskCounter::RundownTaskCounter() |
| 404 : count_(1), waitable_event_(true, false) { | 404 : count_(1), |
| 405 } | 405 waitable_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 406 base::WaitableEvent::InitialState::NOT_SIGNALED) {} |
| 406 | 407 |
| 407 void RundownTaskCounter::Post(base::SequencedTaskRunner* task_runner) { | 408 void RundownTaskCounter::Post(base::SequencedTaskRunner* task_runner) { |
| 408 // As the count starts off at one, it should never get to zero unless | 409 // As the count starts off at one, it should never get to zero unless |
| 409 // TimedWait has been called. | 410 // TimedWait has been called. |
| 410 DCHECK(!base::AtomicRefCountIsZero(&count_)); | 411 DCHECK(!base::AtomicRefCountIsZero(&count_)); |
| 411 | 412 |
| 412 base::AtomicRefCountInc(&count_); | 413 base::AtomicRefCountInc(&count_); |
| 413 | 414 |
| 414 // The task must be non-nestable to guarantee that it runs after all tasks | 415 // The task must be non-nestable to guarantee that it runs after all tasks |
| 415 // currently scheduled on |task_runner| have completed. | 416 // currently scheduled on |task_runner| have completed. |
| (...skipping 880 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1296 } | 1297 } |
| 1297 | 1298 |
| 1298 void BrowserProcessImpl::OnAutoupdateTimer() { | 1299 void BrowserProcessImpl::OnAutoupdateTimer() { |
| 1299 if (CanAutorestartForUpdate()) { | 1300 if (CanAutorestartForUpdate()) { |
| 1300 DLOG(WARNING) << "Detected update. Restarting browser."; | 1301 DLOG(WARNING) << "Detected update. Restarting browser."; |
| 1301 RestartBackgroundInstance(); | 1302 RestartBackgroundInstance(); |
| 1302 } | 1303 } |
| 1303 } | 1304 } |
| 1304 | 1305 |
| 1305 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) | 1306 #endif // (defined(OS_WIN) || defined(OS_LINUX)) && !defined(OS_CHROMEOS) |
| OLD | NEW |