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

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

Issue 611153004: replace OVERRIDE and FINAL with override and final in base/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CC_ -> 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
« no previous file with comments | « base/synchronization/waitable_event_watcher.h ('k') | base/task_runner.cc » ('j') | 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) 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 "base/synchronization/waitable_event_watcher.h" 5 #include "base/synchronization/waitable_event_watcher.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/message_loop/message_loop.h" 9 #include "base/message_loop/message_loop.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 // ----------------------------------------------------------------------------- 58 // -----------------------------------------------------------------------------
59 class AsyncWaiter : public WaitableEvent::Waiter { 59 class AsyncWaiter : public WaitableEvent::Waiter {
60 public: 60 public:
61 AsyncWaiter(MessageLoop* message_loop, 61 AsyncWaiter(MessageLoop* message_loop,
62 const base::Closure& callback, 62 const base::Closure& callback,
63 Flag* flag) 63 Flag* flag)
64 : message_loop_(message_loop), 64 : message_loop_(message_loop),
65 callback_(callback), 65 callback_(callback),
66 flag_(flag) { } 66 flag_(flag) { }
67 67
68 virtual bool Fire(WaitableEvent* event) OVERRIDE { 68 virtual bool Fire(WaitableEvent* event) override {
69 // Post the callback if we haven't been cancelled. 69 // Post the callback if we haven't been cancelled.
70 if (!flag_->value()) { 70 if (!flag_->value()) {
71 message_loop_->PostTask(FROM_HERE, callback_); 71 message_loop_->PostTask(FROM_HERE, callback_);
72 } 72 }
73 73
74 // We are removed from the wait-list by the WaitableEvent itself. It only 74 // We are removed from the wait-list by the WaitableEvent itself. It only
75 // remains to delete ourselves. 75 // remains to delete ourselves.
76 delete this; 76 delete this;
77 77
78 // We can always return true because an AsyncWaiter is never in two 78 // We can always return true because an AsyncWaiter is never in two
79 // different wait-lists at the same time. 79 // different wait-lists at the same time.
80 return true; 80 return true;
81 } 81 }
82 82
83 // See StopWatching for discussion 83 // See StopWatching for discussion
84 virtual bool Compare(void* tag) OVERRIDE { 84 virtual bool Compare(void* tag) override {
85 return tag == flag_.get(); 85 return tag == flag_.get();
86 } 86 }
87 87
88 private: 88 private:
89 MessageLoop *const message_loop_; 89 MessageLoop *const message_loop_;
90 base::Closure callback_; 90 base::Closure callback_;
91 scoped_refptr<Flag> flag_; 91 scoped_refptr<Flag> flag_;
92 }; 92 };
93 93
94 // ----------------------------------------------------------------------------- 94 // -----------------------------------------------------------------------------
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 // ----------------------------------------------------------------------------- 262 // -----------------------------------------------------------------------------
263 // This is called when the MessageLoop which the callback will be run it is 263 // This is called when the MessageLoop which the callback will be run it is
264 // deleted. We need to cancel the callback as if we had been deleted, but we 264 // deleted. We need to cancel the callback as if we had been deleted, but we
265 // will still be deleted at some point in the future. 265 // will still be deleted at some point in the future.
266 // ----------------------------------------------------------------------------- 266 // -----------------------------------------------------------------------------
267 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() { 267 void WaitableEventWatcher::WillDestroyCurrentMessageLoop() {
268 StopWatching(); 268 StopWatching();
269 } 269 }
270 270
271 } // namespace base 271 } // namespace base
OLDNEW
« no previous file with comments | « base/synchronization/waitable_event_watcher.h ('k') | base/task_runner.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698