OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "components/sync/base/scoped_event_signal.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "base/synchronization/waitable_event.h" |
| 9 |
| 10 namespace syncer { |
| 11 |
| 12 ScopedEventSignal::ScopedEventSignal(base::WaitableEvent* event) |
| 13 : event_(event) { |
| 14 DCHECK(event_); |
| 15 } |
| 16 |
| 17 ScopedEventSignal::ScopedEventSignal(ScopedEventSignal&& other) |
| 18 : event_(other.event_) { |
| 19 other.event_ = nullptr; |
| 20 } |
| 21 |
| 22 ScopedEventSignal& ScopedEventSignal::operator=(ScopedEventSignal&& other) { |
| 23 DCHECK(!event_); |
| 24 event_ = other.event_; |
| 25 other.event_ = nullptr; |
| 26 return *this; |
| 27 } |
| 28 |
| 29 ScopedEventSignal::~ScopedEventSignal() { |
| 30 if (event_) |
| 31 event_->Signal(); |
| 32 } |
| 33 |
| 34 } // namespace syncer |
OLD | NEW |