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

Unified Diff: components/sync/engine/signal_event_on_delete.cc

Issue 2466313003: Remove ModelSafeWorker::work_done_or_stopped(). (Closed)
Patch Set: self-review Created 4 years, 1 month 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
Index: components/sync/engine/signal_event_on_delete.cc
diff --git a/components/sync/engine/signal_event_on_delete.cc b/components/sync/engine/signal_event_on_delete.cc
new file mode 100644
index 0000000000000000000000000000000000000000..82b61680c0e3c277a9a4d43c63bd45081b631895
--- /dev/null
+++ b/components/sync/engine/signal_event_on_delete.cc
@@ -0,0 +1,36 @@
+// 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/engine/signal_event_on_delete.h"
+
+#include "base/logging.h"
+#include "base/synchronization/waitable_event.h"
+
+namespace syncer {
+
+SignalEventOnDelete::SignalEventOnDelete(base::WaitableEvent* event)
Nicolas Zea 2016/11/01 22:39:23 Although this is all pretty basic logic, would be
fdoray 2016/11/02 15:52:05 Done.
+ : event_(event) {
+ DCHECK(event_);
+}
+
+SignalEventOnDelete::SignalEventOnDelete(SignalEventOnDelete&& other)
+ : event_(other.event_) {
+ other.event_ = nullptr;
+}
+
+SignalEventOnDelete& SignalEventOnDelete::operator=(
+ SignalEventOnDelete&& other) {
+ DCHECK(!event_);
+ event_ = other.event_;
+ other.event_ = nullptr;
+ return *this;
+}
+
+SignalEventOnDelete::~SignalEventOnDelete() {
+ if (event_) {
+ event_->Signal();
+ }
+}
+
+} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698