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

Side by Side Diff: chrome/browser/browser_process_impl.cc

Issue 2021393004: Migrate WaitableEvent to enum-based constructor in chrome/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@WEvent_enums
Patch Set: Split out custom changes to thread_watcher_unittest.cc Created 4 years, 6 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
OLDNEW
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
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
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)
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/downloads/downloads_api_browsertest.cc » ('j') | chrome/browser/net/predictor.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698