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

Unified Diff: mojo/public/cpp/utility/mutex.h

Issue 1784643002: Mojo C++ bindings: remove the utility/ folder. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@13_1_remove_thread_dep
Patch Set: Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « mojo/public/cpp/utility/lib/thread_local_win.cc ('k') | mojo/public/cpp/utility/run_loop.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/utility/mutex.h
diff --git a/mojo/public/cpp/utility/mutex.h b/mojo/public/cpp/utility/mutex.h
deleted file mode 100644
index 0f9bee092ac15e1bf0957ca7610bd5fc00d2bdce..0000000000000000000000000000000000000000
--- a/mojo/public/cpp/utility/mutex.h
+++ /dev/null
@@ -1,71 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
-#define MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
-
-#ifdef _WIN32
-#error "Not implemented: See crbug.com/342893."
-#endif
-
-#include <pthread.h>
-
-#include "base/macros.h"
-#include "mojo/public/cpp/system/macros.h"
-
-namespace mojo {
-
-#ifdef NDEBUG
-// Note: Make a C++ constant for |PTHREAD_MUTEX_INITIALIZER|. (We can't directly
-// use the C macro in an initializer list, since it might expand to |{ ... }|.)
-namespace internal {
-const pthread_mutex_t kPthreadMutexInitializer = PTHREAD_MUTEX_INITIALIZER;
-}
-#endif
-
-class Mutex {
- public:
-#ifdef NDEBUG
- Mutex() : mutex_(internal::kPthreadMutexInitializer) {}
- ~Mutex() { pthread_mutex_destroy(&mutex_); }
-
- void Lock() { pthread_mutex_lock(&mutex_); }
- void Unlock() { pthread_mutex_unlock(&mutex_); }
- bool TryLock() { return pthread_mutex_trylock(&mutex_) == 0; }
-
- void AssertHeld() {}
-#else
- Mutex();
- ~Mutex();
-
- void Lock();
- void Unlock();
- bool TryLock();
-
- void AssertHeld();
-#endif
-
- private:
- pthread_mutex_t mutex_;
-
- DISALLOW_COPY_AND_ASSIGN(Mutex);
-};
-
-class MutexLock {
- public:
- explicit MutexLock(Mutex* mutex) : mutex_(mutex) { mutex_->Lock(); }
- ~MutexLock() { mutex_->Unlock(); }
-
- private:
- Mutex* const mutex_;
-
- DISALLOW_COPY_AND_ASSIGN(MutexLock);
-};
-
-// Catch bug where variable name is omitted (e.g., |MutexLock (&mu)|).
-#define MutexLock(x) static_assert(0, "MutexLock() missing variable name");
-
-} // namespace mojo
-
-#endif // MOJO_PUBLIC_CPP_UTILITY_MUTEX_H_
« no previous file with comments | « mojo/public/cpp/utility/lib/thread_local_win.cc ('k') | mojo/public/cpp/utility/run_loop.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698