michael@0: // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: #include "base/non_thread_safe.h" michael@0: michael@0: // These checks are only done in debug builds. michael@0: #ifndef NDEBUG michael@0: michael@0: #include "base/logging.h" michael@0: michael@0: NonThreadSafe::NonThreadSafe() michael@0: : valid_thread_id_(PlatformThread::CurrentId()) { michael@0: } michael@0: michael@0: bool NonThreadSafe::CalledOnValidThread() const { michael@0: return valid_thread_id_ == PlatformThread::CurrentId(); michael@0: } michael@0: michael@0: NonThreadSafe::~NonThreadSafe() { michael@0: DCHECK(CalledOnValidThread()); michael@0: } michael@0: michael@0: #endif // NDEBUG