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

Side by Side Diff: components/sync/base/scoped_event_signal.h

Issue 2782573002: [Sync] Refactor ModelSafeWorker::DoWorkAndWaitUntilDone() to avoid code duplication. (Closed)
Patch Set: self-review 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 unified diff | Download patch
« no previous file with comments | « components/sync/BUILD.gn ('k') | components/sync/base/scoped_event_signal.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(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 #ifndef COMPONENTS_SYNC_BASE_SCOPED_EVENT_SIGNAL_H_
6 #define COMPONENTS_SYNC_BASE_SCOPED_EVENT_SIGNAL_H_
7
8 #include "base/macros.h"
9
10 namespace base {
11 class WaitableEvent;
12 }
13
14 namespace syncer {
15
16 // An object which signals a WaitableEvent when it is deleted. Used to wait for
17 // a task to run or be abandoned.
18 class ScopedEventSignal {
19 public:
20 // |event| will be signaled in the destructor.
21 explicit ScopedEventSignal(base::WaitableEvent* event);
22
23 // This ScopedEventSignal will signal |other|'s WaitableEvent in its
24 // destructor. |other| will not signal anything in its destructor. The
25 // assignment operator cannot be used if this ScopedEventSignal's
26 // WaitableEvent hasn't been moved to another ScopedEventSignal.
27 ScopedEventSignal(ScopedEventSignal&& other);
28 ScopedEventSignal& operator=(ScopedEventSignal&& other);
29
30 ~ScopedEventSignal();
31
32 private:
33 base::WaitableEvent* event_;
34
35 DISALLOW_COPY_AND_ASSIGN(ScopedEventSignal);
36 };
37
38 } // namespace syncer
39
40 #endif // COMPONENTS_SYNC_BASE_SCOPED_EVENT_SIGNAL_H_
OLDNEW
« no previous file with comments | « components/sync/BUILD.gn ('k') | components/sync/base/scoped_event_signal.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698