1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/ipc/chromium/src/base/non_thread_safe.cc Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,24 @@ 1.4 +// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +#include "base/non_thread_safe.h" 1.9 + 1.10 +// These checks are only done in debug builds. 1.11 +#ifndef NDEBUG 1.12 + 1.13 +#include "base/logging.h" 1.14 + 1.15 +NonThreadSafe::NonThreadSafe() 1.16 + : valid_thread_id_(PlatformThread::CurrentId()) { 1.17 +} 1.18 + 1.19 +bool NonThreadSafe::CalledOnValidThread() const { 1.20 + return valid_thread_id_ == PlatformThread::CurrentId(); 1.21 +} 1.22 + 1.23 +NonThreadSafe::~NonThreadSafe() { 1.24 + DCHECK(CalledOnValidThread()); 1.25 +} 1.26 + 1.27 +#endif // NDEBUG