Pin Chrome's shortcut to the Win10 Start menu on install and OS upgrade.
[chromium-blink-merge.git] / base / synchronization / lock.cc
blobb1576c50c713186f95f9c3d190d635b825996098
1 // Copyright (c) 2011 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 // This file is used for debugging assertion support. The Lock class
6 // is functionally a wrapper around the LockImpl class, so the only
7 // real intelligence in the class is in the debugging logic.
9 #if !defined(NDEBUG) || defined(DCHECK_ALWAYS_ON)
11 #include "base/synchronization/lock.h"
12 #include "base/logging.h"
14 namespace base {
16 Lock::Lock() : lock_() {
19 Lock::~Lock() {
20 DCHECK(owning_thread_ref_.is_null());
23 void Lock::AssertAcquired() const {
24 DCHECK(owning_thread_ref_ == PlatformThread::CurrentRef());
27 void Lock::CheckHeldAndUnmark() {
28 DCHECK(owning_thread_ref_ == PlatformThread::CurrentRef());
29 owning_thread_ref_ = PlatformThreadRef();
32 void Lock::CheckUnheldAndMark() {
33 DCHECK(owning_thread_ref_.is_null());
34 owning_thread_ref_ = PlatformThread::CurrentRef();
37 } // namespace base
39 #endif // !NDEBUG || DCHECK_ALWAYS_ON