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

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

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.h
diff --git a/components/sync/engine/signal_event_on_delete.h b/components/sync/engine/signal_event_on_delete.h
new file mode 100644
index 0000000000000000000000000000000000000000..e2a93de1da3e0637bf023be947664a95e1ad0424
--- /dev/null
+++ b/components/sync/engine/signal_event_on_delete.h
@@ -0,0 +1,38 @@
+// 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.
+
+#ifndef COMPONENTS_SYNC_ENGINE_SIGNAL_EVENT_ON_DELETE_H_
Nicolas Zea 2016/11/01 22:39:23 I think it would be cleaner to define this file in
fdoray 2016/11/02 15:52:05 Done.
+#define COMPONENTS_SYNC_ENGINE_SIGNAL_EVENT_ON_DELETE_H_
+
+#include "base/macros.h"
+
+namespace base {
+class WaitableEvent;
+}
+
+namespace syncer {
+
+// An object which signals a WaitableEvent when it is deleted. Used to wait for
+// a task to run or be abandonned.
+class SignalEventOnDelete {
Nicolas Zea 2016/11/01 22:39:23 I wonder if it would make more sense to rename thi
fdoray 2016/11/02 15:52:05 Done.
+ public:
+ // |event| is signaled in the destructor.
+ explicit SignalEventOnDelete(base::WaitableEvent* event);
+
+ // This SignalEventOnDelete instance will signal |other|'s event in its
+ // destructor. |other| will not signal anything in its destructor.
+ SignalEventOnDelete(SignalEventOnDelete&& other);
+ SignalEventOnDelete& operator=(SignalEventOnDelete&& other);
+
+ ~SignalEventOnDelete();
+
+ private:
+ base::WaitableEvent* event_;
+
+ DISALLOW_COPY_AND_ASSIGN(SignalEventOnDelete);
+};
+
+} // namespace syncer
+
+#endif // COMPONENTS_SYNC_ENGINE_SIGNAL_EVENT_ON_DELETE_H_

Powered by Google App Engine
This is Rietveld 408576698