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

Side by Side Diff: base/synchronization/waitable_event_posix.cc

Issue 614103004: replace 'virtual ... OVERRIDE' with '... override' (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: process base/ Created 6 years, 2 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/synchronization/condition_variable.h" 10 #include "base/synchronization/condition_variable.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // ----------------------------------------------------------------------------- 84 // -----------------------------------------------------------------------------
85 class SyncWaiter : public WaitableEvent::Waiter { 85 class SyncWaiter : public WaitableEvent::Waiter {
86 public: 86 public:
87 SyncWaiter() 87 SyncWaiter()
88 : fired_(false), 88 : fired_(false),
89 signaling_event_(NULL), 89 signaling_event_(NULL),
90 lock_(), 90 lock_(),
91 cv_(&lock_) { 91 cv_(&lock_) {
92 } 92 }
93 93
94 virtual bool Fire(WaitableEvent* signaling_event) OVERRIDE { 94 bool Fire(WaitableEvent* signaling_event) override {
95 base::AutoLock locked(lock_); 95 base::AutoLock locked(lock_);
96 96
97 if (fired_) 97 if (fired_)
98 return false; 98 return false;
99 99
100 fired_ = true; 100 fired_ = true;
101 signaling_event_ = signaling_event; 101 signaling_event_ = signaling_event;
102 102
103 cv_.Broadcast(); 103 cv_.Broadcast();
104 104
105 // Unlike AsyncWaiter objects, SyncWaiter objects are stack-allocated on 105 // Unlike AsyncWaiter objects, SyncWaiter objects are stack-allocated on
106 // the blocking thread's stack. There is no |delete this;| in Fire. The 106 // the blocking thread's stack. There is no |delete this;| in Fire. The
107 // SyncWaiter object is destroyed when it goes out of scope. 107 // SyncWaiter object is destroyed when it goes out of scope.
108 108
109 return true; 109 return true;
110 } 110 }
111 111
112 WaitableEvent* signaling_event() const { 112 WaitableEvent* signaling_event() const {
113 return signaling_event_; 113 return signaling_event_;
114 } 114 }
115 115
116 // --------------------------------------------------------------------------- 116 // ---------------------------------------------------------------------------
117 // These waiters are always stack allocated and don't delete themselves. Thus 117 // These waiters are always stack allocated and don't delete themselves. Thus
118 // there's no problem and the ABA tag is the same as the object pointer. 118 // there's no problem and the ABA tag is the same as the object pointer.
119 // --------------------------------------------------------------------------- 119 // ---------------------------------------------------------------------------
120 virtual bool Compare(void* tag) OVERRIDE { 120 bool Compare(void* tag) override { return this == tag; }
121 return this == tag;
122 }
123 121
124 // --------------------------------------------------------------------------- 122 // ---------------------------------------------------------------------------
125 // Called with lock held. 123 // Called with lock held.
126 // --------------------------------------------------------------------------- 124 // ---------------------------------------------------------------------------
127 bool fired() const { 125 bool fired() const {
128 return fired_; 126 return fired_;
129 } 127 }
130 128
131 // --------------------------------------------------------------------------- 129 // ---------------------------------------------------------------------------
132 // During a TimedWait, we need a way to make sure that an auto-reset 130 // During a TimedWait, we need a way to make sure that an auto-reset
(...skipping 275 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 return true; 406 return true;
409 } 407 }
410 } 408 }
411 409
412 return false; 410 return false;
413 } 411 }
414 412
415 // ----------------------------------------------------------------------------- 413 // -----------------------------------------------------------------------------
416 414
417 } // namespace base 415 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698