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
3 // found in the LICENSE file.
5 #include "sync/internal_api/public/base/cancelation_signal.h"
7 #include "base/logging.h"
8 #include "sync/internal_api/public/base/cancelation_observer.h"
12 CancelationSignal::CancelationSignal()
16 CancelationSignal::~CancelationSignal() {
20 bool CancelationSignal::TryRegisterHandler(CancelationObserver
* handler
) {
21 base::AutoLock
lock(signal_lock_
);
31 void CancelationSignal::UnregisterHandler(CancelationObserver
* handler
) {
32 base::AutoLock
lock(signal_lock_
);
33 DCHECK_EQ(handler_
, handler
);
37 bool CancelationSignal::IsSignalled() {
38 base::AutoLock
lock(signal_lock_
);
42 void CancelationSignal::Signal() {
43 base::AutoLock
lock(signal_lock_
);
48 handler_
->OnSignalReceived();