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

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

Issue 2427803002: [Sync] Replacing NULL with nullptr in code and null in comments for components/sync/ (Closed)
Patch Set: Fixing start of sentence capitlization. Created 4 years, 2 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/base/cancelation_signal.h ('k') | components/sync/base/cryptographer.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/sync/base/cancelation_signal.h" 5 #include "components/sync/base/cancelation_signal.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "components/sync/base/cancelation_observer.h" 8 #include "components/sync/base/cancelation_observer.h"
9 9
10 namespace syncer { 10 namespace syncer {
11 11
12 CancelationSignal::CancelationSignal() : signalled_(false), handler_(NULL) {} 12 CancelationSignal::CancelationSignal() : signalled_(false), handler_(nullptr) {}
13 13
14 CancelationSignal::~CancelationSignal() { 14 CancelationSignal::~CancelationSignal() {
15 DCHECK(!handler_); 15 DCHECK(!handler_);
16 } 16 }
17 17
18 bool CancelationSignal::TryRegisterHandler(CancelationObserver* handler) { 18 bool CancelationSignal::TryRegisterHandler(CancelationObserver* handler) {
19 base::AutoLock lock(signal_lock_); 19 base::AutoLock lock(signal_lock_);
20 DCHECK(!handler_); 20 DCHECK(!handler_);
21 21
22 if (signalled_) 22 if (signalled_)
23 return false; 23 return false;
24 24
25 handler_ = handler; 25 handler_ = handler;
26 return true; 26 return true;
27 } 27 }
28 28
29 void CancelationSignal::UnregisterHandler(CancelationObserver* handler) { 29 void CancelationSignal::UnregisterHandler(CancelationObserver* handler) {
30 base::AutoLock lock(signal_lock_); 30 base::AutoLock lock(signal_lock_);
31 DCHECK_EQ(handler_, handler); 31 DCHECK_EQ(handler_, handler);
32 handler_ = NULL; 32 handler_ = nullptr;
33 } 33 }
34 34
35 bool CancelationSignal::IsSignalled() { 35 bool CancelationSignal::IsSignalled() {
36 base::AutoLock lock(signal_lock_); 36 base::AutoLock lock(signal_lock_);
37 return signalled_; 37 return signalled_;
38 } 38 }
39 39
40 void CancelationSignal::Signal() { 40 void CancelationSignal::Signal() {
41 base::AutoLock lock(signal_lock_); 41 base::AutoLock lock(signal_lock_);
42 DCHECK(!signalled_); 42 DCHECK(!signalled_);
43 43
44 signalled_ = true; 44 signalled_ = true;
45 if (handler_) { 45 if (handler_) {
46 handler_->OnSignalReceived(); 46 handler_->OnSignalReceived();
47 } 47 }
48 } 48 }
49 49
50 } // namespace syncer 50 } // namespace syncer
OLDNEW
« no previous file with comments | « components/sync/base/cancelation_signal.h ('k') | components/sync/base/cryptographer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698