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

Unified Diff: components/sync/base/scoped_event_signal.cc

Issue 2820623002: Revert of [Sync] Refactor ModelSafeWorker::DoWorkAndWaitUntilDone() to avoid code duplication. (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « components/sync/base/scoped_event_signal.h ('k') | components/sync/base/scoped_event_signal_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « components/sync/base/scoped_event_signal.h ('k') | components/sync/base/scoped_event_signal_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698