| Index: components/sync/base/scoped_event_signal.cc
|
| diff --git a/components/sync/base/scoped_event_signal.cc b/components/sync/base/scoped_event_signal.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..daaaa1db453f2c1ed56b3fd0c400837a45eb4944
|
| --- /dev/null
|
| +++ b/components/sync/base/scoped_event_signal.cc
|
| @@ -0,0 +1,34 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "components/sync/base/scoped_event_signal.h"
|
| +
|
| +#include "base/logging.h"
|
| +#include "base/synchronization/waitable_event.h"
|
| +
|
| +namespace syncer {
|
| +
|
| +ScopedEventSignal::ScopedEventSignal(base::WaitableEvent* event)
|
| + : event_(event) {
|
| + DCHECK(event_);
|
| +}
|
| +
|
| +ScopedEventSignal::ScopedEventSignal(ScopedEventSignal&& other)
|
| + : event_(other.event_) {
|
| + other.event_ = nullptr;
|
| +}
|
| +
|
| +ScopedEventSignal& ScopedEventSignal::operator=(ScopedEventSignal&& other) {
|
| + DCHECK(!event_);
|
| + event_ = other.event_;
|
| + other.event_ = nullptr;
|
| + return *this;
|
| +}
|
| +
|
| +ScopedEventSignal::~ScopedEventSignal() {
|
| + if (event_)
|
| + event_->Signal();
|
| +}
|
| +
|
| +} // namespace syncer
|
|
|