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

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

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
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 #include "components/sync/base/scoped_event_signal.h"
6
7 #include "base/logging.h"
8 #include "base/synchronization/waitable_event.h"
9
10 namespace syncer {
11
12 ScopedEventSignal::ScopedEventSignal(base::WaitableEvent* event)
13 : event_(event) {
14 DCHECK(event_);
15 }
16
17 ScopedEventSignal::ScopedEventSignal(ScopedEventSignal&& other)
18 : event_(other.event_) {
19 other.event_ = nullptr;
20 }
21
22 ScopedEventSignal& ScopedEventSignal::operator=(ScopedEventSignal&& other) {
23 DCHECK(!event_);
24 event_ = other.event_;
25 other.event_ = nullptr;
26 return *this;
27 }
28
29 ScopedEventSignal::~ScopedEventSignal() {
30 if (event_)
31 event_->Signal();
32 }
33
34 } // namespace syncer
OLDNEW
« 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